Probable bugs
- 'equals()' between objects of inconvertible types
Reports calls to equals() where the receiver and the argument are of incompatible primitive, enum, or string types.
- Ambiguous non-local 'break' or 'continue'
Reports break or continue usages inside of lambdas of loop-like functions.
- Ambiguous unary operator use with number constant
Reports an unary operator followed by a dot qualifier such as -1.inc().
- Assigned value is never read
Reports assignments where a value is assigned but never used later in the code.
- Augmented assignment creates a new collection under the hood
Reports augmented assignment (+=) expressions on a read-only Collection.
- Covariant 'equals()'
Reports equals() that takes an argument type other than Any? if the class does not have another equals() that takes Any? as its argument type.
- Delegating to 'var' property
Reports interface delegation to a var property.
- Exception should not be an object
Reports object inherited from Exception because exceptions are inherently stateful, containing information like the stacktrace.
- Existing backing field without assignment
Reports property setters that don't update the backing field.
- Implicit 'Nothing?' type
Reports variables and functions with the implicit Nothing? type.
- Iterated elements are not used in forEach
Reports forEach loops that do not use iterable values.
- Private data class constructor is exposed via the 'copy' method
Reports the private primary constructor in data classes.
- Recursive property accessor
Reports recursive property accessor calls which can end up with a StackOverflowError.
- Redundant interpolation prefix
Reports value parameter annotation usages without an explicit target for which the default target might be unexpected and undesirable.
- Redundant label
Reports redundant labels that cannot be referenced from 'break', 'continue' or 'return' statements.
- Serializable object must implement 'readResolve'
Reports objects (data object including) that implement java.io.Serializable but don't implement readResolve.
- Suspicious 'var' property: its setter does not influence its getter result
Reports var properties with default setter and getter that do not reference backing field.
- Suspicious call on Collection to add or remove Java NIO Path
Reports calls that add or remove a java.nio.file.Path to/from a Kotlin collection or sequence using plus/minus, either in operator form (a + b, a - b) or regular call form (a.plus(b), a.minus(b)).
- Suspicious cascading 'if' expression
Reports cascading if expressions where the last else branch is part of a dot-qualified or binary expression.
- Suspicious combination of == and ===
Reports == and === comparisons that are both used on the same variable within a single expression.
- The result of 'filterIsInstance' call is always empty
The inspection detects calls to Kotlin standard library functions filterIsInstance/filterIsInstanceTo, whose target type is not a subtype of the element type the filtering is called on.
- Throwable not thrown
Reports instantiations of Throwable or its subclasses, when the created Throwable is never actually thrown.
- Unreachable code
Reports code statements are unreachable for execution.
- Unused expression
Reports unused expressions, which often indicate incomplete code or a missing return statement.
- Unused flow
Reports Kotlinx Coroutines Flows that are created but never consumed or passed to other functions.
- Unused lambda expression
Reports lambda expressions that are neither invoked nor assigned.
- Unused result of data class copy
Reports calls to data class copy function without using its result.
- Unused unary operator
Reports unary operators for number types on unused expressions.
- Variable is never read
Reports local variables that are defined but never used afterward in the code.