Skip to content

Commit 9e35e59

Browse files
committed
Deviations: use getADeviationRecord
Deviation code identifier markers can have multiple records.
1 parent 20669c7 commit 9e35e59

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

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

+6-6
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ class DeviationAttribute extends StdAttribute {
224224
"\"" + record.getCodeIdentifier() + "\"" = this.getAnArgument().getValueText()
225225
}
226226

227-
DeviationRecord getDeviationRecord() { result = record }
227+
DeviationRecord getADeviationRecord() { result = record }
228228

229229
pragma[nomagic]
230230
Element getASuppressedElement() {
@@ -296,12 +296,12 @@ newtype TCodeIndentifierDeviation =
296296
endComment.getLocation().hasLocationInfo(filepath, suppressedEndLine, _, _, _)
297297
} or
298298
TCodeIdentifierDeviation(DeviationRecord record, DeviationAttribute attribute) {
299-
attribute.getDeviationRecord() = record
299+
attribute.getADeviationRecord() = record
300300
}
301301

302302
class CodeIdentifierDeviation extends TCodeIndentifierDeviation {
303303
/** The deviation record associated with the deviation comment. */
304-
DeviationRecord getDeviationRecord() {
304+
DeviationRecord getADeviationRecord() {
305305
this = TSingleLineDeviation(result, _, _, _)
306306
or
307307
this = TMultiLineDeviation(result, _, _, _, _, _)
@@ -341,21 +341,21 @@ class CodeIdentifierDeviation extends TCodeIndentifierDeviation {
341341
exists(int suppressedLine |
342342
this = TSingleLineDeviation(_, _, filepath, suppressedLine) and
343343
result =
344-
"Deviation record " + getDeviationRecord() + " applied to " + filepath + " Line " +
344+
"Deviation record " + getADeviationRecord() + " applied to " + filepath + " Line " +
345345
suppressedLine
346346
)
347347
or
348348
exists(int suppressedStartLine, int suppressedEndLine |
349349
this = TMultiLineDeviation(_, _, _, filepath, suppressedStartLine, suppressedEndLine) and
350350
result =
351-
"Deviation record " + getDeviationRecord() + " applied to " + filepath + " Line" +
351+
"Deviation record " + getADeviationRecord() + " applied to " + filepath + " Line" +
352352
suppressedStartLine + ":" + suppressedEndLine
353353
)
354354
)
355355
or
356356
exists(DeviationAttribute attribute |
357357
this = TCodeIdentifierDeviation(_, attribute) and
358-
result = "Deviation record " + getDeviationRecord() + " applied to " + attribute
358+
result = "Deviation record " + getADeviationRecord() + " applied to " + attribute
359359
)
360360
}
361361
}

cpp/common/src/codingstandards/cpp/deviations/Deviations.qll

+1-1
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ class DeviationRecord extends XmlElement {
221221
}
222222

223223
/** Gets a code identifier deviation in code which starts or ends with the code identifier comment. */
224-
CodeIdentifierDeviation getACodeIdentifierDeviation() { this = result.getDeviationRecord() }
224+
CodeIdentifierDeviation getACodeIdentifierDeviation() { this = result.getADeviationRecord() }
225225

226226
/** Gets the `rule-id` specified for this record, if any. */
227227
private string getRawRuleId() { result = getAChild("rule-id").getTextValue() }

0 commit comments

Comments
 (0)