Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 15 additions & 12 deletions cpp/common/src/codingstandards/cpp/deviations/Deviations.qll
Original file line number Diff line number Diff line change
Expand Up @@ -363,27 +363,30 @@ class DeviationRecord extends XmlElement {
result.getRelativePath() = getAChild("paths").getAChild("paths-entry").getTextValue()
}

private string getADeviationPath0() {
if exists(getPathAContainer())
then
// Use the path, which will be relative to this file, if specified
result = getPathAContainer().getRelativePath()
else (
// Otherwise, if no code identifier was supplied, it applies to the parent container of the
// file itself
not exists(getCodeIdentifier()) and
result = this.getFile().getParentContainer().getRelativePath()
)
}

/** Gets a path to which this deviation applies. */
string getADeviationPath() {
exists(string res |
if exists(getPathAContainer())
then
// Use the path, which will be relative to this file, if specified
res = getPathAContainer().getRelativePath()
else (
// Otherwise, if no code identifier was supplied, it applies to the parent container of the
// file itself
not exists(getCodeIdentifier()) and
res = this.getFile().getParentContainer().getRelativePath()
)
|
res = getADeviationPath0() and
if res = "" then result = "(root)" else result = res
)
}

cached
predicate isDeviated(Query query, string deviationPath) {
query = getQuery() and
deviationPath = getADeviationPath()
deviationPath = getADeviationPath0()
}
}
Loading