Fix false positive of UnnecessaryInnerClass#4509
Merged
chao2zhang merged 3 commits intodetekt:mainfrom Jan 23, 2022
Merged
Conversation
Codecov Report
@@ Coverage Diff @@
## main #4509 +/- ##
=========================================
Coverage 84.14% 84.15%
+ Complexity 3315 3314 -1
=========================================
Files 476 476
Lines 10882 10875 -7
Branches 2015 2011 -4
=========================================
- Hits 9157 9152 -5
Misses 692 692
+ Partials 1033 1031 -2
Continue to review full report at Codecov.
|
BraisGabin
approved these changes
Jan 23, 2022
…ass to be inner
marschwar
approved these changes
Jan 23, 2022
| active: true | ||
| UnnecessaryInnerClass: | ||
| active: true | ||
| ignoreAnnotated: ['Nested'] |
Contributor
There was a problem hiding this comment.
I like this, because I may not necessarily reference anything in the outer class but still will be able to use inner classes to structure tests.
| val fizz = foo | ||
| inner class C { | ||
| fun printFoo() { | ||
| println(foo) |
Contributor
There was a problem hiding this comment.
Did you mean to write println(fizz) here? At least that is what the test description suggests.
Member
Author
There was a problem hiding this comment.
That's a great catch.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Main branch is failing because
/home/runner/work/detekt/detekt/custom-checks/src/test/kotlin/io/github/detekt/custom/SpekTestDiscoverySpec.kt:16:5: Class 'VariableDeclarationsInSpekGroupsShouldOnlyBeSimple' does not requireinnerkeyword. [UnnecessaryInnerClass]is a false positive.@Nestedtests require the class to be inner. IDE prompts **Only non-static nested classes can serve as '@nested' test classes. **