ActiveRule and project Quality Profile


I am trying to diagnose a problem where the FindBugs plugin is performing an analysis even though the Quality Profile of the project does not contain any rule.
The plugin uses ActiveRules to decide if the analysis is needed.

What I have seen when debugging the issue is that for a Java project, when the Quality Profile associated with the project does not contain any rule, ActiveRules does not return any Java rules (as expected) but still returns a lot of rules for other languages.
In particular ActiveRules returns some FindSecBugs JSP rules (for the JSP language) even though there are not JSP files in the project. Since these rules are in ActiveRules the plugin runs the analysis.

My guess is that ActiveRules returns the rules of the quality profile but also every single rule from the default profile of the other languages; is it what’s happening?

If so, is that by design?

Would it make sense to test if the project needs to be analyzed with JSP rules that way?

Hi @gtoison

The language of rules has no strong relation with language of files. Most Sensors will report issues for rule of language X only on files of language X, but this is not enforced by the platform. For example, our Java analyzer could detect issues in Spring framework configuration files. Those rules used to be classified as Java rules, but the configuration file is an XML file.

Consequently, quality profiles are not dynamically computed based on the project files. A project will have an active quality profile for all languages on the server.

The Findbugs Sensor already declares the list of file languages it supports:
It means that every time the project contains at least one file for one of the languages Java, Jsp, scala, or clojure, the Sensor will run (you will see its name in the logs).

Hope that helps

Hi @Julien_HENRY

Thank you for the answer, it helped a lot clarifying things for me.
In that case it is not obvious for the users that the SpotBugs analysis will run even though there are no active Java rules. The JSP rules only analyze jsp files so the sensor can ignore these rules when there are none of them.

Thanks again

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.