29

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.

4

4 に答える 4

28

各 Sonar プロファイルは、 Permalinksタブの下に Checkstyle、FIndbugs、および PMD 構成を公開します。

Sonar がローカルにインストールされていると仮定すると、次のリンクは「Sonar Way」プロファイルで使用される構成ファイルを示しています。

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

于 2011-11-16T21:02:42.173 に答える
10

独自のSonarインストールは必要ありません。SonarのNemoサイトから、Sonarの組み込み品質プロファイルの構成を取得できます。

約12のJava品質プロファイルがあります。一般的に使用されるプロファイル(Findbugsを使用したSonarの方法)は、次の場所で入手できます。

http://nemo.sonarsource.org/rules_configuration/index/135

最初のプロファイルビューには、すべてのルールが一覧表示されます。そのビューで「ダウンロード」リンクを使用しないでください。これにより、すべてのツールでマージされたルールのCSVリストが表示されます。レビューには役立ちますが、求めているものではありません。

ツール固有の構成をエクスポートするには、[パーマリンク]タブ/ビューを選択します。これらのリンクは、各ツールで期待される形式で構成ファイルを返します。たとえば、FindBugsXML構成ファイルのリンクは次のとおりです。

http://nemo.sonarsource.org/profiles/export?format=findbugs&language=java&name=Sonar%2520way%2520with%2520Findbugs

于 2012-11-21T20:11:04.837 に答える
0

別の簡単なメカニズムを使用することです: プロファイルのバックアップ/復元 参照: http://docs.sonarqube.org/display/SONAR/Profile+Existence+Edits インスタンス (ソース)

からバックアップを取得すると、backup.xml ファイルが得られます。ローカルマシンで、次に別のインスタンス(宛先)で復元できます。

于 2015-07-09T10:16:15.490 に答える