Deactivate java 8 triggered rule


(Rohde Fischer) #1

Must-share information (formatted with Markdown):

  • which versions are you using (SonarQube, Scanner, Plugin, and any relevant extension)
    Sonarqube 7.1, Codesmells 4.0.0, Sonarjava 5.6.1

  • what are you trying to achieve
    To deactivate/disable/remove the rule “Lambdas should be replaced with method references” from a specific profile. However, it is not listed as active, Googling reveals that it is seemingly automatically activated by running Java >= 8.

  • what have you tried so far to achieve this
    Go through the rules and quality profiles. Tried activating it and deactivating it

(Nicolas Peru) #2

Hi @rohdef,

I am really unsure of what your problem is : if you are willing to keep the rules activated for java 8 project and deactivated for the rest you should set property to the proper version of java of your project.

(Rohde Fischer) #4

The problem is as follows:

This is from our profile - the rule is not activate

(another post will follow, there’s one image per post rule it seems)

(Rohde Fischer) #5

Output from the analysis - wait, what? The rule is not active, so why do I get this warning?

(Nicolas Peru) #6

What is the quality profile activated on your project ? You can see that on the right column of the main dashboard of your project.

Once we have determined this, can you confirm that the rule is deactivated in that quality profile (you can go to the page of the rule on your instance to check on which quality profile the rule is activated).


(Rohde Fischer) #7

The screendump is from the active quality profile, as stated in the test. The name of the profile is: “(Java)[Sonar way (d2b2 Tweaked)]” which afaik is useless information in this situation? I did follow the links from the project by selecting the active quality profile to see the active rules and to avoid accidentally selecting a profile that is not in use :slight_smile:

(Nicolas Peru) #8

Was the issue you mention created before you deactivated the rule from QP ?
I suspect issue was created before the rule was deactivated from your QP.

and what do you mean by :

Googling reveals that it is seemingly automatically activated by running Java >= 8.

it is true that the IF the rule is activated in QP then we rely on the java version of your project to determine if the rule is relevant or not.
But if the rule is deactivated then it should not produce new issues.

(Rohde Fischer) #9

The rule was never active in the QP, so yes it was tested after it was deactive. Can we please go to the actual problem, basically that the rule does take effect even though it’s deactivated. I suspect it’s because it’s automatically activated by running Java >= 8, although I do not know the internals of Sonarqube, so I cannot know that for certain