mirror of
https://github.com/github/codeql.git
synced 2025-12-17 01:03:14 +01:00
Merge pull request #9816 from erik-krogh/msgConsis
Make alert messages consistent across languages
This commit is contained in:
@@ -29,7 +29,4 @@ where
|
||||
n = strictcount(ComplexStmt s | s = b.getAStmt()) and
|
||||
n > 3 and
|
||||
complexStmt = b.getAStmt()
|
||||
select b,
|
||||
"Block with too many statements (" + n.toString() +
|
||||
" complex statements in the block). Complex statements at: $@", complexStmt,
|
||||
complexStmt.toString()
|
||||
select b, "Block with too many statements (" + n.toString() + " complex statements in the block)."
|
||||
|
||||
@@ -110,4 +110,4 @@ where
|
||||
emptyBlock(s, eb) and
|
||||
not emptyBlockContainsNonchild(eb) and
|
||||
not lineComment(eb)
|
||||
select eb, "Empty block without comment"
|
||||
select eb, "Empty block without comment."
|
||||
|
||||
@@ -12,4 +12,4 @@
|
||||
import CommentedOutCode
|
||||
|
||||
from CommentedOutCode comment
|
||||
select comment, "This comment appears to contain commented-out code"
|
||||
select comment, "This comment appears to contain commented-out code."
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
/**
|
||||
* @name Sign check of bitwise operation
|
||||
* @description Checking the sign of a bitwise operation often has surprising
|
||||
* edge cases.
|
||||
* @description Checking the sign of the result of a bitwise operation may yield unexpected results.
|
||||
* @kind problem
|
||||
* @problem.severity warning
|
||||
* @precision high
|
||||
@@ -26,4 +25,4 @@ where
|
||||
forall(int op | op = lhs.(BitwiseAndExpr).getAnOperand().getValue().toInt() | op < 0) and
|
||||
// exception for cases involving macros
|
||||
not e.isAffectedByMacro()
|
||||
select e, "Potential unsafe sign check of a bitwise operation."
|
||||
select e, "Potentially unsafe sign check of a bitwise operation."
|
||||
|
||||
@@ -21,4 +21,4 @@ where
|
||||
FloatingPointType and
|
||||
not ro.getAnOperand().isConstant() and // comparisons to constants generate too many false positives
|
||||
not left.(VariableAccess).getTarget() = right.(VariableAccess).getTarget() // skip self comparison
|
||||
select ro, "Equality test on floating point values may not behave as expected."
|
||||
select ro, "Equality checks on floating point values can yield unexpected results."
|
||||
|
||||
@@ -13,10 +13,11 @@
|
||||
|
||||
import cpp
|
||||
|
||||
from EnumSwitch es, float missing, float total
|
||||
from EnumSwitch es, float missing, float total, EnumConstant case
|
||||
where
|
||||
not es.hasDefaultCase() and
|
||||
missing = count(es.getAMissingCase()) and
|
||||
total = missing + count(es.getASwitchCase()) and
|
||||
missing / total < 0.3
|
||||
select es, "Switch statement is missing case for " + es.getAMissingCase().getName()
|
||||
missing / total < 0.3 and
|
||||
case = es.getAMissingCase()
|
||||
select es, "Switch statement does not have a case for $@.", case, case.getName()
|
||||
|
||||
4
cpp/ql/src/change-notes/2022-08-23-alert-messages.md
Normal file
4
cpp/ql/src/change-notes/2022-08-23-alert-messages.md
Normal file
@@ -0,0 +1,4 @@
|
||||
---
|
||||
category: minorAnalysis
|
||||
---
|
||||
* The alert message of many queries have been changed to make the message consistent with other languages.
|
||||
@@ -1,3 +1,3 @@
|
||||
| empty_block.cpp:9:10:9:11 | { ... } | Empty block without comment |
|
||||
| empty_block.cpp:12:10:13:3 | { ... } | Empty block without comment |
|
||||
| empty_block.cpp:20:10:21:3 | { ... } | Empty block without comment |
|
||||
| empty_block.cpp:9:10:9:11 | { ... } | Empty block without comment. |
|
||||
| empty_block.cpp:12:10:13:3 | { ... } | Empty block without comment. |
|
||||
| empty_block.cpp:20:10:21:3 | { ... } | Empty block without comment. |
|
||||
|
||||
@@ -1,20 +1,20 @@
|
||||
| test2.cpp:37:1:37:39 | // int myFunction() { return myValue; } | This comment appears to contain commented-out code |
|
||||
| test2.cpp:39:1:39:45 | // int myFunction() const { return myValue; } | This comment appears to contain commented-out code |
|
||||
| test2.cpp:41:1:41:54 | // int myFunction() const noexcept { return myValue; } | This comment appears to contain commented-out code |
|
||||
| test2.cpp:43:1:43:18 | // #define MYMACRO | This comment appears to contain commented-out code |
|
||||
| test2.cpp:45:1:45:23 | // #include "include.h" | This comment appears to contain commented-out code |
|
||||
| test2.cpp:47:1:51:2 | /*\n#ifdef\nvoid myFunction();\n#endif\n*/ | This comment appears to contain commented-out code |
|
||||
| test2.cpp:59:1:59:24 | // #if(defined(MYMACRO)) | This comment appears to contain commented-out code |
|
||||
| test2.cpp:63:1:63:15 | // #pragma once | This comment appears to contain commented-out code |
|
||||
| test2.cpp:65:1:65:17 | // # pragma once | This comment appears to contain commented-out code |
|
||||
| test2.cpp:67:1:67:19 | /*#error"myerror"*/ | This comment appears to contain commented-out code |
|
||||
| test2.cpp:91:1:95:2 | /*\n#ifdef MYMACRO\n\t// ...\n#endif // #ifdef MYMACRO\n*/ | This comment appears to contain commented-out code |
|
||||
| test2.cpp:107:21:107:43 | // #include "config2.h" | This comment appears to contain commented-out code |
|
||||
| test2.cpp:115:16:115:35 | /* #ifdef MYMACRO */ | This comment appears to contain commented-out code |
|
||||
| test2.cpp:117:1:117:24 | // commented_out_code(); | This comment appears to contain commented-out code |
|
||||
| test2.cpp:120:2:120:25 | // commented_out_code(); | This comment appears to contain commented-out code |
|
||||
| test.c:2:1:2:22 | // commented out code; | This comment appears to contain commented-out code |
|
||||
| test.c:4:1:7:8 | // some; | This comment appears to contain commented-out code |
|
||||
| test.c:9:1:13:8 | // also; | This comment appears to contain commented-out code |
|
||||
| test.c:21:1:26:2 | /*\n some;\n commented;\n out;\n code;\n*/ | This comment appears to contain commented-out code |
|
||||
| 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 |
|
||||
| test2.cpp:37:1:37:39 | // int myFunction() { return myValue; } | This comment appears to contain commented-out code. |
|
||||
| test2.cpp:39:1:39:45 | // int myFunction() const { return myValue; } | This comment appears to contain commented-out code. |
|
||||
| test2.cpp:41:1:41:54 | // int myFunction() const noexcept { return myValue; } | This comment appears to contain commented-out code. |
|
||||
| test2.cpp:43:1:43:18 | // #define MYMACRO | This comment appears to contain commented-out code. |
|
||||
| test2.cpp:45:1:45:23 | // #include "include.h" | This comment appears to contain commented-out code. |
|
||||
| test2.cpp:47:1:51:2 | /*\n#ifdef\nvoid myFunction();\n#endif\n*/ | This comment appears to contain commented-out code. |
|
||||
| test2.cpp:59:1:59:24 | // #if(defined(MYMACRO)) | This comment appears to contain commented-out code. |
|
||||
| test2.cpp:63:1:63:15 | // #pragma once | This comment appears to contain commented-out code. |
|
||||
| test2.cpp:65:1:65:17 | // # pragma once | This comment appears to contain commented-out code. |
|
||||
| test2.cpp:67:1:67:19 | /*#error"myerror"*/ | This comment appears to contain commented-out code. |
|
||||
| test2.cpp:91:1:95:2 | /*\n#ifdef MYMACRO\n\t// ...\n#endif // #ifdef MYMACRO\n*/ | This comment appears to contain commented-out code. |
|
||||
| test2.cpp:107:21:107:43 | // #include "config2.h" | This comment appears to contain commented-out code. |
|
||||
| test2.cpp:115:16:115:35 | /* #ifdef MYMACRO */ | This comment appears to contain commented-out code. |
|
||||
| test2.cpp:117:1:117:24 | // commented_out_code(); | This comment appears to contain commented-out code. |
|
||||
| test2.cpp:120:2:120:25 | // commented_out_code(); | This comment appears to contain commented-out code. |
|
||||
| test.c:2:1:2:22 | // commented out code; | This comment appears to contain commented-out code. |
|
||||
| test.c:4:1:7:8 | // some; | This comment appears to contain commented-out code. |
|
||||
| test.c:9:1:13:8 | // also; | This comment appears to contain commented-out code. |
|
||||
| test.c:21:1:26:2 | /*\n some;\n commented;\n out;\n code;\n*/ | This comment appears to contain commented-out code. |
|
||||
| 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,4 +1,4 @@
|
||||
| bsc.cpp:2:10:2:32 | ... > ... | Potential unsafe sign check of a bitwise operation. |
|
||||
| bsc.cpp:6:10:6:32 | ... > ... | Potential unsafe sign check of a bitwise operation. |
|
||||
| bsc.cpp:18:10:18:28 | ... > ... | Potential unsafe sign check of a bitwise operation. |
|
||||
| bsc.cpp:22:10:22:28 | ... < ... | Potential unsafe sign check of a bitwise operation. |
|
||||
| bsc.cpp:2:10:2:32 | ... > ... | Potentially unsafe sign check of a bitwise operation. |
|
||||
| bsc.cpp:6:10:6:32 | ... > ... | Potentially unsafe sign check of a bitwise operation. |
|
||||
| bsc.cpp:18:10:18:28 | ... > ... | Potentially unsafe sign check of a bitwise operation. |
|
||||
| bsc.cpp:22:10:22:28 | ... < ... | Potentially unsafe sign check of a bitwise operation. |
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
| c.c:10:5:10:10 | ... == ... | Equality test on floating point values may not behave as expected. |
|
||||
| c.c:14:5:14:14 | ... == ... | Equality test on floating point values may not behave as expected. |
|
||||
| c.c:16:5:16:12 | ... == ... | Equality test on floating point values may not behave as expected. |
|
||||
| c.c:17:5:17:12 | ... == ... | Equality test on floating point values may not behave as expected. |
|
||||
| c.c:10:5:10:10 | ... == ... | Equality checks on floating point values can yield unexpected results. |
|
||||
| c.c:14:5:14:14 | ... == ... | Equality checks on floating point values can yield unexpected results. |
|
||||
| c.c:16:5:16:12 | ... == ... | Equality checks on floating point values can yield unexpected results. |
|
||||
| c.c:17:5:17:12 | ... == ... | Equality checks on floating point values can yield unexpected results. |
|
||||
|
||||
Reference in New Issue
Block a user