Search code examples
groovysonarqubecodenarc

How to Add CodeNarc Rules to Sonar Groovy Plugin


CodeNarc has 346 rules, but the Sonar Groovy plugin (which utilizes CodeNarc) only uses 59 of those rules.

I need to add more rules in Sonar to the Groovy analysis. How can I do this?

Thanks


Solution

  • I think you are talking about the default quality profile of the Sonar Groovy Plugin which indeed activate only 59 rules by default (as you can see on nemo (public instance of SonarQube analyzing open source projects))

    The other rules of CodeNarc would be available in the rules section. You can see them by filtering by language and rule repository : http://nemo.sonarqube.org/coding_rules#languages=grvy|repositories=grvy

    To use them you need to activate those rules in a quality profile and set it for your project : see the documentation of quality profile for this.