Hello,
the Sonarqube 5.6 documentation [1] explains the algorithm how new issues are detected. After some simple tests, I have trouble understanding that "3 of 4" criteria, as SonarQube seems to behave differently.
For example, using a minimal Java Quality Profile only with squid:S00103 (Line length) and squid:S109 (magic numbers). Analyzing the following code results - as expected - in two new issues.
// rev.1
public void test() {
int magicNumber = 42;
String s = new String("Very long line that does not meet our maximum 120 character line length criteria and should be wrapped to avoid SonarQube issues.");
}Let's say both issues found in rev.1 are resolved as "Won't Fix" in the UI. Later, the method is refactored or rewritten, resulting in something like rev.2:
// rev.2
public void test() {
System.out.println("Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque vel diam purus. Curabitur ut nisi lacus....");
int a = 0;
int x = a + 123;
}A new Sonar analysis shows no issues for that code, although it is completely different. For both violations previously found, the line number, the message and the line hash have changed - therefore I'd expect new issues, if I understand the docs [1] correctly. Please help me understand what is going on here.
Using SonarQube 5.6.5 with Java Plugin 4.4.0.8066.
Best regards,
Roland
[1]
https://docs.sonarqube.org/display/SONARQUBE56/Issue+Lifecycle