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
Tree sitter extractor: Proper handling of LGTM_INDEX_FILTERS
#15365
base: main
Are you sure you want to change the base?
Conversation
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.
|
Q4 for QL is failing. Might be related to the change in this PR because that check excludes some paths using LGTM_INDEX_FILTERS |
|
looks that way yes. I'll do some debugging 👍 codeql/.github/workflows/ql-for-ql-build.yml Lines 63 to 66 in 03771ff
|
|
I had not thought it through properly in terms of the tree-sitter extractor and |
|
Ah yes, I should have mentioned that I struggled a bit with the rust code. I'll admit I'm not super proficient, so couldn't get rid of the |
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.
This makes sense to me, but I'd like someone more familiar with the tree-sitter extractor to approve.
| .any(|s| s.starts_with("exclude:")); | ||
|
|
||
| if !lgtm_index_filters_has_include && lgtm_index_filters_has_exclude { | ||
| cmd.arg("--also-match=**/*"); |
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 believe --also-match=** is equivalent


If someone had used
LGTM_INDEX_FILTERS=exclude:**/*\ninclude:*.rbbefore, 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 firstfilter if
pathsinclude a glob, which currently causes bad behavior inthe 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.