Skip to content

Commit 54c7c5e

Browse files
committed
Tree sitter extractor: Proper handling of LGTM_INDEX_FILTERS
If someone had used `LGTM_INDEX_FILTERS=exclude:**/*\ninclude:*.rb` before, we would have mistakenly excluded all files :| (LGTM_INDEX_FILTERS is a prioritized list where later matches take priority over earlier ones) This change is needed to support adding `exclude:**/*` as the first filter if `paths` include a glob, which currently causes bad behavior in the Python extractor. However, we can first introduce that change once this PR has been merged. I realize this change can cause more folders and files to be traversed (since they are not just skipped with --exclude). We plan to make a better long term fix which should bring back the previous performance.
1 parent cda2ef4 commit 54c7c5e

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

shared/tree-sitter-extractor/src/autobuilder.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ impl Autobuilder {
8181
if let Some(stripped) = line.strip_prefix("include:") {
8282
cmd.arg("--also-match=".to_owned() + stripped);
8383
} else if let Some(stripped) = line.strip_prefix("exclude:") {
84-
cmd.arg("--exclude=".to_owned() + stripped);
84+
cmd.arg("--also-match=!".to_owned() + stripped);
8585
}
8686
}
8787
let exit = &cmd.spawn()?.wait()?;

0 commit comments

Comments
 (0)