Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SonarQube: How to suppress a warning in Kotlin code

I'm using SQ 7.3-alpha1 with sonar-kotlin-plugin-1.0.1.965.jar. However, I cannot deactivate a special warning inside my Kotlin code for repositories in Spring Data where I need an "_" in a method name. I tried both //NOSONAR and @Suppress("kotlin:S100") and @SuppressWarnings("kotlin:S100"). Any hint is appreciated.

like image 820
Juergen Zimmermann Avatar asked Aug 02 '18 06:08

Juergen Zimmermann


People also ask

How do you turn off warnings on Kotlin?

You can also use @Suppress in Kotlin or @SuppressWarnings in Java. To suppress a lint warning with a comment, add a //noinspection id comment on the line before the statement with the error.

How do I turn off warnings in SonarQube?

Using //NOSONAR The //NOSONAR tag at the end of the line suppresses all issues that might be raised on it. This approach works for most languages supported by SonarQube.

What is suppress annotation in Kotlin?

Use this annotation on test classes or test methods that should not be included in a test suite. If the annotation appears on the class then no tests in that class will be included. If the annotation appears only on a test method then only that method will be excluded.

Does SonarQube support Kotlin?

SonarQube 7.9 added support for Kotlin language to analyze code quality of code developed in Kotlin. SonarQube integration in Android : Step 1 : Download the latest version of SonarQube and unzip it. Step 2: open sonarQube directory folder and run server on the shell by using StartSonar.


1 Answers

You're not able to deactivate that issue because none of the mechanisms you're trying to use have been implemented for Kotlin.

Instead, you'll have to do this from the UI side.

like image 114
G. Ann - SonarSource Team Avatar answered Oct 07 '22 11:10

G. Ann - SonarSource Team