Details
Description
The sonar web frontend lacks an option to set the tabWidth property for checkstyle.
Thus if you use the sonar generated checkstyle-rules with eclipse and have eclipse set to an tabwidth other than 8 (lets say 4) you will get prompted from checkstyle in eclipse that a line is too long for printing if it is (deeply) indented. The eclipse formatter calculates with ts=4 and won't split the lines up. The checkstyle format checker calculates with ts=8 and thus hits the maximum line length before eclipse does.
The exported checkstyle.xml should be looking like this:
---- 8< ----
Index: checkstyle.xml
===================================================================
— checkstyle.xml (revision 15445)
+++ checkstyle.xml (working copy)
@@ -6,6 +6,7 @@
<property name="fileExtensions" value="properties"/>
</module>
<module name="TreeWalker">
+ <property name="tabWidth" value="4"/>
<module name="ParenPad">
<property name="severity" value="warning"/>
<property name="tokens" value="CTOR_CALL,LPAREN,METHOD_CALL,RPAREN,SUPER_CTOR_CALL"/>
---- 8< ----
Maybe this feature already implemented in a higher version of sonar?
Is there an option to enable the export of tabWidth=4 without GUI in Sonar?
This is my patch for 1_3RC1. This is useful if you start with sonar from scratch, i.e. your database is empty.
Apply
patch -p0 <003_populate_database.rb.patch
when you are in the sonar root directory.