mirror of
https://github.com/github/codeql.git
synced 2026-04-28 10:15:14 +02:00
Rust: support paths and paths-ignore from the code scanning configuration file
This is done by simply adding the autobuilder from the shared tree-sitter extractor library.
This commit is contained in:
7
rust/ql/integration-tests/file-exclusions/Cargo.lock
generated
Normal file
7
rust/ql/integration-tests/file-exclusions/Cargo.lock
generated
Normal file
@@ -0,0 +1,7 @@
|
||||
# This file is automatically @generated by Cargo.
|
||||
# It is not intended for manual editing.
|
||||
version = 3
|
||||
|
||||
[[package]]
|
||||
name = "file_exclusion"
|
||||
version = "0.1.0"
|
||||
7
rust/ql/integration-tests/file-exclusions/Cargo.toml
Normal file
7
rust/ql/integration-tests/file-exclusions/Cargo.toml
Normal file
@@ -0,0 +1,7 @@
|
||||
[workspace]
|
||||
[package]
|
||||
name = "file_exclusion"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
|
||||
[dependencies]
|
||||
@@ -0,0 +1,2 @@
|
||||
paths-ignore:
|
||||
- '/src/maybe_ignore'
|
||||
@@ -0,0 +1,3 @@
|
||||
src/lib.rs
|
||||
src/maybe_ignore/a_source.rs
|
||||
src/maybe_ignore/mod.rs
|
||||
@@ -0,0 +1 @@
|
||||
src/lib.rs
|
||||
16
rust/ql/integration-tests/file-exclusions/src/lib.rs
Normal file
16
rust/ql/integration-tests/file-exclusions/src/lib.rs
Normal file
@@ -0,0 +1,16 @@
|
||||
mod maybe_ignore;
|
||||
|
||||
pub fn add(left: u64, right: u64) -> u64 {
|
||||
left + right
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn it_works() {
|
||||
let result = add(2, 2);
|
||||
assert_eq!(result, 4);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
mod a_source;
|
||||
@@ -0,0 +1,12 @@
|
||||
import pathlib
|
||||
|
||||
|
||||
def test_default(codeql, rust, check_source_archive):
|
||||
check_source_archive.expected_suffix = ".default.expected"
|
||||
pathlib.Path("_git").rename(".git")
|
||||
codeql.database.create()
|
||||
|
||||
def test_with_config(codeql, rust, check_source_archive):
|
||||
check_source_archive.expected_suffix = ".with_config.expected"
|
||||
pathlib.Path("_git").rename(".git")
|
||||
codeql.database.create(codescanning_config="codeql-config.yml")
|
||||
@@ -0,0 +1,7 @@
|
||||
use file_exclusion::add;
|
||||
|
||||
#[test]
|
||||
fn integration_works() {
|
||||
let result = add(2, 2);
|
||||
assert_eq!(result, 4);
|
||||
}
|
||||
Reference in New Issue
Block a user