mirror of
https://github.com/github/codeql.git
synced 2025-12-17 01:03:14 +01:00
Rust: adjust integration tests and expected output
This commit is contained in:
@@ -30,7 +30,7 @@
|
||||
"pretty": "__REDACTED__"
|
||||
}
|
||||
},
|
||||
"numberOfFiles": 5,
|
||||
"numberOfFiles": 6,
|
||||
"numberOfManifests": 1
|
||||
},
|
||||
"severity": "note",
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
| Cargo.toml:0:0:0:0 | LoadManifest(Cargo.toml) |
|
||||
| file:///types.rs:0:0:0:0 | Extract(/types.rs) |
|
||||
| file:///types.rs:0:0:0:0 | Parse(/types.rs) |
|
||||
| file://:0:0:0:0 | CrateGraph |
|
||||
| file://:0:0:0:0 | FindManifests |
|
||||
| src/directory_module/mod.rs:0:0:0:0 | Extract(src/directory_module/mod.rs) |
|
||||
|
||||
@@ -1,4 +1,27 @@
|
||||
import codeql.rust.elements.internal.ExtractorStep
|
||||
|
||||
from ExtractorStep step
|
||||
private class Step instanceof ExtractorStep {
|
||||
string toString() {
|
||||
result = super.getAction() + "(" + this.getFilePath() + ")"
|
||||
or
|
||||
not super.hasFile() and result = super.getAction()
|
||||
}
|
||||
|
||||
private string getFilePath() {
|
||||
exists(File file | file = super.getFile() |
|
||||
exists(file.getRelativePath()) and result = file.getAbsolutePath()
|
||||
or
|
||||
not exists(file.getRelativePath()) and result = "/" + file.getBaseName()
|
||||
)
|
||||
}
|
||||
|
||||
predicate hasLocationInfo(
|
||||
string filepath, int startline, int startcolumn, int endline, int endcolumn
|
||||
) {
|
||||
super.hasLocationInfo(_, startline, startcolumn, endline, endcolumn) and
|
||||
filepath = this.getFilePath()
|
||||
}
|
||||
}
|
||||
|
||||
from Step step
|
||||
select step
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
| file:///types.rs:0:0:0:0 | Extract(/types.rs) |
|
||||
| file:///types.rs:0:0:0:0 | Parse(/types.rs) |
|
||||
| file://:0:0:0:0 | CrateGraph |
|
||||
| file://:0:0:0:0 | FindManifests |
|
||||
| rust-project.json:0:0:0:0 | LoadManifest(rust-project.json) |
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
| Inconsistencies - Path resolution | 0 |
|
||||
| Inconsistencies - SSA | 0 |
|
||||
| Inconsistencies - data flow | 0 |
|
||||
| Lines of code extracted | 6 |
|
||||
| Lines of code extracted | 23 |
|
||||
| Lines of user code extracted | 6 |
|
||||
| Macro calls - resolved | 2 |
|
||||
| Macro calls - total | 2 |
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
"pretty": "__REDACTED__"
|
||||
}
|
||||
},
|
||||
"numberOfFiles": 4,
|
||||
"numberOfFiles": 5,
|
||||
"numberOfManifests": 1
|
||||
},
|
||||
"severity": "note",
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
"pretty": "__REDACTED__"
|
||||
}
|
||||
},
|
||||
"numberOfFiles": 4,
|
||||
"numberOfFiles": 5,
|
||||
"numberOfManifests": 1
|
||||
},
|
||||
"severity": "note",
|
||||
|
||||
@@ -5,6 +5,8 @@
|
||||
| exe/src/main.rs:0:0:0:0 | Extract(exe/src/main.rs) |
|
||||
| exe/src/main.rs:0:0:0:0 | LoadSource(exe/src/main.rs) |
|
||||
| exe/src/main.rs:0:0:0:0 | Parse(exe/src/main.rs) |
|
||||
| file:///types.rs:0:0:0:0 | Extract(/types.rs) |
|
||||
| file:///types.rs:0:0:0:0 | Parse(/types.rs) |
|
||||
| file://:0:0:0:0 | CrateGraph |
|
||||
| file://:0:0:0:0 | FindManifests |
|
||||
| lib/src/a_module/mod.rs:0:0:0:0 | Extract(lib/src/a_module/mod.rs) |
|
||||
|
||||
@@ -1,4 +1,27 @@
|
||||
import codeql.rust.elements.internal.ExtractorStep
|
||||
|
||||
from ExtractorStep step
|
||||
private class Step instanceof ExtractorStep {
|
||||
string toString() {
|
||||
result = super.getAction() + "(" + this.getFilePath() + ")"
|
||||
or
|
||||
not super.hasFile() and result = super.getAction()
|
||||
}
|
||||
|
||||
private string getFilePath() {
|
||||
exists(File file | file = super.getFile() |
|
||||
exists(file.getRelativePath()) and result = file.getAbsolutePath()
|
||||
or
|
||||
not exists(file.getRelativePath()) and result = "/" + file.getBaseName()
|
||||
)
|
||||
}
|
||||
|
||||
predicate hasLocationInfo(
|
||||
string filepath, int startline, int startcolumn, int endline, int endcolumn
|
||||
) {
|
||||
super.hasLocationInfo(_, startline, startcolumn, endline, endcolumn) and
|
||||
filepath = this.getFilePath()
|
||||
}
|
||||
}
|
||||
|
||||
from Step step
|
||||
select step
|
||||
|
||||
@@ -4,6 +4,8 @@
|
||||
| exe/src/main.rs:0:0:0:0 | Extract(exe/src/main.rs) |
|
||||
| exe/src/main.rs:0:0:0:0 | LoadSource(exe/src/main.rs) |
|
||||
| exe/src/main.rs:0:0:0:0 | Parse(exe/src/main.rs) |
|
||||
| file:///types.rs:0:0:0:0 | Extract(/types.rs) |
|
||||
| file:///types.rs:0:0:0:0 | Parse(/types.rs) |
|
||||
| file://:0:0:0:0 | CrateGraph |
|
||||
| file://:0:0:0:0 | FindManifests |
|
||||
| lib/src/a_module/mod.rs:0:0:0:0 | Extract(lib/src/a_module/mod.rs) |
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
| Inconsistencies - Path resolution | 0 |
|
||||
| Inconsistencies - SSA | 0 |
|
||||
| Inconsistencies - data flow | 0 |
|
||||
| Lines of code extracted | 9 |
|
||||
| Lines of code extracted | 26 |
|
||||
| Lines of user code extracted | 9 |
|
||||
| Macro calls - resolved | 2 |
|
||||
| Macro calls - total | 2 |
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
| Inconsistencies - Path resolution | 0 |
|
||||
| Inconsistencies - SSA | 0 |
|
||||
| Inconsistencies - data flow | 0 |
|
||||
| Lines of code extracted | 9 |
|
||||
| Lines of code extracted | 26 |
|
||||
| Lines of user code extracted | 9 |
|
||||
| Macro calls - resolved | 2 |
|
||||
| Macro calls - total | 2 |
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
| Cargo.toml:0:0:0:0 | LoadManifest(Cargo.toml) |
|
||||
| exe/src/main.rs:0:0:0:0 | Extract(exe/src/main.rs) |
|
||||
| exe/src/main.rs:0:0:0:0 | Parse(exe/src/main.rs) |
|
||||
| file:///types.rs:0:0:0:0 | Extract(/types.rs) |
|
||||
| file:///types.rs:0:0:0:0 | Parse(/types.rs) |
|
||||
| file://:0:0:0:0 | CrateGraph |
|
||||
| file://:0:0:0:0 | FindManifests |
|
||||
| lib/src/lib.rs:0:0:0:0 | Extract(lib/src/lib.rs) |
|
||||
|
||||
@@ -1,4 +1,27 @@
|
||||
import codeql.rust.elements.internal.ExtractorStep
|
||||
|
||||
from ExtractorStep step
|
||||
private class Step instanceof ExtractorStep {
|
||||
string toString() {
|
||||
result = super.getAction() + "(" + this.getFilePath() + ")"
|
||||
or
|
||||
not super.hasFile() and result = super.getAction()
|
||||
}
|
||||
|
||||
private string getFilePath() {
|
||||
exists(File file | file = super.getFile() |
|
||||
exists(file.getRelativePath()) and result = file.getAbsolutePath()
|
||||
or
|
||||
not exists(file.getRelativePath()) and result = "/" + file.getBaseName()
|
||||
)
|
||||
}
|
||||
|
||||
predicate hasLocationInfo(
|
||||
string filepath, int startline, int startcolumn, int endline, int endcolumn
|
||||
) {
|
||||
super.hasLocationInfo(_, startline, startcolumn, endline, endcolumn) and
|
||||
filepath = this.getFilePath()
|
||||
}
|
||||
}
|
||||
|
||||
from Step step
|
||||
select step
|
||||
|
||||
Reference in New Issue
Block a user