Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit5ad61ee

Browse files
committed
Deviations: Include the final line in ranges
The deviated locations now include the line with the _end marker,for any element before the marker.
1 parent126ed55 commit5ad61ee

File tree

2 files changed

+26
-16
lines changed

2 files changed

+26
-16
lines changed

‎cpp/common/src/codingstandards/cpp/deviations/CodeIdentifierDeviation.qll‎

Lines changed: 24 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -295,11 +295,11 @@ newtype TCodeIndentifierDeviation =
295295
}or
296296
TMultiLineDeviation(
297297
DeviationRecordrecord,DeviationBeginbeginComment,DeviationEndendComment,stringfilepath,
298-
intsuppressedStartLine,intsuppressedEndLine
298+
intsuppressedStartLine,intsuppressedEndLine,intsuppressedEndColumn
299299
){
300300
isDeviationRangePaired(record,beginComment,endComment)and
301301
beginComment.getLocation().hasLocationInfo(filepath,suppressedStartLine, _, _, _)and
302-
endComment.getLocation().hasLocationInfo(filepath,suppressedEndLine, _,_, _)
302+
endComment.getLocation().hasLocationInfo(filepath,_, _,suppressedEndLine,suppressedEndColumn)
303303
}or
304304
TCodeIdentifierDeviation(DeviationRecordrecord,DeviationAttributeattribute){
305305
attribute.getADeviationRecord()=record
@@ -310,7 +310,7 @@ class CodeIdentifierDeviation extends TCodeIndentifierDeviation {
310310
DeviationRecordgetADeviationRecord(){
311311
this=TSingleLineDeviation(result, _, _, _)
312312
or
313-
this=TMultiLineDeviation(result, _, _, _, _, _)
313+
this=TMultiLineDeviation(result, _, _, _, _, _, _)
314314
or
315315
this=TCodeIdentifierDeviation(result, _)
316316
}
@@ -321,18 +321,27 @@ class CodeIdentifierDeviation extends TCodeIndentifierDeviation {
321321
bindingset[e]
322322
pragma[inline_late]
323323
predicateisElementMatching(Elemente){
324-
exists(stringfilepath,intelementLocationStart|
325-
e.getLocation().hasLocationInfo(filepath,elementLocationStart, _, _, _)
324+
exists(stringfilepath,intelementLocationStart,intelementLocationColumnStart|
325+
e.getLocation()
326+
.hasLocationInfo(filepath,elementLocationStart,elementLocationColumnStart, _, _)
326327
|
327328
exists(intsuppressedLine|
328329
this=TSingleLineDeviation(_, _,filepath,suppressedLine)and
329330
suppressedLine=elementLocationStart
330331
)
331332
or
332-
exists(intsuppressedStartLine,intsuppressedEndLine|
333-
this=TMultiLineDeviation(_, _, _,filepath,suppressedStartLine,suppressedEndLine)and
334-
suppressedStartLine<elementLocationStartand
333+
exists(intsuppressedStartLine,intsuppressedEndLine,intsuppressedEndColumn|
334+
this=
335+
TMultiLineDeviation(_, _, _,filepath,suppressedStartLine,suppressedEndLine,
336+
suppressedEndColumn)and
337+
suppressedStartLine<elementLocationStart
338+
|
339+
// Element starts before the end line of the suppression
335340
suppressedEndLine>elementLocationStart
341+
or
342+
// Element exists on the same line as the suppression, and occurs before it
343+
suppressedEndLine=elementLocationStartand
344+
elementLocationColumnStart<suppressedEndColumn
336345
)
337346
)
338347
or
@@ -362,9 +371,8 @@ class CodeIdentifierDeviation extends TCodeIndentifierDeviation {
362371
endcolumn=getLastColumnNumber(filepath,suppressedLine)
363372
)
364373
or
365-
this=TMultiLineDeviation(_, _, _,filepath,suppressedLine,endline)and
366-
suppressedColumn=1and
367-
endcolumn=1
374+
this=TMultiLineDeviation(_, _, _,filepath,suppressedLine,endline,endcolumn)and
375+
suppressedColumn=1
368376
or
369377
exists(DeviationAttributeattribute|
370378
this=TCodeIdentifierDeviation(_,attribute)and
@@ -384,11 +392,13 @@ class CodeIdentifierDeviation extends TCodeIndentifierDeviation {
384392
suppressedLine
385393
)
386394
or
387-
exists(intsuppressedStartLine,intsuppressedEndLine|
388-
this=TMultiLineDeviation(_, _, _,filepath,suppressedStartLine,suppressedEndLine)and
395+
exists(intsuppressedStartLine,intsuppressedEndLine,intsuppressedEndColumn|
396+
this=
397+
TMultiLineDeviation(_, _, _,filepath,suppressedStartLine,suppressedEndLine,
398+
suppressedEndColumn)and
389399
result=
390400
"Deviation of "+getADeviationRecord().getQuery()+" applied to "+filepath+" Line "+
391-
suppressedStartLine+":"+suppressedEndLine
401+
suppressedStartLine+":"+suppressedEndLine+" (Column "+suppressedEndColumn+")"
392402
)
393403
)
394404
or

‎cpp/common/test/deviations/deviations_report_deviated/DeviationsSuppression.expected‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
| file://:0:0:0:0 | (no string representation) | // lgtm[cpp/autosar/type-long-double-used] | lgtm[cpp/autosar/type-long-double-used] | main.cpp:12:1:12:58 | Deviation of cpp/autosar/type-long-double-used applied to main.cpp Line 12 |
22
| file://:0:0:0:0 | (no string representation) | // lgtm[cpp/autosar/type-long-double-used] | lgtm[cpp/autosar/type-long-double-used] | main.cpp:14:1:14:65 | Deviation of cpp/autosar/type-long-double-used applied to main.cpp Line 14 |
33
| file://:0:0:0:0 | (no string representation) | // lgtm[cpp/autosar/type-long-double-used] | lgtm[cpp/autosar/type-long-double-used] | main.cpp:18:1:18:40 | Deviation of cpp/autosar/type-long-double-used applied to main.cpp Line 18 |
4-
| file://:0:0:0:0 | (no string representation) | // lgtm[cpp/autosar/type-long-double-used] | lgtm[cpp/autosar/type-long-double-used] | main.cpp:21:1:27:1 | Deviation of cpp/autosar/type-long-double-used applied to main.cpp Line 21:27 |
5-
| file://:0:0:0:0 | (no string representation) | // lgtm[cpp/autosar/type-long-double-used] | lgtm[cpp/autosar/type-long-double-used] | main.cpp:29:1:35:1 | Deviation of cpp/autosar/type-long-double-used applied to main.cpp Line 29:35 |
4+
| file://:0:0:0:0 | (no string representation) | // lgtm[cpp/autosar/type-long-double-used] | lgtm[cpp/autosar/type-long-double-used] | main.cpp:21:1:27:53 | Deviation of cpp/autosar/type-long-double-used applied to main.cpp Line 21:27 (Column 53) |
5+
| file://:0:0:0:0 | (no string representation) | // lgtm[cpp/autosar/type-long-double-used] | lgtm[cpp/autosar/type-long-double-used] | main.cpp:29:1:35:53 | Deviation of cpp/autosar/type-long-double-used applied to main.cpp Line 29:35 (Column 53) |
66
| file://:0:0:0:0 | (no string representation) | // lgtm[cpp/autosar/unused-return-value] | lgtm[cpp/autosar/unused-return-value] | nested/nested2/test2.h:1:1:6:1 | Deviation of cpp/autosar/unused-return-value for nested/nested2/test2.h. |
77
| file://:0:0:0:0 | (no string representation) | // lgtm[cpp/autosar/useless-assignment] | lgtm[cpp/autosar/useless-assignment] | coding-standards.xml:1:1:17:19 | Deviation of cpp/autosar/useless-assignment for coding-standards.xml. |
88
| file://:0:0:0:0 | (no string representation) | // lgtm[cpp/autosar/useless-assignment] | lgtm[cpp/autosar/useless-assignment] | main.cpp:1:1:39:1 | Deviation of cpp/autosar/useless-assignment for main.cpp. |

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp