-
Notifications
You must be signed in to change notification settings - Fork 1.8k
C#: Respect order of LGTM_INDEX_FILTERS
in buildless extraction
#15325
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
That is, using `exclude:**/*\ninclude:**/*` should include everything.
for (int i = pathFilters.Count - 1; i >= 0; i--) | ||
{ | ||
var pathFilter = pathFilters[i]; |
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.
Minor: I wonder if pathFilters.Reverse()
or foreach (var pathFilter in pathFilters.Reverse<PathFilter>())
would be clearer, rather than switching to indices.
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 actually looked on stackoverflow for this, which said that using the inline .Reverse
in the foreach
was quite inefficient.
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 am not sure off the top of my head if having the .Reverse
in the foreach
would get evaluated with every iteration, but replacing pathFilters.Sort
with pathFilters.Reverse
should at least be more efficient than .Sort
(although likely not as efficient as using the indices of course).
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 can swap the reverse loop with a Reverse()
on the list if you like. Personally I've seen enough reverse iterations of lists with explicit indexing that it just clicks 🤷
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 don't feel strongly about this, so feel free to just leave it as is 👍🏻
csharp/extractor/Semmle.Extraction.CSharp.DependencyFetching/FilePathFilter.cs
Outdated
Show resolved
Hide resolved
Co-authored-by: Michael B. Gale <mbg@github.com>
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, thank you.
That is, using
exclude:**/*\ninclude:**/*
should include everything (but that wouldn't happen with the old code)