Skip to content

Commit 52b76b1

Browse files
authored
Merge pull request github#3233 from RasmusWL/python-use-getAbsolutePath
Approved by BekaValentine
2 parents 2e95cab + 32c04ad commit 52b76b1

File tree

4 files changed

+5
-5
lines changed

4 files changed

+5
-5
lines changed

python/ql/src/external/CodeDuplication.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ class Copy extends @duplication_or_similarity {
6666
predicate hasLocationInfo(
6767
string filepath, int startline, int startcolumn, int endline, int endcolumn
6868
) {
69-
sourceFile().getName() = filepath and
69+
sourceFile().getAbsolutePath() = filepath and
7070
startline = sourceStartLine() and
7171
startcolumn = sourceStartColumn() and
7272
endline = sourceEndLine() and

python/ql/src/external/DefectFilter.qll

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class DefectResult extends int {
2626

2727
/** Gets the file in which this query result was reported. */
2828
File getFile() {
29-
exists(string path | defectResults(this, _, path, _, _, _, _, _) and result.getName() = path)
29+
exists(string path | defectResults(this, _, path, _, _, _, _, _) and result.getAbsolutePath() = path)
3030
}
3131

3232
/** Gets the file path in which this query result was reported. */
@@ -54,7 +54,7 @@ class DefectResult extends int {
5454
/** Gets the URL corresponding to the ___location of this query result. */
5555
string getURL() {
5656
result =
57-
"file://" + getFile().getName() + ":" + getStartLine() + ":" + getStartColumn() + ":" +
57+
"file://" + getFile().getAbsolutePath() + ":" + getStartLine() + ":" + getStartColumn() + ":" +
5858
getEndLine() + ":" + getEndColumn()
5959
}
6060
}

python/ql/src/external/VCS.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ class Commit extends @svnentry {
2323
string getMessage() { svnentrymsg(this, result) }
2424

2525
string getAnAffectedFilePath(string action) {
26-
exists(File rawFile | svnaffectedfiles(this, rawFile, action) | result = rawFile.getName())
26+
exists(File rawFile | svnaffectedfiles(this, rawFile, action) | result = rawFile.getAbsolutePath())
2727
}
2828

2929
string getAnAffectedFilePath() { result = getAnAffectedFilePath(_) }

python/ql/src/semmle/python/filters/GeneratedCode.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ string from_mako_import(Module m) {
170170
/** File generated by Google's protobuf tool. */
171171
class ProtobufGeneratedFile extends SpecificGeneratedFile {
172172
ProtobufGeneratedFile() {
173-
this.getName().regexpMatch(".*_pb2?.py") and
173+
this.getAbsolutePath().regexpMatch(".*_pb2?.py") and
174174
exists(Module m | m.getFile() = this |
175175
exists(ImportExpr imp | imp.getEnclosingModule() = m |
176176
imp.getImportedModuleName() = "google.net.proto2.python.public"

0 commit comments

Comments
 (0)