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
Also check USELESS_ELVIS
in UnreachableCode
#6624
Also check USELESS_ELVIS
in UnreachableCode
#6624
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #6624 +/- ##
=========================================
Coverage 85.13% 85.13%
- Complexity 4079 4081 +2
=========================================
Files 570 570
Lines 13363 13364 +1
Branches 2402 2402
=========================================
+ Hits 11376 11377 +1
Misses 791 791
Partials 1196 1196 ☔ View full report in Codecov by Sentry. |
967e12a
to
164b543
Compare
detekt-gradle-plugin/src/functionalTest/kotlin/io/gitlab/arturbosch/detekt/DetektAndroidSpec.kt
Show resolved
Hide resolved
I understand why this is added to the existing unreachable code rule but I believe this should be implemented as a separate rule since it's a wrapper of an existing compiler warning. I don't think wrapped compiler warnings should be consolidated in the same rule. And very technically speaking the Elvis operator itself is not unreachable - it will always be hit. |
I'm not sure about this. It's true, it's easy to think "two different rules" looking at the implementation. But, as a user, both are unreachable code so I think that it is ok to merge them. A new rule will help to make this more configurable but I think that we don't need such configuration. |
...t-rules-errorprone/src/main/kotlin/io/gitlab/arturbosch/detekt/rules/bugs/UnreachableCode.kt
Outdated
Show resolved
Hide resolved
* Also check `USELESS_ELVIS` in `UnreachableCode` * Remove unnecessary `?: return` from TC code * Use `||` instead of list and `in`
* Also check `USELESS_ELVIS` in `UnreachableCode` * Remove unnecessary `?: return` from TC code * Use `||` instead of list and `in`
* Also check `USELESS_ELVIS` in `UnreachableCode` * Remove unnecessary `?: return` from TC code * Use `||` instead of list and `in`
Fixes #6623