-
-
Notifications
You must be signed in to change notification settings - Fork 783
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
Group console violation reports by file #1852
Group console violation reports by file #1852
Conversation
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 for contributing to this feature.
Extending the public API would introduce a breaking change, so I'm against adding a new function to the interface when we could implement this Report type by a custom ConsoleReport
.
This way we could provide a selection of FindingsRepots and let the user choose which to use in the config file.
Thank you for the suggestion. |
c84372e
to
507e851
Compare
In the updated PR, it is a boolean value. Would it be better if it is changed it to |
507e851
to
88d858d
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.
Thank you very much for picking up this issue! That's a nice 1st contribution! :)
In my opinion this PR is ready for review.
Please take a look at my comments.
The report FileBasedFindingsReport
should be added to the default-detekt-config.yml file
.
Perhaps a comment should be included, which states that only one of the reports can be activated at the same time (either FindingsReport
or FileBasedFindingsReport
)
https://github.com/arturbosch/detekt/blob/ed77f0c9ebff73a50348c76782e6dcb1bd7d7b08/detekt-cli/src/main/resources/default-detekt-config.yml#L21-L25
detekt-cli/src/main/kotlin/io/gitlab/arturbosch/detekt/cli/console/DebtSumming.kt
Show resolved
Hide resolved
...t-cli/src/test/kotlin/io/gitlab/arturbosch/detekt/cli/console/FileBasedFindingsReportSpec.kt
Show resolved
Hide resolved
detekt-cli/src/test/kotlin/io/gitlab/arturbosch/detekt/cli/TestFactory.kt
Show resolved
Hide resolved
detekt-cli/src/test/kotlin/io/gitlab/arturbosch/detekt/cli/TestFactory.kt
Outdated
Show resolved
Hide resolved
detekt-cli/src/main/kotlin/io/gitlab/arturbosch/detekt/cli/console/FileBasedFindingsReport.kt
Outdated
Show resolved
Hide resolved
detekt-cli/src/main/kotlin/io/gitlab/arturbosch/detekt/cli/console/FileBasedFindingsReport.kt
Outdated
Show resolved
Hide resolved
detekt-cli/src/main/kotlin/io/gitlab/arturbosch/detekt/cli/console/FindingsReport.kt
Outdated
Show resolved
Hide resolved
detekt-cli/src/main/kotlin/io/gitlab/arturbosch/detekt/cli/console/FileBasedFindingsReport.kt
Outdated
Show resolved
Hide resolved
88d858d
to
a6a8f1e
Compare
Codecov Report
@@ Coverage Diff @@
## master #1852 +/- ##
=========================================
Coverage ? 80.36%
Complexity ? 1968
=========================================
Files ? 328
Lines ? 5551
Branches ? 1032
=========================================
Hits ? 4461
Misses ? 557
Partials ? 533
Continue to review full report at Codecov.
|
a6a8f1e
to
072d3c6
Compare
072d3c6
to
8f41a3f
Compare
When the |
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 should have expressed that clearer.
Additionally, you need to add the report class to a file in the META-INF directory.
detekt-cli/src/main/resources/META-INF/services/io.gitlab.arturbosch.detekt.api.ConsoleReport
PS: thanks for the incorporated changes from the review!
detekt-api/src/main/kotlin/io/gitlab/arturbosch/detekt/api/FileBasedConsoleReport.kt
Outdated
Show resolved
Hide resolved
detekt-api/src/main/kotlin/io/gitlab/arturbosch/detekt/api/FileBasedConsoleReport.kt
Outdated
Show resolved
Hide resolved
detekt-cli/src/main/kotlin/io/gitlab/arturbosch/detekt/cli/console/DebtSummingPrinter.kt
Outdated
Show resolved
Hide resolved
detekt-cli/src/main/kotlin/io/gitlab/arturbosch/detekt/cli/console/FileBasedFindingsReport.kt
Show resolved
Hide resolved
...t-cli/src/test/kotlin/io/gitlab/arturbosch/detekt/cli/console/FileBasedFindingsReportSpec.kt
Show resolved
Hide resolved
8f41a3f
to
e865efc
Compare
Yes , this has been done. |
e865efc
to
dab11bf
Compare
CI fails because of other issues. (not related to this PR) |
Ah okay, but the exclusion gets removed once the build runs in local. I have removed the exclusion from |
31a0098
to
69a23cd
Compare
69a23cd
to
b8b4cc8
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 for fixing the merge conflict. We are sorry that your contribution interfered with the bug fix.
Please look at my last review comment. Everything else looks fine.
Anyway, you don't need to force push. We squash and merge the contribution anyhow.
This makes it easier and less time consuming for the reviewer to see what changed between review round n-1
and n
.
...t-cli/src/test/kotlin/io/gitlab/arturbosch/detekt/cli/console/FileBasedFindingsReportSpec.kt
Show resolved
Hide resolved
detekt-cli/src/main/kotlin/io/gitlab/arturbosch/detekt/cli/console/FindingsReport.kt
Outdated
Show resolved
Hide resolved
detekt-cli/src/main/kotlin/io/gitlab/arturbosch/detekt/cli/console/FileBasedFindingsReport.kt
Show resolved
Hide resolved
detekt-cli/src/main/kotlin/io/gitlab/arturbosch/detekt/cli/console/DebtSummingPrinter.kt
Outdated
Show resolved
Hide resolved
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 for the late response!
I'm not sure why we need an additional flag and a new base class for FileBasedFindingsReport
?
I expect this new kind of report to be just a ConsoleReport
which does the new ordering. It is excluded by default.
Moreover I see the need to refactor the reports part in the config to have includes
and excludes
because now if a report is not excluded it means it is included.
@schalkms @sowmyav24 please elaborate why we need a new flag for it.
|
||
class DebtSummingPrinter { | ||
|
||
fun printDebtInformation( |
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.
Seems like this could just be a function?
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 for the late response!
I'm not sure why we need an additional flag and a new base class forFileBasedFindingsReport
?
I expect this new kind of report to be just aConsoleReport
which does the new ordering. It is excluded by default.
Moreover I see the need to refactor the reports part in the config to haveincludes
andexcludes
because now if a report is not excluded it means it is included.
@schalkms @sowmyav24 please elaborate why we need a new flag for it.
If I am to understand correctly, if the additional flag is not there, there would be two console reports, one is the existing report, one is the re-ordered report and both the reports would contain the same information but in a different format.
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.
Yes, to prevent this we should exclude
this new report by default.
Users have to activate it and exclude the default 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.
Okay got it. The report is excluded now and the additional flag is removed. Please let me know if any other documentation or changes are left for this.
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.
The build passes in local, but fails for compilation in the CI
546591d
to
dc63c0c
Compare
…r for section as file names and not rulesets
detekt-cli/src/test/kotlin/io/gitlab/arturbosch/detekt/cli/TestFactory.kt
Outdated
Show resolved
Hide resolved
detekt-cli/src/main/kotlin/io/gitlab/arturbosch/detekt/cli/console/DebtSummingPrinter.kt
Outdated
Show resolved
Hide resolved
...r/src/main/kotlin/io/gitlab/arturbosch/detekt/generator/printer/rulesetpage/ConfigPrinter.kt
Outdated
Show resolved
Hide resolved
21903b1
to
96b0f36
Compare
* Group console violation reports by file * Move empty check on findings before calling the debt printer * Remove flag for file based findings report and exclude it by default * Change format of console report for grouping by files. Have the header for section as file names and not rulesets * Exclude FileBasedFindingsReport and move methods to print debt into debtSumming * Rename test parameter to ruleName from ruleSet
* Group console violation reports by file * Move empty check on findings before calling the debt printer * Remove flag for file based findings report and exclude it by default * Change format of console report for grouping by files. Have the header for section as file names and not rulesets * Exclude FileBasedFindingsReport and move methods to print debt into debtSumming * Rename test parameter to ruleName from ruleSet
* Group console violation reports by file * Move empty check on findings before calling the debt printer * Remove flag for file based findings report and exclude it by default * Change format of console report for grouping by files. Have the header for section as file names and not rulesets * Exclude FileBasedFindingsReport and move methods to print debt into debtSumming * Rename test parameter to ruleName from ruleSet
This PR addresses #1355
Open questions: