Skip to content
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

CanBeNonNullable: explain why the rule does what it does. #5332

Merged
merged 1 commit into from Sep 22, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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