You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// non compliant code var string ="foo"println(requireNotNull(string))
// compliant codevar string :String?="foo"println(requireNotNull(string))
Context
We have seen optional field become required after refactorings, leaving behind unnecessary calls to requireNotNull.
We have built a custom rule to detect these cases and we would like to contribute it back.
The text was updated successfully, but these errors were encountered:
I think this would be a great addition, and should also check for the same case with checkNotNull. We'd need a different rule name if it checks both cases though (or a separate rule for check, but I don't think that makes sense).
I think a single UnnecessaryNotNullCheck rule that encompasses checkNotNull and requireNotNull makes sense. Definitely more future-proof. I'll take a stab at it.
Expected Behavior of the rule
Would there be any appetite for a new
UnnecessaryRequireNotNull
rule?This would be similar to UnnecessaryNotNullOperator but it would flag calls to requireNotNull with a non-nullable parameter.
Context
We have seen optional field become required after refactorings, leaving behind unnecessary calls to
requireNotNull
.We have built a custom rule to detect these cases and we would like to contribute it back.
The text was updated successfully, but these errors were encountered: