Uploaded image for project: 'SonarQube'
  1. SonarQube
  2. SONAR-2924

Support for custom checkstyle FileSetChecks

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Minor
    • Resolution: Won't Fix
    • Affects Version/s: 2.11
    • Fix Version/s: None
    • Component/s: None
    • Environment:
      Software platform

      Description

      Sonar doesn't support custom (self-written) fileset checks so far. The following improvement should be added to Sonar:

      1. Create and import into Sonar a checkstyle configuration containing a self-written fileset check (com.foo.MyFileSetCheck in this example):

      <module name="Checker">
      <!-- Self-written checks -->
      <module name="com.foo.MyFileSetCheck">
      <module name="com.foo.MyCheck" />
      </module>
      <!-- ... -->
      </module>

      2. Put a jar file with the compiled MyFileSetCheck and MyCheck in the "sonar-x.y\extensions\rules\checkstyle" directory.

      3. Create an XML rules file as described in http://docs.codehaus.org/display/SONAR/Quality+profiles#Qualityprofiles-Checkstyle and put it in the "sonar-x.y\extensions\rules\checkstyle directory":

      <rules>
      <rule key="com.foo.MyCheck">
      <name>Foo check</name>

      <configKey>Checker/com.foo.MyFileSetCheck/com.foo.MyCheck</configKey>
      <category name="Maintainability"/>

      <description><![CDATA[Description]]></description>
      </rule>
      </rules>

      4. After sonar restart, the checkstyle configuration file downloaded from the Sonar server by goal sonar:sonar should look as follows:

      <module name="Checker">
      <module name="com.foo.MyFileSetCheck">
      <module name="com.foo.MyCheck">
      <property name="severity" value="warning" />
      </module>
      </module>
      <!-- More modules -->
      </module>

        Attachments

          Activity

            People

            Assignee:
            Unassigned Unassigned
            Reporter:
            ulrich Ulrich Poppe
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: