Skip to content

Commit bac2291

Browse files
committed
Add reason to alert message
1 parent 7fe9396 commit bac2291

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

c/misra/src/rules/RULE-14-2/ForLoopNotWellFormed.ql

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ import cpp
1515
import codingstandards.c.misra
1616
import codingstandards.cpp.Loops
1717

18-
from ForStmt for
18+
from ForStmt for, Element reasonLocation, string reason, string reasonLabel
1919
where
2020
not isExcluded(for, Statements4Package::forLoopNotWellFormedQuery()) and
21-
isInvalidLoop(for)
22-
select for, "For loop is not well formed."
21+
isInvalidLoop(for, reason, reasonLocation, reasonLabel)
22+
select for, "For loop is not well formed, " + reason + ".", reasonLocation, reasonLabel
Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
| test.c:7:3:8:3 | for(...;...;...) ... | For loop is not well formed. |
2-
| test.c:14:3:15:3 | for(...;...;...) ... | For loop is not well formed. |
3-
| test.c:20:3:21:3 | for(...;...;...) ... | For loop is not well formed. |
4-
| test.c:25:3:26:3 | for(...;...;...) ... | For loop is not well formed. |
5-
| test.c:38:3:39:3 | for(...;...;...) ... | For loop is not well formed. |
6-
| test.c:52:3:53:3 | for(...;...;...) ... | For loop is not well formed. |
7-
| test.c:64:3:67:3 | for(...;...;...) ... | For loop is not well formed. |
1+
| test.c:7:3:8:3 | for(...;...;...) ... | For loop is not well formed, it uses a loop counter '$@' of type floating-point. | test.c:7:14:7:14 | f | f |
2+
| test.c:14:3:15:3 | for(...;...;...) ... | For loop is not well formed, it uses multiple loop counters$@. | file://:0:0:0:0 | | |
3+
| test.c:20:3:21:3 | for(...;...;...) ... | For loop is not well formed, it uses multiple loop counters$@. | file://:0:0:0:0 | | |
4+
| test.c:25:3:26:3 | for(...;...;...) ... | For loop is not well formed, it $@ its loop counter 'i' with an operation that is not an increment or decrement. | test.c:25:28:25:28 | i | updates |
5+
| test.c:38:3:39:3 | for(...;...;...) ... | For loop is not well formed, it $@ the loop counter 'x' irregularly. | test.c:38:26:38:26 | x | updates |
6+
| test.c:52:3:53:3 | for(...;...;...) ... | For loop is not well formed, it updates $@, a loop control variable other than the loop counter, in the update expression of the loop. | test.c:52:28:52:29 | p1 | p1 |
7+
| test.c:64:3:67:3 | for(...;...;...) ... | For loop is not well formed, it $@ the loop counter 'x' in the body of the loop. | test.c:65:5:65:5 | x | updates |

0 commit comments

Comments
 (0)