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 {
3232 )
3333 )
3434 }
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+ }
3554}
Original file line number Diff line number Diff line change 11/**
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.
44 * @kind diagnostic
55 * @id swift/diagnostics/successfully-extracted-files
66 * @tags successfully-extracted-files
99import swift
1010
1111from File f
12- where f . isSuccessfullyExtracted ( )
12+ where exists ( f . getRelativePath ( ) )
1313select 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. |
12| main.swift:0:0:0:0 | main.swift | File successfully extracted. |
You can’t perform that action at this time.
0 commit comments