-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rust: reinstate extraction of test code
Users will still be able to opt out: * for unit tests, by providing the `cargo_cfg_overrides=-test` extractor option * for integration tests, by excluding the test files from the analysis using `paths-ignore` in the codescanning configuration file We may want to revisit whether we want a single option for both. Also further work will be needed to restrict our security queries to non-test code on the QL side.
- Loading branch information
Paolo Tranquilli
committed
Dec 20, 2024
1 parent
90d8fb1
commit 485586f
Showing
8 changed files
with
46 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,13 @@ | ||
use std::path::PathBuf; | ||
use codeql_extractor::autobuilder; | ||
use std::path::PathBuf; | ||
|
||
fn main() -> std::io::Result<()> { | ||
let database = std::env::var("CODEQL_EXTRACTOR_RUST_WIP_DATABASE") | ||
.expect("CODEQL_EXTRACTOR_RUST_WIP_DATABASE not set"); | ||
|
||
autobuilder::Autobuilder::new("rust", PathBuf::from(database)) | ||
.include_extensions(&[".rs"]) | ||
.exclude_globs(&["**/.git", "**/tests/**"]) | ||
.exclude_globs(&["**/.git"]) | ||
.size_limit("5m") | ||
.run() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
paths-ignore: | ||
- '/src/maybe_ignore' | ||
- '**/tests' |
1 change: 1 addition & 0 deletions
1
rust/ql/integration-tests/file-exclusions/source_archive.default.expected
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
src/lib.rs | ||
src/maybe_ignore/a_source.rs | ||
src/maybe_ignore/mod.rs | ||
tests/integration.rs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
| src/lib.rs:7:1:8:19 | fn cfg_no_flag | | ||
| src/lib.rs:10:1:11:18 | fn cfg_no_key | | ||
| src/lib.rs:16:1:17:24 | fn pointer_width_64 | | ||
| src/lib.rs:15:5:16:16 | fn test | | ||
| src/lib.rs:19:1:20:24 | fn pointer_width_64 | |
3 changes: 1 addition & 2 deletions
3
rust/ql/integration-tests/options/cfg/functions.override.expected
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
| src/lib.rs:1:1:2:16 | fn cfg_flag | | ||
| src/lib.rs:4:1:5:15 | fn cfg_key | | ||
| src/lib.rs:13:1:14:12 | fn test | | ||
| src/lib.rs:19:1:20:24 | fn pointer_width_32 | | ||
| src/lib.rs:22:1:23:24 | fn pointer_width_32 | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters