kotlin:S1172 Support @Suppress to ignore rules on certain cases

Hello.

Here is another typical Android use case. Once you assigned a listener to a view you need to provide a certain method signature in the corresponding method:

sendButton.setOnClickListener(::handleClick)

private fun handleClick(@Suppress("UNUSED_PARAMETER") view: View) {
   // do something
}

Lint understands the suppression but SonarLint ignores it and raises kotlin:S1172 as a code smell.
Let me know if you need more information regarding this issue.

Tobias

1 Like

Hi Tobias,

I created this false-positive ticket SONARSLANG-431 to improve SonarKotlin.

Thanks for your feedback,

Alban

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.