Deactivate java 8 triggered rule

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

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 sonar.java.source property to the proper version of java of your project.

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)

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

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).

Thanks.

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:

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.

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

SonarQube will not save issue if it’s on the deactivated rule.
This rule you are talking about is in the default profile, so you probably run analysis with the wrong profile first.
Make sure your project is assigned to the right profile and then rerun analysis