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.
- 'hashCode()' called on array
Calling hashCode() on an array returns the identity hash code, not a hash based on the array's contents.
- 'lazy' can be used with delegation
Detects uses of lazy { ..
- 'toString()' called on array
Calling toString() on an array returns the address of the object in memory, not a string representation of the array's contents.
- 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.
- Convert name-based destructuring short form to full
Reports destructuring declarations in short form and suggests converting them to the full form with explicit property names.
- 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.
- Declaration name mismatch in destructuring declaration
Reports destructuring declarations where variable names don't match the original property names from data classes.
- Delegating to 'var' property
Reports interface delegation to a var property.
- Duplicate arguments in 'setOf' and 'mapOf' functions
Reports duplicate constant elements in set factory functions and duplicate constant keys in map factory functions.
- 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.
- Kotlin script definition is not set up
Reports @KotlinScript-annotated classes that aren't fully set up to be used as a Kotlin script definition.
- Misordered 'assertEquals()' arguments
Reports Kotlin test assertions where the expected and actual values appear to be passed in the wrong order.
- 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.
- String compared with referential equality
Reports code that uses === or !== to compare strings.
- Suspicious '::javaClass' callable reference
Reports suspicious cases of kotlin.jvm.javaClass extension used as a callable reference.
- 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 to add or remove Iterable argument
Reports usages of `plus`/`minus` where the argument type implements `Iterable`, and the receiver is a Kotlin `Collection` or `Sequence` of the same element type.
- 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.
- Unresolved link in KDoc
Reports unresolved links in KDoc comments.
- Unused expression
Reports unused expressions, which often indicate incomplete code or a missing return statement.
- 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.