Skip to content

Rust: Remove argfile dependency and read file list manually - #22916

Open
paldepind wants to merge 2 commits into
mainfrom
rust/remove-argfile
Open

paldepind wants to merge 2 commits into
mainfrom
rust/remove-argfile

Conversation

@paldepind

@paldepind paldepind commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

The index-files.sh file in the extractors for Ruby, Ql, and Unified all pass the filename with the list of files to extract like this --file-list "$1".

However, in index-files.sh in the Rust extractor we pass it like @"$1". The @ is syntax to pass arguments by filename (I'm not sure what the origin of this notation is, but it's a somewhat well-known notation). We handle the @ by a dependency argfile.

The only thing we gain from introducing this dependency, using @ (that I was not familiar with), deviating from the other extractors, and special casing in the extractor_cli_config macro, is that we don't have to read the named file ourselves.

I don't think that's worth it, so this PR removes the argfile dependency and reads and parses the file manually (like the other extractors do). This gives closer alignment with the other extractors and less complexity. Furthermore, it turns out that, all things considered, this is in fact fewer lines of code than what we had with the dependency.

The dependency removal and generated Cargo/Bazel metadata are in the first commit. The code changes are in the second commit.

@github-actions github-actions Bot added the Rust Pull requests that update Rust code label Oct 28, 2026
@paldepind
paldepind marked this pull request as ready for review October 28, 2026 14:23
Copilot AI max review requested due to automatic review settings October 28, 2026 14:23
@paldepind
paldepind requested review from a team as code owners October 28, 2026 14:23

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

An unresolved minor finding notes that the configuration log omits the input-file count, making empty or partial extractions harder to diagnose.

1 open issue
What changed in this PR

This PR aligns the Rust extractor with other CodeQL extractors by replacing @argfile expansion with an explicit --file-list option.

Changes:

  • Update both launchers and read input paths directly from a newline-separated file.
  • Return QL test sources separately from configuration and remove input-specific macro handling.
  • Remove argfile and its unused transitive dependencies from Cargo and Bazel metadata.
File Description
rust/​tools/​index-files.sh Pass the file list through --file-list.
rust/​tools/​index-files.cmd Use --file-list in the Windows launcher.
rust/​extractor/​src/​qltest.rs Return source paths instead of mutating configuration.
rust/​extractor/​src/​main.rs Read input paths from the configured file list.
rust/​extractor/​src/​config.rs Replace positional inputs with a file-list option.
rust/​extractor/​macros/​src/​lib.rs Remove special handling for input paths.
rust/​extractor/​Cargo.toml Remove the argfile dependency.
MODULE.bazel Remove the argfile repository import.
misc/​bazel/​3rdparty/​tree_sitter_extractors_deps/​crates.bzl Remove unused dependency and repository definitions.
misc/​bazel/​3rdparty/​tree_sitter_extractors_deps/​BUILD.os_str_bytes-7.2.0.bazel Delete unused transitive-dependency build metadata.
misc/​bazel/​3rdparty/​tree_sitter_extractors_deps/​BUILD.fs-err-3.3.0.bazel Delete unused transitive-dependency build metadata.
misc/​bazel/​3rdparty/​tree_sitter_extractors_deps/​BUILD.bazel Remove argfile aliases.
misc/​bazel/​3rdparty/​tree_sitter_extractors_deps/​BUILD.argfile-1.0.0.bazel Delete generated argfile build metadata.
misc/​bazel/​3rdparty/​tree_sitter_extractors_deps/​argfile/​BUILD.bazel Delete the unversioned dependency alias.
misc/​bazel/​3rdparty/​tree_sitter_extractors_deps/​argfile-1.0.0/​BUILD.bazel Delete the versioned dependency alias.
Cargo.lock Remove argfile and its unused transitive dependencies.

Review effort: Max

Comment thread rust/extractor/src/main.rs
paldepind and others added 2 commits October 28, 2026 15:36
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 35193a30-9bd2-4372-a2e5-65422a7779cf
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 35193a30-9bd2-4372-a2e5-65422a7779cf
@paldepind
paldepind force-pushed the rust/remove-argfile branch from 38712e6 to 08eff93 Compare October 28, 2026 14:36
@paldepind paldepind changed the title Rust: replace argfile expansion with an explicit file list Rust: Remove argfile dependency and read file list manually Oct 28, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Rust Pull requests that update Rust code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants