-
-
Notifications
You must be signed in to change notification settings - Fork 774
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
Use notifications instead of println #1818
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.
Top!
detekt-cli/src/main/kotlin/io/gitlab/arturbosch/detekt/cli/console/NotificationReport.kt
Show resolved
Hide resolved
Codecov is back once again. |
Codecov Report
@@ Coverage Diff @@
## master #1818 +/- ##
===========================================
- Coverage 79.75% 79.66% -0.1%
- Complexity 1932 1934 +2
===========================================
Files 323 324 +1
Lines 5497 5502 +5
Branches 1019 1020 +1
===========================================
- Hits 4384 4383 -1
- Misses 589 594 +5
- Partials 524 525 +1
Continue to review full report at Codecov.
|
detekt-cli/src/main/kotlin/io/gitlab/arturbosch/detekt/cli/console/FindingsReport.kt
Show resolved
Hide resolved
I've extracted the BuildFailure logic to a common file, the Please review that last commit. |
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 had a very hard time reviewing this last commit, because it contains so many changes.
Basically, detekt now throws exceptions of type BuildFailure
instead of printing to the system.out
.
|
||
runCatching { Runner(cliArgs).execute() } | ||
.onSuccess { assertThat(Files.readAllLines(tmpReport)).hasSize(1) } | ||
.onFailure { fail("should not fail with a BuildFailure exception") } |
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.
Weird test construct
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.
Does it test a successful or a failed run?
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.
Your right, the catch and failure block is not necessary for this test.
detekt-cli/src/test/kotlin/io/gitlab/arturbosch/detekt/cli/TestDetektion.kt
Show resolved
Hide resolved
detekt-cli/src/test/kotlin/io/gitlab/arturbosch/detekt/cli/OutputFacadeSpec.kt
Show resolved
Hide resolved
detekt-cli/src/main/kotlin/io/gitlab/arturbosch/detekt/cli/runners/SingleRuleRunner.kt
Outdated
Show resolved
Hide resolved
Thanks for the feedback, I will split the changes into two PRs. |
…when no findings are found
… trying to run it and fail on not found
* Make use of notifications instead of printing directly to the console * Use spaces in config printer * Do not print rule set ids when no issues are present for that rule set * Extract build failure logic to a common file, just throw in runner * Simplify testcase * Rearrange test cases to make clear that rule set ids are not printed when no findings are found * Make clear that we should eagerly test the existence of a rule before trying to run it and fail on not found
* Make use of notifications instead of printing directly to the console * Use spaces in config printer * Do not print rule set ids when no issues are present for that rule set * Extract build failure logic to a common file, just throw in runner * Simplify testcase * Rearrange test cases to make clear that rule set ids are not printed when no findings are found * Make clear that we should eagerly test the existence of a rule before trying to run it and fail on not found
Closes - #1797
a config like:
won't print anything.
I will write a guide on how to turn detekt silent for your CI in a separate PR.