Skip to content
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

ForbiddenVoid: New option 'ignoreUsageInGenerics' #1738

Merged
merged 4 commits into from
Jul 3, 2019

Conversation

realdadfish
Copy link
Contributor

Fixes #1724

@schalkms
Copy link
Member

Please execute gradle build locally in order to generate the documentation.
Detekt's documentation is automatically generated from the comments in the rule class.
This helps us to have an up to date documentation.

Copy link
Member

@schalkms schalkms left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Looks good!
I think two additional test cases would be beneficial. Otherwise, this is an awesome 1st contribution.

@@ -69,8 +69,7 @@ class ForbiddenVoidSpec : Spek({

class B : A() {
override fun method(param: Foo<Void>) : Foo<Void> {
@Suppress("ForbiddenVoid")
return Foo<Void>()
throw IllegalStateException()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why did you change this?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It served no purpose for the particular test, but rather confused because of the additional @Suppress("ForbiddenVoid").

@@ -107,5 +106,42 @@ class ForbiddenVoidSpec : Spek({
assertThat(findings).hasSize(2)
}
}
describe("ignoreUsageInGenerics is enabled") {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would prefer to have the following test cases:

  1. nested generic void usage (e.g. A<B<Void>>)
  2. Dictionary (e.g. Map<Int, Void>)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will add these.

Copy link
Member

@schalkms schalkms left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@codecov-io
Copy link

codecov-io commented Jun 30, 2019

Codecov Report

Merging #1738 into master will increase coverage by 4.17%.
The diff coverage is 66.66%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master    #1738      +/-   ##
============================================
+ Coverage     75.64%   79.81%   +4.17%     
- Complexity     1835     1936     +101     
============================================
  Files           332      324       -8     
  Lines          5531     5470      -61     
  Branches       1009     1007       -2     
============================================
+ Hits           4184     4366     +182     
+ Misses          807      581     -226     
+ Partials        540      523      -17
Impacted Files Coverage Δ Complexity Δ
...lab/arturbosch/detekt/rules/style/ForbiddenVoid.kt 95.45% <66.66%> (-4.55%) 19 <1> (+2)
...urbosch/detekt/sample/extensions/SampleProvider.kt
...le/extensions/processors/QualifiedNameProcessor.kt
.../extensions/reports/QualifiedNamesConsoleReport.kt
...ekt/sample/extensions/rules/TooManyFunctionsTwo.kt
...e/extensions/reports/QualifiedNamesOutputReport.kt
...rbosch/detekt/sample/extensions/reports/Reports.kt
...le/extensions/processors/NumberOfLoopsProcessor.kt
...detekt/sample/extensions/rules/TooManyFunctions.kt
...rturbosch/detekt/rules/style/UnusedPrivateClass.kt 67.85% <0%> (+1.78%) 4% <0%> (ø) ⬇️
... and 58 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update a36f3c9...76f0ca8. Read the comment docs.

@schalkms schalkms merged commit f3d4bbb into detekt:master Jul 3, 2019
@arturbosch arturbosch added this to the 1.0.0 milestone Jul 6, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ForbiddenVoid and TestObserver<Void>
5 participants