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
The cast operator can hide null problems in your code. I propose a rule that forbid any cast from a nullable type to a non-null type. If you want to do that you first should cast from nullable to non-null and then do the cast as shown in the example.
The idea is to write code that show that it could fails for two things (nullability and type) and not just one (cast).
I had this idea reading #3479 so they are related but they are not the same.
The text was updated successfully, but these errors were encountered:
Hi @BraisGabin added my fix at #5653. This PR might contain some issues as this is my first time working with Kotlin PSI and detekt. Thanks for reviewing this PR
Expected Behavior of the rule
Noncompliant:
Compliant:
Context
The cast operator can hide null problems in your code. I propose a rule that forbid any cast from a nullable type to a non-null type. If you want to do that you first should cast from nullable to non-null and then do the cast as shown in the example.
The idea is to write code that show that it could fails for two things (nullability and type) and not just one (cast).
I had this idea reading #3479 so they are related but they are not the same.
The text was updated successfully, but these errors were encountered: