Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rust: add flag to turn off extractor path resolution #18813

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

redsun82
Copy link
Contributor

No description provided.

@Copilot Copilot bot review requested due to automatic review settings February 19, 2025 08:45
@github-actions github-actions bot added the Rust Pull requests that update Rust code label Feb 19, 2025

Choose a reason for hiding this comment

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

PR Overview

This PR adds a flag to disable the extractor’s path resolution, giving users control over whether to resolve paths during extraction. The changes include adding a new enum (ResolvePaths), updating the Translator struct and constructors to accept a resolve_paths parameter, and propagating this flag via configuration files and test options.

  • Introduce the ResolvePaths flag in the extractor (Yes/No).
  • Update the Translator and extraction functions to conditionally skip path resolution.
  • Add configuration options in YAML and Rust config to support the new flag.
  • Update test files to verify behavior when path resolution is disabled.

Changes

File Description
rust/ql/test/extractor-tests/canonical_path/disabled/anonymous.rs Adds test code to verify extractor behavior with path resolution disabled.
rust/ql/test/extractor-tests/canonical_path/disabled/regular.rs Provides additional test coverage for the new flag.
rust/codeql-extractor.yml Introduces the new skip_path_resolution configuration flag.
rust/ql/test/extractor-tests/canonical_path/disabled/options.yml Enables the skip_path_resolution flag for testing purposes.
rust/extractor/src/translate.rs Updates re-exports to include the new ResolvePaths enum.
rust/extractor/src/translate/base.rs Adds the ResolvePaths enum, a new field in Translator, and conditional checks to skip path resolution.
rust/extractor/src/main.rs Adjusts extraction function signatures and logic to pass the resolve_paths parameter.
rust/extractor/src/config.rs Adds the skip_path_resolution flag to the configuration structure.

Copilot reviewed 10 out of 10 changed files in this pull request and generated no comments.

Comments suppressed due to low confidence (1)

rust/ql/test/extractor-tests/canonical_path/disabled/anonymous.rs:26

  • [nitpick] Consider renaming the locally defined 'OtherStruct' in the nested function to a more descriptive name to avoid potential confusion with the 'OtherStruct' defined earlier in the file, even though they are in separate scopes.
struct OtherStruct;

Tip: Copilot only keeps its highest confidence comments to reduce noise and keep you focused. Learn more

@@ -0,0 +1 @@
extractor-tests/canonical_path/canonical_paths.ql

Check warning

Code scanning / CodeQL

Query test without inline test expectations Warning test

Query test does not use inline test expectations.
Copy link
Contributor

@aibaars aibaars left a comment

Choose a reason for hiding this comment

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

This looks good to me. Could you try a DCA run comparing extraction with and without this feature?

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