[Suggestion] The ability to deactivate inherited rules from Quality Profiles

824 views
Skip to first unread message

Victor Santos

unread,
Jul 13, 2016, 3:32:41 PM7/13/16
to SonarQube
Hello, guys! :D

We are currently facing an annoying situation that is: SonarQube is not allowing the possibility to deactivate inherited rules which force my team to duplicate the entire quality profile and make changes by our selfs. This kind of situation can be really annoying due every new update that will mess with these rules forces a verification one by one.

I know that this behavior is expected as SonarQube's documentation specifies, is there any chances to be implemented?

I searched possible open tickets (`jira.sonarsource.com`) and other threads without success for a good solution:

Answer 2: http://stackoverflow.com/questions/21105148/sonarqube-how-to-deactivate-inherited-rule-in-quality-profile

Additional details:
SonarQube affected versions: 4.4 +

Can someone please help me with this question? Thank you very much! (:

Cheers,

Victor.

G. Ann Campbell

unread,
Jul 13, 2016, 3:47:41 PM7/13/16
to SonarQube
Hi Victor, 

My only suggestion would be to talk to your profile administrator.

Let's say you have 2 subsets of rules:
  • core
  • nice-to-have

As I understand it, your current parent profile includes both sets.

I would suggest you get your profile admin to change the hierarchy like so

Core Rule Profile
|-Core + Nice-to-have Rule Profile

Then you have the option of inheriting from either Core Rule Profile (which is what you seem to want) or the larger Core + Nice profile.


Good luck!
Ann

G. Ann Campbell

unread,
Jul 14, 2016, 8:05:37 AM7/14/16
to SonarQube
BTW, it may be of interest that internally we use a similar structure, where the root profile is Sonar way, its first direct child is adds rules, and then other profiles inherit from that.


Ann

Victor Santos

unread,
Jul 19, 2016, 8:13:31 AM7/19/16
to SonarQube
Hello, Ann :D

Im so sorry about the late response. Thank you very much for the advices, we will follow your tips!

Cheers,

Victor.

Daniel Serodio

unread,
Jul 19, 2016, 1:37:36 PM7/19/16
to SonarQube
Hi Ann,

I am Victor's profile administrator :)

The problem we're facing is that since Sonar does not allow disabling inherited rules, we don't use profile inheritance from Sonar Way to our company's quality profile. For instance—even thou I particularly hate tabs—Eclipse's default formatting rules use tabs for indentation so most of our Java projects use tabs, and we had to disable this rule to avoid being drowned in issues.

However, I'd like to add the new rules that are added to Sonar Way when a new version of Sonar or the Java plugin comes out. Currently, to achieve this we would have to compare our company's profile with Sonar Way, and manually add the new rules to our company's profile.

Do you have any suggestions to make the maintenance of our company's profile easier? It seems that being unable to disable inherited rules makes using profile inheritance unfeasible for us :(

Thanks in advance,
Daniel Serodio

G. Ann Campbell

unread,
Jul 19, 2016, 2:04:53 PM7/19/16
to Daniel Serodio, SonarQube
Hi Daniel,

First, I wasn't suggesting profile inheritance from Sonar way, but that the concept in general would be helpful to you. Re-reading Victor's initial email, I guess when he said 

 forces my team to duplicate the entire quality profile and make changes by ourselves

the profile being duplicated was Sonar way? I thought he was working from a copy of the company's profile, and my suggestion was to split the company profile into "core" and "nice to have". Leaving that aside, that initial duplication of Sonar way, rather than editing that profile directly, seems like the best way to keep life simple. You start from a core set of rules, and can then start adding and pruning. The reasons to keep Sonar way separate from your edited profile should become apparent below...

We've actually worked on how to know new rules are available in 6.0 (RC available "soon"). If you upgrade quickly, that should help some, but looking back at Victor's initial email, it seems that you're still on 4.4 (really?) so, uhm... yeah.

But there are a couple of already-available features to help with this.

First, as you alluded, do a Restore Built-in Profiles after each plugin upgrade and compare your profile to Sonar way. Assuming that your base profile isn't far off Sonar way, this won't be too bad, but yes, it's tedious.

An even better way is to use the Rules search. There's an Available Since date-based search facet, which you can use to find rules that were added in a plugin upgrade (so yes, you'll need to know approximately when the plugin was upgraded). This will show you all rules new in that version. You can combine this with the Quality Profile facet to find only the new rules that are active in Sonar way by default (assuming you've done the Restore Built-in Profiles step). Note that I don't remember which version rule search was refactored in, so these facets may or may not be available in 4.4.


HTH,
Ann



---
G. Ann CAMPBELL | SonarSource
Product Owner

--
You received this message because you are subscribed to a topic in the Google Groups "SonarQube" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/sonarqube/gtJjDZlLYow/unsubscribe.
To unsubscribe from this group and all its topics, send an email to sonarqube+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/sonarqube/1267faa7-e8c7-490a-9a56-d7f798f20bc6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages