Skip to content

Commit e7e5f2d

Browse files
committed
more progress
1 parent 0261e26 commit e7e5f2d

File tree

13 files changed

+33
-33
lines changed

13 files changed

+33
-33
lines changed

cpp/ql/src/Best Practices/BlockWithTooManyStatements.ql

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,4 @@ where
2929
n = strictcount(ComplexStmt s | s = b.getAStmt()) and
3030
n > 3 and
3131
complexStmt = b.getAStmt()
32-
select b,
33-
"Block with too many statements (" + n.toString() +
34-
" complex statements in the block). Complex statements at: $@", complexStmt,
35-
complexStmt.toString()
32+
select b, "Block with too many statements (" + n.toString() + " complex statements in the block)."

cpp/ql/src/Best Practices/Likely Errors/EmptyBlock.ql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,4 +110,4 @@ where
110110
emptyBlock(s, eb) and
111111
not emptyBlockContainsNonchild(eb) and
112112
not lineComment(eb)
113-
select eb, "Empty block without comment"
113+
select eb, "Empty block without comment."

cpp/ql/src/Best Practices/Unused Entities/UnusedLocals.ql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,4 +58,4 @@ where
5858
not exists(AsmStmt s | f = s.getEnclosingFunction()) and
5959
not v.getAnAttribute().getName() = "unused" and
6060
not any(ErrorExpr e).getEnclosingFunction() = f // unextracted expr may use `v`
61-
select v, "Variable " + v.getName() + " is not used"
61+
select v, "This assigns the variable " + v.getName() + " to itself and has no effect."

cpp/ql/src/Likely Bugs/Arithmetic/BitwiseSignCheck.ql

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
/**
22
* @name Sign check of bitwise operation
3-
* @description Checking the sign of a bitwise operation often has surprising
4-
* edge cases.
3+
* @description Checking the sign of the result of a bitwise operation may yield unexpected results.
54
* @kind problem
65
* @problem.severity warning
76
* @precision high
@@ -26,4 +25,4 @@ where
2625
forall(int op | op = lhs.(BitwiseAndExpr).getAnOperand().getValue().toInt() | op < 0) and
2726
// exception for cases involving macros
2827
not e.isAffectedByMacro()
29-
select e, "Potential unsafe sign check of a bitwise operation."
28+
select e, "Sign check of a bitwise operation."

cpp/ql/src/Likely Bugs/Likely Typos/MissingEnumCaseInSwitch.ql

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,11 @@
1313

1414
import cpp
1515

16-
from EnumSwitch es, float missing, float total
16+
from EnumSwitch es, float missing, float total, EnumConstant missing
1717
where
1818
not es.hasDefaultCase() and
1919
missing = count(es.getAMissingCase()) and
2020
total = missing + count(es.getASwitchCase()) and
21-
missing / total < 0.3
22-
select es, "Switch statement is missing case for " + es.getAMissingCase().getName()
21+
missing / total < 0.3 and
22+
missing = es.getAMissingCase()
23+
select es, "Switch statement does not have a case for $@.", missing, missing.getName()

csharp/ql/src/Bad Practices/Naming Conventions/ConfusingOverridesNames.ql

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,5 +72,5 @@ where
7272
) and
7373
m1.fromSource()
7474
select m1,
75-
"confusing to have methods " + m1.getName() + " in " + m1.getDeclaringType().getName() + " and " +
76-
m2.getName() + " in " + m2.getDeclaringType().getName() + "."
75+
"It is confusing to have methods " + m1.getName() + " in " + m1.getDeclaringType().getName() +
76+
" and " + m2.getName() + " in " + m2.getDeclaringType().getName() + "."

csharp/ql/src/Likely Bugs/Collections/ContainerLengthCmpOffByOne.ql

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,5 @@ where
6464
validGuard.controls(array, index) and
6565
validGuard.guards(indexAccess, _)
6666
)
67-
select incorrectGuard,
68-
"Off-by-one index comparison against length leads to possible out of bounds $@.", ea,
69-
ea.toString()
67+
select incorrectGuard, "Off-by-one index comparison against length may lead to out-of-bounds $@.",
68+
ea, ea.toString()

csharp/ql/src/Likely Bugs/Statements/EmptyBlock.ql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,4 +42,4 @@ where
4242
(loopStmtWithEmptyBlock(s) or conditionalWithEmptyBlock(s)) and
4343
not exists(CommentBlock c | c.getParent() = s) and
4444
not exists(ForStmt fs | fs.getBody() = s and exists(fs.getAnUpdate()))
45-
select s, "Empty block."
45+
select s, "Empty block without comment."

java/ql/src/Violations of Best Practice/Dead Code/DeadStoreOfLocalUnread.ql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,4 @@ where
2121
read(v) and
2222
not def.(AssignExpr).getSource() instanceof NullLiteral and
2323
(def instanceof Assignment or def.(UnaryAssignExpr).getParent() instanceof ExprStmt)
24-
select def, "This assignment to " + v.getName() + " is useless: the value is never read."
24+
select def, "This definition of " + v.getName() + " is never used."

java/ql/src/Violations of Best Practice/Dead Code/UnusedLocal.ql

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,4 @@ where
2929
// Rules about catch clauses belong in an exception handling query
3030
not exceptionVariable(ve) and
3131
not enhancedForVariable(ve)
32-
select v,
33-
"Unused local variable " + v.getName() +
34-
". The variable is never read or written to and should be removed."
32+
select v, "This assigns the variable " + v.getName() + " to itself and has no effect."

0 commit comments

Comments
 (0)