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

Appearance settings

Commit 126ed55

Browse filesBrowse files
committed
Add getLastColumnNumber to shared library
1 parent 184e5d3 commit 126ed55
Copy full SHA for 126ed55

File tree

2 files changed

+8
-7
lines changed
Filter options

2 files changed

+8
-7
lines changed

‎cpp/common/src/codingstandards/cpp/Locations.qll

Copy file name to clipboardExpand all lines: cpp/common/src/codingstandards/cpp/Locations.qll
+6Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,9 @@ int getLastColumnNumber(File f) {
2222
l.getEndColumn()
2323
)
2424
}
25+
26+
/** Gets the last column number on the given line of `filepath`. */
27+
bindingset[filepath, lineNumber]
28+
int getLastColumnNumber(string filepath, int lineNumber) {
29+
result = max(Location l | l.hasLocationInfo(filepath, _, _, lineNumber, _) | l.getEndColumn())
30+
}

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

Copy file name to clipboardExpand all lines: cpp/common/src/codingstandards/cpp/deviations/CodeIdentifierDeviation.qll
+2-7Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232

3333
import cpp
3434
import Deviations
35+
import codingstandards.cpp.Locations
3536

3637
string supportedStandard() { result = ["misra", "autosar", "cert"] }
3738

@@ -358,13 +359,7 @@ class CodeIdentifierDeviation extends TCodeIndentifierDeviation {
358359
then endcolumn = commentMarker.(DeviationEndOfLineMarker).getLocation().getEndColumn()
359360
else
360361
// Find the last column for a location on the next line
361-
endcolumn =
362-
max(Location l |
363-
l.hasLocationInfo(filepath, _, _, _, _) and
364-
l.getEndLine() = suppressedLine
365-
|
366-
l.getEndColumn()
367-
)
362+
endcolumn = getLastColumnNumber(filepath, suppressedLine)
368363
)
369364
or
370365
this = TMultiLineDeviation(_, _, _, filepath, suppressedLine, endline) and

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.