How to export FindBugs/PMD/Checkstyle rules from Sonar and import into Netbeans

jalsk picture jalsk · Nov 16, 2011 · Viewed 32.9k times · Source

My company has sonar set up to with various plugins (PMD, FindBugs, CheckStyle), and although it is very useful as is (it runs after every Jenkins build that was triggered by a check-in to SVN), I would like it if I could run these various plugins on my local machine before I check the code in.

We have a set of rules already set up in Sonar, so ideally I would like to be able to export that ruleset, perhaps do some munging of the data, and then import the resulting rules into my IDE (Netbeans 7.0.1) into the respective plugins. Is there any way to do this? I've searched all over and short of going through and manually adding each rule to the various plugins, there doesn't appear to be a way to do this. Is there something I'm missing?

TL;DR (Summary): I'd like to export a profile from sonar and import the rule settings into the PMD, Findbugs, and CheckStyle plugins in Netbeans.

Answer

Mark O'Connor picture Mark O'Connor · Nov 16, 2011

Each Sonar profile publishes it's Checkstyle, FIndbugs and PMD configuration under the permalinks tab.

Assuming you've got Sonar installed locally, the following link shows the configuration files used by the "Sonar Way" profile:

http://localhost:9000/profiles/permalinks/2