|
7 | 7 |
|
8 | 8 | import cpp |
9 | 9 | import Deviations |
10 | | - |
11 | | -/** Holds if `lineNumber` is an indexed line number in file `f`. */ |
12 | | -private predicate isLineNumber(File f, int lineNumber) { |
13 | | - exists(Location l | l.getFile() = f | |
14 | | - l.getStartLine() = lineNumber |
15 | | - or |
16 | | - l.getEndLine() = lineNumber |
17 | | - ) |
18 | | -} |
19 | | - |
20 | | -/** Gets the last line number in `f`. */ |
21 | | -private int getLastLineNumber(File f) { result = max(int lineNumber | isLineNumber(f, lineNumber)) } |
22 | | - |
23 | | -/** Gets the last column number on the last line of `f`. */ |
24 | | -int getLastColumnNumber(File f) { |
25 | | - result = |
26 | | - max(Location l | |
27 | | - l.getFile() = f and |
28 | | - l.getEndLine() = getLastLineNumber(f) |
29 | | - | |
30 | | - l.getEndColumn() |
31 | | - ) |
32 | | -} |
| 10 | +import codingstandards.cpp.Locations |
33 | 11 |
|
34 | 12 | newtype TDeviationScope = |
35 | 13 | TDeviationRecordFileScope(DeviationRecord dr, File file) { |
@@ -71,10 +49,9 @@ class DeviationRecordFileScope extends DeviationScope, TDeviationRecordFileScope |
71 | 49 | string filepath, int startline, int startcolumn, int endline, int endcolumn |
72 | 50 | ) { |
73 | 51 | // In an ideal world, we would produce a URL here that informed the AlertSuppression code that |
74 | | - // the whole file was suppressed. However, experimentation suggestions the alert suppression |
75 | | - // code only works with locations with lines and columns, so we generate a location that covers |
76 | | - // the whole "indexed" file, by finding the location indexed in the database with the latest |
77 | | - // line and column number. |
| 52 | + // the whole file was suppressed. However, the alert suppression code only works with locations |
| 53 | + // with lines and columns, so we generate a location that covers the whole "indexed" file, by |
| 54 | + // finding the location indexed in the database with the latest line and column number. |
78 | 55 | exists(File f | f = getFile() | |
79 | 56 | f.getLocation().hasLocationInfo(filepath, _, _, _, _) and |
80 | 57 | startline = 1 and |
|
0 commit comments