sonar-kotlin
sonar-kotlin copied to clipboard
SONARKT-379 Fix false positive in S6218
Overriding equals and hashCode is not necessary for data classes that have array fields in their body, because only arguments of the primary constructor are included in the generated equals and hashCode for data classes.
This should not be trigger the rule:
data class ArrayInBody(val age: Int) { // Compliant
val employers = arrayOf("SonarSource")
}
Hello @fellmann, thanks for your contribution! I've created a ticket to track this issue.