File tree Expand file tree Collapse file tree 3 files changed +23
-3
lines changed
lib/codeql/swift/elements
test/query-tests/Diagnostics Expand file tree Collapse file tree 3 files changed +23
-3
lines changed Original file line number Diff line number Diff line change @@ -32,4 +32,23 @@ class File extends Generated::File {
32
32
)
33
33
)
34
34
}
35
+
36
+ /**
37
+ * Gets the relative path of this file from the root folder of the
38
+ * analyzed source location. The relative path of the root folder itself
39
+ * would be the empty string.
40
+ *
41
+ * This has no result if the file is outside the source root, that is,
42
+ * if the root folder is not a reflexive, transitive parent of this file.
43
+ */
44
+ string getRelativePath ( ) {
45
+ exists ( string absPath , string pref |
46
+ absPath = this .getAbsolutePath ( ) and sourceLocationPrefix ( pref )
47
+ |
48
+ absPath = pref and result = ""
49
+ or
50
+ absPath = pref .regexpReplaceAll ( "/$" , "" ) + "/" + result and
51
+ not result .matches ( "/%" )
52
+ )
53
+ }
35
54
}
Original file line number Diff line number Diff line change 1
1
/**
2
- * @name Successfully extracted files
3
- * @description Lists all files in the source code directory that were extracted without encountering a problem in the file .
2
+ * @name Extracted files
3
+ * @description Lists all files in the source code directory that were extracted.
4
4
* @kind diagnostic
5
5
* @id swift/diagnostics/successfully-extracted-files
6
6
* @tags successfully-extracted-files
9
9
import swift
10
10
11
11
from File f
12
- where f . isSuccessfullyExtracted ( )
12
+ where exists ( f . getRelativePath ( ) )
13
13
select f , "File successfully extracted."
Original file line number Diff line number Diff line change
1
+ | error.swift:0:0:0:0 | error.swift | File successfully extracted. |
1
2
| main.swift:0:0:0:0 | main.swift | File successfully extracted. |
You can’t perform that action at this time.
0 commit comments