GeezerVison is showing github.com — [java] OnlyOneReturn: false negative with anonymous class by adangel · Pull Request #3274 · pmd/pmd
Conversation
adangel
commented
May 13, 2021
•
edited
Loading
Uh oh!
There was an error while loading. Please reload this page.
Converts the rule OnlyOneReturn to use rulechain. Now all method
declarations are visited regardless where they are
nested.
This FN has been found via #2687.
Example code:
public class OnlyOneReturn {
void foo() {
Object o = new Object() {
void method(int i) {
switch (i) {
case 1: return; // missing violation
case 2: return; // missing violation
}
return;
}
};
}
}
Note: this rule has already been converted in pmd7
Ready?
- Added unit tests for fixed bug/feature
- Passing all unit tests
- Complete build
./mvnw clean verify passes (checked automatically by github actions)
- Added (in-code) documentation (if needed)
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
adangel
changed the title
[java] OnlyOneReturn: False negative with anonymous class
[java] OnlyOneReturn: false negative with anonymous class
May 13, 2021
Converts this rule to use rulechain. Now all method
declarations are visited regardless where they are
nested.
This FN has been found via pmd#2687.
Uh oh!
There was an error while loading. Please reload this page.
ghost
commented
May 13, 2021
•
edited by ghost
Loading
Uh oh!
There was an error while loading. Please reload this page.
|
1 Message
|
| 📖 |
This changeset changes 0 violations,
introduces 62 new violations, 0 new errors and 0 new configuration errors,
removes 0 violations, 2 errors and 2 configuration errors.
Full report |
| ✅ |
This changeset changes 0 violations,
introduces 62 new violations, 0 new errors and 0 new configuration errors,
removes 0 violations, 2 errors and 2 configuration errors.
Full report |
Generated by 🚫 Danger
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
…/codestyle/xml/OnlyOneReturn.xml
|
It would be nice eventually to make this rule report violations only once per method, like what you did with #3255. I'll make a ticket for that
|
adangel reacted with thumbs up emoji
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Development
Successfully merging this pull request may close these issues.
Uh oh!
There was an error while loading. Please reload this page.
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.