Skip to content

Commit 06afe9c

Browse files
authored
Merge pull request #9816 from erik-krogh/msgConsis
Make alert messages consistent across languages
2 parents 2e2621a + c7aa582 commit 06afe9c

File tree

106 files changed

+764
-729
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

106 files changed

+764
-729
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/Documentation/CommentedOutCode.ql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,4 @@
1212
import CommentedOutCode
1313

1414
from CommentedOutCode comment
15-
select comment, "This comment appears to contain commented-out code"
15+
select comment, "This comment appears to contain commented-out code."

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, "Potentially unsafe sign check of a bitwise operation."

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,4 @@ where
2121
FloatingPointType and
2222
not ro.getAnOperand().isConstant() and // comparisons to constants generate too many false positives
2323
not left.(VariableAccess).getTarget() = right.(VariableAccess).getTarget() // skip self comparison
24-
select ro, "Equality test on floating point values may not behave as expected."
24+
select ro, "Equality checks on floating point values can yield unexpected results."

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 case
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+
case = es.getAMissingCase()
23+
select es, "Switch statement does not have a case for $@.", case, case.getName()
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
---
2+
category: minorAnalysis
3+
---
4+
* The alert message of many queries have been changed to make the message consistent with other languages.
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
| empty_block.cpp:9:10:9:11 | { ... } | Empty block without comment |
2-
| empty_block.cpp:12:10:13:3 | { ... } | Empty block without comment |
3-
| empty_block.cpp:20:10:21:3 | { ... } | Empty block without comment |
1+
| empty_block.cpp:9:10:9:11 | { ... } | Empty block without comment. |
2+
| empty_block.cpp:12:10:13:3 | { ... } | Empty block without comment. |
3+
| empty_block.cpp:20:10:21:3 | { ... } | Empty block without comment. |
Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
1-
| test2.cpp:37:1:37:39 | // int myFunction() { return myValue; } | This comment appears to contain commented-out code |
2-
| test2.cpp:39:1:39:45 | // int myFunction() const { return myValue; } | This comment appears to contain commented-out code |
3-
| test2.cpp:41:1:41:54 | // int myFunction() const noexcept { return myValue; } | This comment appears to contain commented-out code |
4-
| test2.cpp:43:1:43:18 | // #define MYMACRO | This comment appears to contain commented-out code |
5-
| test2.cpp:45:1:45:23 | // #include "include.h" | This comment appears to contain commented-out code |
6-
| test2.cpp:47:1:51:2 | /*\n#ifdef\nvoid myFunction();\n#endif\n*/ | This comment appears to contain commented-out code |
7-
| test2.cpp:59:1:59:24 | // #if(defined(MYMACRO)) | This comment appears to contain commented-out code |
8-
| test2.cpp:63:1:63:15 | // #pragma once | This comment appears to contain commented-out code |
9-
| test2.cpp:65:1:65:17 | // # pragma once | This comment appears to contain commented-out code |
10-
| test2.cpp:67:1:67:19 | /*#error"myerror"*/ | This comment appears to contain commented-out code |
11-
| test2.cpp:91:1:95:2 | /*\n#ifdef MYMACRO\n\t// ...\n#endif // #ifdef MYMACRO\n*/ | This comment appears to contain commented-out code |
12-
| test2.cpp:107:21:107:43 | // #include "config2.h" | This comment appears to contain commented-out code |
13-
| test2.cpp:115:16:115:35 | /* #ifdef MYMACRO */ | This comment appears to contain commented-out code |
14-
| test2.cpp:117:1:117:24 | // commented_out_code(); | This comment appears to contain commented-out code |
15-
| test2.cpp:120:2:120:25 | // commented_out_code(); | This comment appears to contain commented-out code |
16-
| test.c:2:1:2:22 | // commented out code; | This comment appears to contain commented-out code |
17-
| test.c:4:1:7:8 | // some; | This comment appears to contain commented-out code |
18-
| test.c:9:1:13:8 | // also; | This comment appears to contain commented-out code |
19-
| test.c:21:1:26:2 | /*\n some;\n commented;\n out;\n code;\n*/ | This comment appears to contain commented-out code |
20-
| test.c:28:1:34:2 | /*\n also;\n this\n is;\n commented-out\n code;\n*/ | This comment appears to contain commented-out code |
1+
| test2.cpp:37:1:37:39 | // int myFunction() { return myValue; } | This comment appears to contain commented-out code. |
2+
| test2.cpp:39:1:39:45 | // int myFunction() const { return myValue; } | This comment appears to contain commented-out code. |
3+
| test2.cpp:41:1:41:54 | // int myFunction() const noexcept { return myValue; } | This comment appears to contain commented-out code. |
4+
| test2.cpp:43:1:43:18 | // #define MYMACRO | This comment appears to contain commented-out code. |
5+
| test2.cpp:45:1:45:23 | // #include "include.h" | This comment appears to contain commented-out code. |
6+
| test2.cpp:47:1:51:2 | /*\n#ifdef\nvoid myFunction();\n#endif\n*/ | This comment appears to contain commented-out code. |
7+
| test2.cpp:59:1:59:24 | // #if(defined(MYMACRO)) | This comment appears to contain commented-out code. |
8+
| test2.cpp:63:1:63:15 | // #pragma once | This comment appears to contain commented-out code. |
9+
| test2.cpp:65:1:65:17 | // # pragma once | This comment appears to contain commented-out code. |
10+
| test2.cpp:67:1:67:19 | /*#error"myerror"*/ | This comment appears to contain commented-out code. |
11+
| test2.cpp:91:1:95:2 | /*\n#ifdef MYMACRO\n\t// ...\n#endif // #ifdef MYMACRO\n*/ | This comment appears to contain commented-out code. |
12+
| test2.cpp:107:21:107:43 | // #include "config2.h" | This comment appears to contain commented-out code. |
13+
| test2.cpp:115:16:115:35 | /* #ifdef MYMACRO */ | This comment appears to contain commented-out code. |
14+
| test2.cpp:117:1:117:24 | // commented_out_code(); | This comment appears to contain commented-out code. |
15+
| test2.cpp:120:2:120:25 | // commented_out_code(); | This comment appears to contain commented-out code. |
16+
| test.c:2:1:2:22 | // commented out code; | This comment appears to contain commented-out code. |
17+
| test.c:4:1:7:8 | // some; | This comment appears to contain commented-out code. |
18+
| test.c:9:1:13:8 | // also; | This comment appears to contain commented-out code. |
19+
| test.c:21:1:26:2 | /*\n some;\n commented;\n out;\n code;\n*/ | This comment appears to contain commented-out code. |
20+
| test.c:28:1:34:2 | /*\n also;\n this\n is;\n commented-out\n code;\n*/ | This comment appears to contain commented-out code. |
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
| bsc.cpp:2:10:2:32 | ... > ... | Potential unsafe sign check of a bitwise operation. |
2-
| bsc.cpp:6:10:6:32 | ... > ... | Potential unsafe sign check of a bitwise operation. |
3-
| bsc.cpp:18:10:18:28 | ... > ... | Potential unsafe sign check of a bitwise operation. |
4-
| bsc.cpp:22:10:22:28 | ... < ... | Potential unsafe sign check of a bitwise operation. |
1+
| bsc.cpp:2:10:2:32 | ... > ... | Potentially unsafe sign check of a bitwise operation. |
2+
| bsc.cpp:6:10:6:32 | ... > ... | Potentially unsafe sign check of a bitwise operation. |
3+
| bsc.cpp:18:10:18:28 | ... > ... | Potentially unsafe sign check of a bitwise operation. |
4+
| bsc.cpp:22:10:22:28 | ... < ... | Potentially unsafe sign check of a bitwise operation. |

0 commit comments

Comments
 (0)