Skip to content

Commit f3f3b94

Browse files
committed
fix some more style-guide violations in the alert-messages
1 parent 5f740a5 commit f3f3b94

16 files changed

+37
-34
lines changed

ql/ql/src/queries/bugs/MissingSanitizerGuardCase.ql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,4 @@ from SanGuard guard
2525
where
2626
not exists(TypeExpr t | t.getResolvedType().(ClassType).getDeclaration() = guard) and
2727
not guard.hasAnnotation("deprecated")
28-
select guard, "Guard class is not mentioned anywhere"
28+
select guard, "Guard class is not mentioned anywhere."

ql/ql/src/queries/performance/DontUseGetAQlClass.ql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,4 @@ where
1919
not call.getLocation().getFile().getAbsolutePath().matches("%/" + ["meta", "test"] + "/%") and
2020
not call.getLocation().getFile().getBaseName().toLowerCase() =
2121
["consistency.ql", "test.ql", "tst.ql", "tests.ql"]
22-
select call, "Don't use .getAQlClass"
22+
select call, "Don't use '.getAQlClass()'."

ql/ql/src/queries/performance/NonInitialStdLibImport.ql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,4 +27,4 @@ Import importBefore(Import i) {
2727

2828
from Import i
2929
where isStdLibImport(i, _) and exists(importBefore(i))
30-
select i, "This import may cause reevaluation to occur, as there are other imports preceding it"
30+
select i, "This import may cause reevaluation to occur, as there are other imports preceding it."

ql/ql/src/queries/performance/TransitiveStep.ql

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -161,5 +161,5 @@ predicate transitiveDelta(Call rec, TransitivelyClosedCall tc) {
161161

162162
from Call rec, TransitivelyClosedCall tc, AstNode reason
163163
where transitiveDelta(rec, tc) and reason = tc.getReason()
164-
select tc, "This recursive delta is transively closed $@, which may be a performance problem.",
165-
reason, "here"
164+
select tc, "This recursive delta $@, which may be a performance problem.", reason,
165+
"is transively closed"

ql/ql/src/queries/performance/UnusedField.ql

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,5 +31,5 @@ where
3131
)
3232
) and
3333
(if clz = implClz then extraMsg = "." else extraMsg = " of any class between it and $@.")
34-
select clz, "The field $@ declared in $@ is not used in the characteristic predicate" + extraMsg,
35-
field, field.getName(), clz, clz.getName(), implClz, implClz.getName()
34+
select clz, "This class declares $@ that is not used in the characteristic predicate" + extraMsg,
35+
field, "field " + field.getName(), implClz, implClz.getName()

ql/ql/src/queries/style/AcronymsShouldBeCamelCase.ql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,4 @@ import codeql_ql.style.AcronymsShouldBeCamelCaseQuery
1414

1515
from string name, AstNode node
1616
where shouldBePascalCased(name, node, _)
17-
select node, "Acronyms in " + name + " should be PascalCase/camelCase"
17+
select node, "Acronyms in " + name + " should be PascalCase/camelCase."

ql/ql/src/queries/style/AlertMessage.ql

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ String avoidHere(Select sel, string part) {
126126
String avoidArticleInLinkText(Select sel) {
127127
result = sel.getExpr((any(int i | i > 1))) and
128128
result = getSelectPart(sel, _) and
129-
result.getValue().regexpMatch("a|an .*")
129+
result.getValue().regexpMatch("(a|an) .*")
130130
}
131131

132132
/**
@@ -203,6 +203,9 @@ AstNode getAlertLocLink(Select sel) {
203203
from AstNode node, string msg, Select sel
204204
where
205205
not node.getLocation().getFile().getAbsolutePath().matches("%/test/%") and
206+
not node.getLocation().getFile().getAbsolutePath().matches("%/examples/%") and
207+
not node.getLocation().getFile().getAbsolutePath().matches("%/experimental/%") and
208+
not node.getLocation().getFile().getAbsolutePath().matches("%/meta/%") and
206209
sel.getQueryDoc().getQueryKind() = ["problem", "path-problem"] and
207210
(
208211
node = shouldHaveFullStop(sel) and

ql/ql/src/queries/style/DeadCode.ql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,4 @@ import codeql_ql.style.DeadCodeQuery
1212

1313
from AstNode node
1414
where isDead(node)
15-
select node, "Code is dead"
15+
select node, "Code is dead."

ql/ql/src/queries/style/FieldOnlyUsedInCharPred.ql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,4 @@ where
2222
call.getEnclosingPredicate() = c.getCharPred() and call.getTarget() instanceof NewTypeBranch
2323
).getAnArgument() and
2424
not f.getVarDecl().overrides(_)
25-
select f, "Field is only used in CharPred"
25+
select f, "Field is only used in CharPred."

ql/ql/src/queries/style/RedundantCast.ql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@ import codeql_ql.style.RedundantCastQuery
1313

1414
from AstNode node, TypeExpr type
1515
where redundantCast(node, type)
16-
select node, "Redundant cast to $@", type, type.getResolvedType().getName()
16+
select node, "Redundant cast to $@.", type, type.getResolvedType().getName()

0 commit comments

Comments
 (0)