-
Notifications
You must be signed in to change notification settings - Fork 145
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
Issue #374: Fix SingleBreakOrContinue violations #423
Conversation
Update: 6/7 violations resolved. Im still working on the last violation. After fixing i will extend the unit tests to meet the requirements. |
if (isAnonymousClassField(ast) | ||
|| classDetail.containsGetter(methodName) | ||
|| classDetail.containsSetter(methodName) | ||
|| isMainMethod(ast)) { | ||
result = index; | ||
break; |
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.
After reducing the number of breaks to 2, not sure how to eleminate the last one ...
Maybe completly refactoring this method ...
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.
code is not simple :), this is just good example that need to follow new Checks ourself.
solution is to put result != null
condition to FOR, and remove break
completely.
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.
Sorry, i didn't get it.
What about setting: index = Integer.MAX_VALUE - 1; instead f break ?
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.
make loop like for (int index = 0; index < customOrderDeclaration.size() && result != 1 ; index++)
no breaks are required.
please remove from you commit all unrelated changes(that are just formatting), or move them in separate commit of this PR. This will ease diff verification. |
Travis is not happy with reduced coverage
It might be resulted by removing the code lines. Please generate coverage report and share pictures of coverage before and after for this method. If it is the same it is ok to change configuration(see cobertura section |
@yaziza , 1.18 release will be this Sunday, please find time to finish this PR. |
Fixed, i have added a new case in the test input file and the branch cover is now 94% Thank you for your support ! Do you have any suggestions on issues i can tackle next ? |
merged as FF. Thanks a lot for your time and contributions.
One of the banefit of 100% coverage is to remove dead/extra code.
Can you help us with #410 ? Exceptions during execution usually force user to deactivate the Check at all. But you can choose any unassigned issue. |
No description provided.