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
Rewrite Suppressions.kt
tests
#7108
Conversation
62f2552
to
cfb3651
Compare
cfb3651
to
d1dae47
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #7108 +/- ##
============================================
- Coverage 83.86% 83.85% -0.01%
Complexity 3949 3949
============================================
Files 578 578
Lines 12155 12155
Branches 2493 2493
============================================
- Hits 10194 10193 -1
- Misses 732 733 +1
Partials 1229 1229 ☔ View full report in Codecov by Sentry. |
} | ||
private fun KtFile.getMethod(): KtElement { | ||
return findChildByClass(KtClass::class.java)!! | ||
.findFunctionByName("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.
Minor but should "function"
be a parameter of this KtFile.getMethod(functionName: String = "function")
? It reads a bit awkward to me
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.
It is a bit awkward because this functions only work if the KtFile
is more less as the ones that I defined in the different tests. If you check them they are very similar, the only change is where is the annotation. Adding a parameter to this function has little sense because, anyway, this function only work with that structure of KtFile
. I changed this a bit to remove the hardcode "function"
but the idea is still the same.
I'm going to merge this now because it unblocks me for other PRs but I you think that it's not good enough tell me and I can look at it and find a better solution on other PR.
} | ||
private fun KtFile.getMethodParameter(): KtElement { | ||
return findChildByClass(KtClass::class.java)!! | ||
.findFunctionByName("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.
Same here
detekt-core/src/test/kotlin/io/gitlab/arturbosch/detekt/core/SuppressionSpec.kt
Outdated
Show resolved
Hide resolved
…uppressionSpec.kt Co-authored-by: Chao Zhang <chao.zhang@instacart.com>
detekt-core/src/test/kotlin/io/gitlab/arturbosch/detekt/core/SuppressionSpec.kt
Fixed
Show fixed
Hide fixed
detekt-core/src/test/kotlin/io/gitlab/arturbosch/detekt/core/SuppressionSpec.kt
Fixed
Show fixed
Hide fixed
detekt-core/src/test/kotlin/io/gitlab/arturbosch/detekt/core/SuppressionSpec.kt
Fixed
Show fixed
Hide fixed
43a7c53
to
108aa9f
Compare
The reason of this rewrite is #7101. The previous tests relay on how the
Rule
works to test whatisSuppressedBy
those. The new implementation depends on nothing else than what they are testing. This helps to unblocks #7101 a bit.Also these test should be more exhaustive and easier to read and maintain.