Skip to content

Commit 62831e9

Browse files
committed
QL: Add filter for NewType to camel case query
1 parent 3db9d56 commit 62831e9

File tree

3 files changed

+2
-2
lines changed

3 files changed

+2
-2
lines changed

ql/ql/src/codeql_ql/style/AcronymsShouldBeCamelCaseQuery.qll

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,5 +68,6 @@ predicate shouldBePascalCased(string name, AstNode node, string kind) {
6868
// allowed upper-case acronyms.
6969
not name.regexpMatch(".*(PEP|AES|DES|EOF).*") and
7070
not (name.regexpMatch("T[A-Z]{3}[^A-Z].*") and node instanceof NewTypeBranch) and
71+
not (name.regexpMatch("T[A-Z]{3}[^A-Z].*") and node instanceof NewType) and
7172
not name.toUpperCase() = name // We are OK with fully-uppercase names.
7273
}
Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
| Test.qll:2:1:2:27 | ClasslessPredicate isXML | Acronyms in isXML should be PascalCase/camelCase |
22
| Test.qll:8:1:10:15 | NewType TXMLElements | Acronyms in TXMLElements should be PascalCase/camelCase |
33
| Test.qll:10:3:10:15 | NewTypeBranch TXMLElement | Acronyms in TXMLElement should be PascalCase/camelCase |
4-
| Test.qll:13:1:14:16 | NewType TIRFunction | Acronyms in TIRFunction should be PascalCase/camelCase |

ql/ql/test/queries/style/AcronymsShouldBeCamelCase/Test.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,6 @@ newtype TXMLElements =
99
TXmlElement() or // GOOD
1010
TXMLElement() // BAD
1111

12-
// GOOD [ FALSE POSITIVE ]
12+
// GOOD
1313
newtype TIRFunction =
1414
MkIRFunction()

0 commit comments

Comments
 (0)