I am developing a custom java plugin and during my tests I found out that sometimes I need to check that several issues are reported on the same line (in my case a method).
I have added the // Noncompliant {{message here}}
This works very well if there is only one issue reported on that line, but I need to test that 2 or more issues are reported on the same line.
Is this possible? I was going through documentation but without success.
I am using Sonar version 7.9.1, and sonar-java-plugin-6.1.0.20866.jar.
I believe the javadoc in this file is what you are looking for. Note that this is the behavior of the current version, we reworked the CheckVerifier in version 8.3 of the Java analyzer. As far as I remember, it should be possible to do something similar in version 6.1 though.
Basically, you can use something like:
// Noncompliant@+2 [[sc=1;ec=7]] {{Highlight "public"}}
// Noncompliant@+1 [[sc=12;ec=15]] {{Highlight function name}}
public void fun(int arg) // Noncompliant [[sc=20;ec=23]] {{Highlight argument}}