JS: make js/unused-local-variable flag import statements#307
Conversation
xiemaisi
suggested changes
Oct 11, 2018
| v.getName(), | ||
| ", " order by v.getName() | ||
| ) and | ||
| not names = "" and |
There was a problem hiding this comment.
I think you can drop this if you use strictconcat instead of concat.
| ( | ||
| if count(UnusedLocal v | | ||
| v = provider.getAVarDecl().getVariable() and | ||
| not whitelisted(v)) > 1 then |
There was a problem hiding this comment.
Could you perhaps pull this out into a predicate and reuse above?
There was a problem hiding this comment.
Perhaps make it a member predicate of ImportVarDeclProvider.
xiemaisi
reviewed
Oct 11, 2018
| ", " | ||
| ) and | ||
| ( | ||
| if count(provider.getAnUnacceptableUnusedLocal()) > 1 then |
There was a problem hiding this comment.
I'd prefer to pull the count out of the if condition. As we've discussed before, writing it like this causes the count to be duplicated, once appearing under a negation, which can sometimes cause the optimiser to do regrettable things. Perhaps we want to have a pluralize predicate somewhere central, like Util.qll?
xiemaisi
previously approved these changes
Oct 11, 2018
Author
|
Rebased (commit order in this UI is misleading) |
xiemaisi
approved these changes
Oct 22, 2018
smowton
pushed a commit
to smowton/codeql
that referenced
this pull request
Apr 16, 2022
Add test case for delegated properties initialized through `provideDelegate` operator
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR makes
js/unused-local-variableflag entire import statements rather than individual unused imports, as discussed in https://jira.semmle.com/browse/ODASA-7348 (I have not created an entirely new query for this though, I think it is sufficient to have two different message strategies).Example:
Before: https://lgtm.com/query/1506610666623/ (156 alerts)
After: https://lgtm.com/query/1506612266524/ (117 alerts)