New rule: disallow to cast to nullable type#3497
Merged
Merged
Conversation
Codecov Report
@@ Coverage Diff @@
## master #3497 +/- ##
============================================
- Coverage 79.73% 77.57% -2.16%
+ Complexity 2869 2808 -61
============================================
Files 461 462 +1
Lines 8668 8683 +15
Branches 1676 1679 +3
============================================
- Hits 6911 6736 -175
- Misses 845 1040 +195
+ Partials 912 907 -5 Continue to review full report at Codecov.
|
schalkms
approved these changes
Feb 24, 2021
…etekt/rules/bugs/CastToNullableTypeSpec.kt Co-authored-by: M Schalk <30376729+schalkms@users.noreply.github.com>
Member
|
Sorry, but I still don't see the value of this rule. And why is OK if the initial type is not nullable. I'd like to know what the other maintainers think about it. |
cortinico
approved these changes
Feb 26, 2021
cortinico
left a comment
Member
There was a problem hiding this comment.
I think the rule is valuable. To be honest I never really wrote a cast to a nullable type (as String?) and I've always used the as? variant, but I understand that it could be useful to detect them.
…etekt/rules/bugs/CastToNullableTypeSpec.kt Co-authored-by: Nicola Corti <corti.nico@gmail.com>
…etekt/rules/bugs/CastToNullableTypeSpec.kt Co-authored-by: Nicola Corti <corti.nico@gmail.com>
picklebento
reviewed
Mar 1, 2021
picklebento
approved these changes
Mar 1, 2021
picklebento
approved these changes
Mar 1, 2021
This was referenced Mar 11, 2021
Closed
This was referenced Mar 11, 2021
This was referenced Mar 18, 2021
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.
Fixes #3479