-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Rust: ignore target
in qltest
#19542
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
Conversation
The target file created by `cargo check` was causing problems in language tests. We might want to also ignore `target` by default in the production indexing, but I'll leave that for further discussion.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR updates the qltest
extractor to skip target
directories when collecting test source files, preventing build artifacts from being included in language tests.
- Adds a filter to exclude paths starting with
target
- Ensures errors during globbing still propagate correctly
Comments suppressed due to low confidence (1)
rust/extractor/src/qltest.rs:54
- Add a unit test for
set_sources
that includes sample paths both inside and outside atarget
directory to verify the filtering logic works as intended.
fn set_sources(config: &mut Config) -> anyhow::Result<()> {
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. I will see if this fixes CI on a couple of my PRs tomorrow morning.
@@ -54,6 +54,7 @@ path = "main.rs" | |||
fn set_sources(config: &mut Config) -> anyhow::Result<()> { | |||
let path_iterator = glob("**/*.rs").context("globbing test sources")?; | |||
config.inputs = path_iterator | |||
.filter(|f| f.is_err() || !f.as_ref().unwrap().starts_with("target")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess your intention is to keep Err
paths, right? So any errors are not silently ignored. If you just want to drop Err
paths then it might be nicer to use f.is_ok_and()
instead of the is_err
check and unwrap
ping.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah, I hesitated between the two, but in the end opted for not suppressing the errors for now
Seems to have worked, everything is looking better this morning. Thanks again! |
The target file created by
cargo check
was causing problems in language tests.We might want to also ignore
target
by default in the production indexing, but I'll leave that for further discussion.