Search code examples
javasonarqube-4.5jersey-1.0

Excluding com.sun.jersey package from Sonarqube rule


We have an old WLS server that is using Jersey 1.x

Sonarqube is complaining about using the com.sun.jersey imports in different classes.

I wish to customize the sonarqube rule

"Classes from "com.sun." and "sun." packages should not be used"

Sonar rule

To not give a false positive on our jersey imports but still be valid for all other sun packages.

I have read the documentation but i can only find how to exclude different files and packages from beeing analyzed by the rules. But how do i customize the specific rule to only ignore jersey imports but keep the rest.


Solution

  • Log in Sonarqube with an account which can edit the rules and quality profiles. Go to the Rules menu, search the rule "squid:S1191" (Classes from "sun.*" packages should not be used). Then, in the activated quality profiles, you can click on the Change button to edit the Exclude parameter of the rule. Simply enter com.sun.jersey the text box.