0

I'm trying to create a quality profile in Sonar 3.0.1 and to specify my pmd configuration file. But when I submit it, I've got the following error :

A PMD rule without 'ref' attribute can't be imported. see 'null'

Here the content of my extension file (sample taken at Sonar site) :

<rules>
  <rule key="AvoidIfWithoutBrace">
    <name>Avoid if without using brace</name>
    <configKey>rulesets/extensions.xml/AvoidIfWithoutBrace</configKey>
    <category name="Usability" />
    <description>éviter les if sans crochet.</description>
  </rule>
</rules>

Despite my search, I didn't find the reason of this error.

Thanks for your help.

1 Answers1

0

You're mixing concepts.

If you create a profile from the Web UI (see the documentation), then you need to specify a PMD file, i.e. a file with the PMD format that looks like this:

<ruleset>
  <rule ref="rulesets/design.xml/SingularField">
    <priority>4</priority>
  </rule>
  ...
</ruleset>

What you're currently giving to Sonar is a file with the Sonar format (which is the format that you can use to backup/restore full quality profiles).

  • But I don't understand the difference between in the GUI creating a profile and setting an pmd configuration file referencing rules, and putting in /extensions/rules/pmd directory a sonar extension file (like the one I described above) + a jar embedding rules. – mel bouille Jun 12 '12 at 14:23
  • finally it's ok, sorry for my last comment. – mel bouille Jun 12 '12 at 14:31