Skip to content

Commit 5458243

Browse files
committed
QL: recognize the names defined by import as statements
1 parent 3067231 commit 5458243

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ string getName(AstNode node, string kind) {
2727
result = node.(FieldDecl).getName() and kind = "field"
2828
or
2929
result = node.(Module).getName() and kind = "module"
30+
or
31+
result = node.(Import).importedAs() and kind = "import"
3032
}
3133

3234
string prettyPluralKind(string kind) {
@@ -45,6 +47,8 @@ string prettyPluralKind(string kind) {
4547
kind = "field" and result = "fields"
4648
or
4749
kind = "module" and result = "modules"
50+
or
51+
kind = "import" and result = "imports"
4852
}
4953

5054
/**

ql/ql/src/queries/style/NameCasing.ql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import codeql_ql.style.AcronymsShouldBeCamelCaseQuery as AcronymsQuery
1313

1414
predicate shouldBeUpperCase(AstNode node, string name, string kind) {
1515
name = AcronymsQuery::getName(node, kind) and
16-
kind = ["class", "newtypeBranch", "newtype", "module"]
16+
kind = ["class", "newtypeBranch", "newtype", "module", "import"]
1717
}
1818

1919
predicate shouldBeLowerCase(AstNode node, string name, string kind) {

0 commit comments

Comments
 (0)