java:S1123 rule wrong behavior with Pull Requests

Hi,
we are facing an issue with rule java:S1123 in combination with pull requests.
Rule reference: Java static code analysis: Deprecated elements should have both the annotation and the Javadoc tag

Situation:

  • Within a PR an existing method had been annotated with @Deprecated
  • The rule java:S1123 did not match in the PR and no issue was created (Quality Gate passed, merge was possible)
  • After the PR was merged, the target branch had a match for java:S1123 in the header of the method that had been annotated within the PR → Major issue created → quality gate of the main branch failed :frowning:

Expected behavior: As the match was on the method header only (which had not changed in the PR) it should at least also match on the @Deprecated annotation.

We are at SonarQube 9.4 (developer edition), but I could not find an indication, that the rule has been changed in the meantime.

Could you please consider updating this rule?

Thanks and best regards
Christian

Hey there.

Indeed, on PRs only issues on changed lines of changed files are raised. We’d like to improve this: you can vote on this roadmap item.

And, your version is past EOL. You should upgrade to either the latest version or the current LTS at your earliest convenience. Your upgrade path is:

9.4-> 9.9.2 → 10.2 (last step optional)

You may find these resources helpful:

If you have questions about upgrading, feel free to open a new thread for that here.