- SonarQube 7.7 Enterprise Edition, sonar-maven-plugin 18.104.22.1688 scanner, SonarJava plugin
How to reproduce:
In the “master” mainline, there’s an existing Java class that uses a particular api in one of its methods. Example: “import java.time.Instant;”
In a new feature branch, that same method was removed since it was no longer required, but the developer forgot to remove the “import java.time.Instant;” line.
The feature branch analysis did NOT report an issue with the unused import.
Upon the merge of the feature branch into master, a new “unused import” issue was detected when “master” was reanalyzed.
How can this be prevented? Can the branch analysis feature be enhances to fail on all new issues introduced by the feature branch? Even if the new issue occured on a line NOT being modified by the feature branch?