QL: recognize the names defined by import as statements

This commit is contained in:
Erik Krogh Kristensen
2022-03-15 14:29:33 +01:00
parent 3067231b1a
commit 54582438a1
2 changed files with 5 additions and 1 deletions

View File

@@ -27,6 +27,8 @@ string getName(AstNode node, string kind) {
result = node.(FieldDecl).getName() and kind = "field"
or
result = node.(Module).getName() and kind = "module"
or
result = node.(Import).importedAs() and kind = "import"
}
string prettyPluralKind(string kind) {
@@ -45,6 +47,8 @@ string prettyPluralKind(string kind) {
kind = "field" and result = "fields"
or
kind = "module" and result = "modules"
or
kind = "import" and result = "imports"
}
/**

View File

@@ -13,7 +13,7 @@ import codeql_ql.style.AcronymsShouldBeCamelCaseQuery as AcronymsQuery
predicate shouldBeUpperCase(AstNode node, string name, string kind) {
name = AcronymsQuery::getName(node, kind) and
kind = ["class", "newtypeBranch", "newtype", "module"]
kind = ["class", "newtypeBranch", "newtype", "module", "import"]
}
predicate shouldBeLowerCase(AstNode node, string name, string kind) {