Java: Port C++ query cpp/continue-in-false-loop to Java.#2175
Merged
yh-semmle merged 2 commits intogithub:masterfrom Oct 25, 2019
Merged
Java: Port C++ query cpp/continue-in-false-loop to Java.#2175yh-semmle merged 2 commits intogithub:masterfrom
yh-semmle merged 2 commits intogithub:masterfrom
Conversation
Contributor
|
The C++ version also comes with tests that you can port. I think your port will currently classify https://github.com/Semmle/ql/blob/30483db621a480b24a41bde0377a8db2d34de7da/cpp/ql/test/query-tests/Likely%20Bugs/ContinueInFalseLoop/test.cpp#L88 as bad, but we think it's good because using |
Contributor
Author
|
I haven't seen that case in Java code, but if I saw it, I'd prefer a labelled |
felicitymay
previously approved these changes
Oct 23, 2019
Contributor
felicitymay
left a comment
There was a problem hiding this comment.
Thanks for the ping and the change note. This all LGTM.
yh-semmle
approved these changes
Oct 25, 2019
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 query seems like it would be nice to have for Java as well. It doesn't have many results, but they tend to be good. See https://lgtm.com/query/5394831352853525197/ for two example results, https://github.com/apache/hive/blob/master/ql/src/java/org/apache/hadoop/hive/ql/parse/SemanticAnalyzer.java#L15212 is a particularly nice TP with a comment that makes it very clear that there is a mistake.