Repository navigation
Rust: Remove unused extractor command-line options - #23054
Conversation
e4f2b2b to
2430806
Compare
3a15812 to
8898397
Compare
There was a problem hiding this comment.
🔵 Needs a closer look
The change modifies public CLI/configuration precedence, removes a proc-macro, and regenerates shared Cargo/Bazel dependencies, requiring toolchain validation of runtime behavior, external invocations, and supported targets.
No open issues 🎉
What changed in this PR
This PR simplifies the Rust extractor configuration by replacing macro-generated command-line handling with an explicit CLI supporting only the three required options, while removing the obsolete proc-macro crate and unused dependency metadata.
Changes:
- Adds explicit support for
--file-list,--qltest, and--logging-verbosity. - Preserves environment and YAML deserialization for the remaining configuration fields.
- Removes obsolete Cargo and Bazel dependencies and regenerates workspace metadata.
| File | Description |
|---|---|
| rust/extractor/src/config.rs | Defines the explicit three-option CLI and retains environment and YAML configuration handling. |
| rust/extractor/macros/src/lib.rs | Removes the obsolete extractor configuration proc macro. |
| rust/extractor/macros/Cargo.toml | Removes the deleted proc-macro crate manifest. |
| rust/extractor/macros/BUILD.bazel | Removes Bazel targets for the deleted proc-macro crate. |
| rust/extractor/Cargo.toml | Removes the macro and unused serde_with dependencies. |
| rust/extractor/BUILD.bazel | Removes the extractor dependency on the deleted proc-macro crate. |
| MODULE.bazel | Removes the unused serde_with 3.24.0 repository. |
| misc/bazel/3rdparty/rust_workspace_deps/serde_with/BUILD.bazel | Updates the generated serde_with alias to the remaining version. |
| misc/bazel/3rdparty/rust_workspace_deps/crates.bzl | Regenerates workspace dependency and repository metadata. |
| misc/bazel/3rdparty/rust_workspace_deps/BUILD.tinyvec-1.13.3.bazel | Removes an unused generated transitive dependency target. |
| misc/bazel/3rdparty/rust_workspace_deps/BUILD.serde_with-3.24.0.bazel | Removes the obsolete serde_with 3.24.0 target. |
| misc/bazel/3rdparty/rust_workspace_deps/BUILD.serde_with_macros-3.24.0.bazel | Removes the obsolete serde_with macro dependency target. |
| misc/bazel/3rdparty/rust_workspace_deps/BUILD.schemars-1.2.2.bazel | Removes an unused generated transitive dependency target. |
| misc/bazel/3rdparty/rust_workspace_deps/BUILD.schemars-0.9.0.bazel | Removes an unused generated transitive dependency target. |
| misc/bazel/3rdparty/rust_workspace_deps/BUILD.ref-cast-impl-1.0.26.bazel | Removes an unused generated proc-macro dependency target. |
| misc/bazel/3rdparty/rust_workspace_deps/BUILD.ref-cast-1.0.26.bazel | Removes an unused generated dependency target. |
| misc/bazel/3rdparty/rust_workspace_deps/BUILD.portable-atomic-util-0.2.7.bazel | Removes an unused generated platform dependency target. |
| misc/bazel/3rdparty/rust_workspace_deps/BUILD.jiff-tzdb-platform-0.1.3.bazel | Removes an unused generated timezone dependency target. |
| misc/bazel/3rdparty/rust_workspace_deps/BUILD.jiff-tzdb-0.1.8.bazel | Removes an unused generated timezone data target. |
| misc/bazel/3rdparty/rust_workspace_deps/BUILD.jiff-static-0.2.37.bazel | Removes an unused generated dependency target. |
| misc/bazel/3rdparty/rust_workspace_deps/BUILD.jiff-core-0.1.1.bazel | Removes an unused generated Jiff core target. |
| misc/bazel/3rdparty/rust_workspace_deps/BUILD.jiff-0.2.37.bazel | Removes an unused generated Jiff dependency target. |
| misc/bazel/3rdparty/rust_workspace_deps/BUILD.indexmap-1.9.3.bazel | Removes an unused generated IndexMap dependency target. |
| misc/bazel/3rdparty/rust_workspace_deps/BUILD.hex-0.4.3.bazel | Removes an unused generated hexadecimal dependency target. |
| misc/bazel/3rdparty/rust_workspace_deps/BUILD.hashbrown-0.12.3.bazel | Removes an unused generated hash map dependency target. |
| misc/bazel/3rdparty/rust_workspace_deps/BUILD.dyn-clone-1.0.20.bazel | Removes an unused generated cloning dependency target. |
| misc/bazel/3rdparty/rust_workspace_deps/BUILD.defmt-parser-1.0.0.bazel | Removes an unused generated logging dependency target. |
| misc/bazel/3rdparty/rust_workspace_deps/BUILD.defmt-macros-1.1.1.bazel | Removes an unused generated logging proc-macro target. |
| misc/bazel/3rdparty/rust_workspace_deps/BUILD.defmt-1.1.1.bazel | Removes an unused generated logging dependency target. |
| misc/bazel/3rdparty/rust_workspace_deps/BUILD.darling-0.24.1.bazel | Removes an unused generated macro-support dependency target. |
| misc/bazel/3rdparty/rust_workspace_deps/BUILD.darling_macro-0.24.1.bazel | Removes an unused generated proc-macro support target. |
| misc/bazel/3rdparty/rust_workspace_deps/BUILD.darling_core-0.24.1.bazel | Removes an unused generated macro-support dependency target. |
| misc/bazel/3rdparty/rust_workspace_deps/BUILD.bs58-0.5.1.bazel | Removes an unused generated encoding dependency target. |
| misc/bazel/3rdparty/rust_workspace_deps/BUILD.bitflags-1.3.2.bazel | Removes an unused generated dependency target. |
| misc/bazel/3rdparty/rust_workspace_deps/BUILD.bazel | Updates the shared generated serde_with alias. |
| misc/bazel/3rdparty/rust_workspace_deps/BUILD.base64-0.23.1.bazel | Removes an unused generated encoding dependency target. |
| Cargo.toml | Removes the deleted macro crate from workspace members. |
| Cargo.lock | Regenerates the lockfile without the removed macro and transitive dependencies. |
Review effort: Lite (adaptive)
Replace the generated CLI configuration with explicit support for the few command-line options that we actually use. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 03abd0ed-3880-4e39-8713-990a317c96e6
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 03abd0ed-3880-4e39-8713-990a317c96e6
8898397 to
68a6be1
Compare
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: ce644875-3cc2-416e-9cb2-0dc884ee9490
|
What does this mean for the options specified in https://github.com/github/codeql/blob/main/rust/codeql-extractor.yml? Don't we want the escape hatch of being able to pass them on the command line? |
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Good question. The CLI passes options as environment variables, so options set through the CLI are unaffected. To pass options on the command line one would now have to set an env var for the command instead of passing them as arguments. That's a small difference and that approach will work generally for all extractors. |
Currently the Rust extractor supports passing all the environment variables that it supports as command line arguments. However, we don't make use of this capability, none of the other Rust extractors have, and it relies on a macro that makes things more complicated to understand.
This PR changes the extractor to only support the three command-line arguments that we make use of. This simplifies things and paves the way for further alignment with the other extractors.
Walkthrough of the changes
extractor_cli_configis deleted. This macro was applied toConfigand produced aCliConfigstruct where every field onConfiggot turned into a command line argument.CliConfigis added, this accounts for the command line arguments that we do in fact use.rust-extractor-macroscrate.