-
Notifications
You must be signed in to change notification settings - Fork 184
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
Add category and type to code duplication issues #939
Add category and type to code duplication issues #939
Conversation
f593b0d
to
423d363
Compare
Codecov Report
@@ Coverage Diff @@
## master #939 +/- ##
=========================================
Coverage 92.91% 92.92%
Complexity 2338 2338
=========================================
Files 345 345
Lines 6495 6499 +4
Branches 672 672
=========================================
+ Hits 6035 6039 +4
Misses 262 262
Partials 198 198
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
I wonder if we should better implement that in the warnings plug-in and convert all empty types and categories by default to a „-„? The dash is used for other empty elements as well. On the other hand, a category for duplications in the analysis model would not hurt. But a category and type seems to be redundant for me. What do you think? |
Yes, it could be nice to have a dash for empty categories on warning ng. that could be useful also for other parsers. I know it seems redundant to have a category and a type for cpd duplication on the issue tab, but for the type tab and the category tab, that would be helpful to distinguish them from other uncategorized issues or not typed issues. If we need to choose, I think setting the category would be better as for now there is no default category for uncategorized issues. |
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.
Ok, then let us add these values.
@@ -64,6 +64,8 @@ protected Report convertDuplicationsToIssues(final List<Duplication> duplication | |||
.setLineStart(file.getLine()) | |||
.setLineEnd(file.getLine() + duplication.getLines() - 1) | |||
.setFileName(file.getPath()) | |||
.setCategory("CPD") |
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.
Move the category to
analysis-model/src/main/java/edu/hm/hafner/analysis/parser/dry/AbstractDryParser.java
Line 83 in a137c72
issueBuilder.setMessage("Found duplicated code."); |
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 would prefer to set the category to „Code Duplication“.
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.
This is not yet addressed. Can't this be moved to the parent class?
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.
And „Code Duplication“ reads better than CamelCase.
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.
My bad I missed that one
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.
Should be good now.
I replaced buildAndClean()
by build()
in SimianParser and DupFinderParser otherwise from the second iteration in the duplication.getBlocks() loop you would loose the consolidated fields (message and category) from the AbstractDryParser.
Didn't needed to do it in CPDParser as it already used build()
.
@@ -64,6 +64,8 @@ protected Report convertDuplicationsToIssues(final List<Duplication> duplication | |||
.setLineStart(file.getLine()) | |||
.setLineEnd(file.getLine() + duplication.getLines() - 1) | |||
.setFileName(file.getPath()) | |||
.setCategory("CPD") | |||
.setType("CodeDuplication") |
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.
And use „CPD“ as type here. It would be nice to set the type for the other two parsers as well.
423d363
to
df7d4b4
Compare
df7d4b4
to
f90c316
Compare
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.
Thanks!
Testing done
I have noticed that there were no category nor type on cpd issues, which impact their integration with other tools.
In the category tab on Jenkins, it render a blank line which make them non clickable.
In the type tab, they are rendered with a
-
and gathered with all the other categorized issues.And in the issue tab they are not easily identifiable without category nor type
So I proposed to set for all cpd issues a category
CPD
and for typeCodeDuplication
Submitter checklist