Skip to content

Commit

Permalink
CanBeNonNullable: explain why the rule does what it does. (#5332)
Browse files Browse the repository at this point in the history
  • Loading branch information
TWiStErRob committed Sep 22, 2022
1 parent f3152f6 commit 3e6d1d0
Showing 1 changed file with 8 additions and 0 deletions.
Expand Up @@ -62,6 +62,14 @@ import org.jetbrains.kotlin.types.isNullable
* This rule inspects variables marked as nullable and reports which could be
* declared as non-nullable instead.
*
* It's preferred to not have functions that do "nothing".
* A function that does nothing when the value is null hides the logic,
* so it should not allow null values in the first place.
* It is better to move the null checks up around the calls,
* instead of having it inside the function.
*
* This could lead to less nullability overall in the codebase.
*
* <noncompliant>
* class A {
* var a: Int? = 5
Expand Down

0 comments on commit 3e6d1d0

Please sign in to comment.