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.
This commit is contained in:
Rasmus Wriedt Larsen 2024-01-18 11:44:31 +01:00
Родитель cda2ef4db5
Коммит 54c7c5e8be
Не найден ключ, соответствующий данной подписи
1 изменённых файлов: 1 добавлений и 1 удалений

Просмотреть файл

@ -81,7 +81,7 @@ impl Autobuilder {
if let Some(stripped) = line.strip_prefix("include:") {
cmd.arg("--also-match=".to_owned() + stripped);
} else if let Some(stripped) = line.strip_prefix("exclude:") {
cmd.arg("--exclude=".to_owned() + stripped);
cmd.arg("--also-match=!".to_owned() + stripped);
}
}
let exit = &cmd.spawn()?.wait()?;