Skip to content

Rust: add option to extract dependencies as source files #19583

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

Merged
merged 2 commits into from
May 27, 2025

Conversation

aibaars
Copy link
Contributor

@aibaars aibaars commented May 26, 2025

@Copilot Copilot AI review requested due to automatic review settings May 26, 2025 16:22
@aibaars aibaars requested a review from a team as a code owner May 26, 2025 16:22
@github-actions github-actions bot added the Rust Pull requests that update Rust code label May 26, 2025
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

Adds a new flag to control whether dependencies are extracted as full source files rather than libraries, and wires it through the extractor’s configuration, main logic, and YAML schema.

  • Introduce extract_dependencies_as_source in Config
  • Update main.rs to switch extraction mode and path resolution based on the new flag
  • Extend codeql-extractor.yml schema with the new option

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
rust/extractor/src/config.rs Added extract_dependencies_as_source: bool to Config
rust/extractor/src/main.rs Conditionally select SourceKind and ResolvePaths
rust/codeql-extractor.yml Defined extract_dependencies_as_source schema option
Comments suppressed due to low confidence (1)

rust/extractor/src/main.rs:325

  • [nitpick] This info! call can produce very verbose logs on each file; consider removing it or lowering it to debug! if it was added for temporary debugging.
tracing::info!("file: {}", file.display());

@@ -82,3 +82,11 @@ options:
title: Skip path resolution
description: >
Skip path resolution. This is experimental, while we move path resolution from the extractor to the QL library.
type: string
pattern: "^(false|true)$"
extract_dependencies_as_source:
Copy link
Preview

Copilot AI May 26, 2025

Choose a reason for hiding this comment

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

The schema defines this option as a string with a boolean pattern, but Config expects a bool. Change type: string to type: boolean and remove the pattern to align with the Rust flag.

Copilot uses AI. Check for mistakes.

Co-authored-by: Simon Friis Vindum <simonfv@gmail.com>
Copy link
Contributor

@paldepind paldepind left a comment

Choose a reason for hiding this comment

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

Thanks for implementing this 😄

@aibaars aibaars merged commit d018c02 into main May 27, 2025
14 checks passed
@aibaars aibaars deleted the aibaars/lib-as-source branch May 27, 2025 12:11
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