« Return to Thread: PMD customs rules and sonar.rules.extensionsPath

Re: Re: PMD customs rules and sonar.rules.extensionsPath

by Freddy Mallet :: Rate this Message:

Reply to Author | View in Thread

Hello Henri,

Sorry for this very late answer.

By default, your own new rules are inactive on all quality profiles. Moreover when you use the rule engine web interface to see which rules are associated to a given quality profile, the check box "Inactive" is unchecked. Perhaps your issue just relates to the need to activate this check box ?

Hope it helps
Freddy



On Wed, Jun 3, 2009 at 6:03 PM, Henri Gomez <henri.gomez@...> wrote:
More on this one.

I created a jar file containing the PMD rules and a rule file
referencing the PMD rules.

/home/sonar/extensions/rules/pmd/rule1.xml
/home/sonar/extensions/rules/pmd/rule1.jar


rule1.xml :

<rules>
 <rule key="DoNotUseAServiceInsideItsServiceImplementation">
   <name>Do Not Use A Service Inside Its Service Implementation</name>
   <configKey>rulesets/extensions.xml/DoNotUseAServiceInsideItsServiceImplementation</configKey>
   <category name="Usability"/>
   <description>Using a service inside a service is forbidden outside
of the packages service and tests. Otherwise it introduces a strong
coupling between the interface of the service a
nd its implementation</description>
 </rule>
 <rule key="DoNotUseABeanInsideItsServiceImplementation">
   <name>Do Not Use A Bean Inside Its Service Implementation</name>
   <configKey>rulesets/extensions.xml/DoNotUseABeanInsideItsServiceImplementation</configKey>
   <category name="Usability"/>
   <description>Using a bean inside a service is forbidden outside of
the packages service, bean and tests. Otherwise it introduces a strong
coupling between the interface of the servic
e and its implementation</description>
 </rule>
 </rules>


rule1.jar :

rulesets/
rulesets/extensions.xml

Sonar start but I couldn't see the 'new rules' in the PMD rules.

Did something should be done to activate these new rules ?


2009/6/3 Henri Gomez <henri.gomez@...>:
> Hi to all,
>
> I tried to add a new PMD rule to our sonar 1.9 instance (embedded in a
> Tomcat 6).
>
> - stop Tomcat
>
> - edit the /home/sonar/tomcat6/webapps/sonar/WEB-INF/classes/sonar.properties
> and add this line :
>
> sonar.rules.extensionsPath: /home/sonar/extensions
>
> - created /home/sonar/extensions/rules/pmd/
>
> - copied a simple XPath rule (a simple xml file) and copied to
> /home/sonar/extensions/rules/pmd/
>
> - restart Tomcat
>
>
> I got the following error preventing sonar to start :
>
> 2009.06.03 17:03:19 INFO  org.sonar.INFO  loading pmd rules...
> 2009.06.03 17:03:20 INFO  org.sonar.INFO  loading pmd extensions...
> 3 juin 2009 17:03:33 org.apache.catalina.core.StandardContext start
> SEVERE: Error listenerStart
> 3 juin 2009 17:03:33 org.apache.catalina.core.StandardContext start
> SEVERE: Erreur de d???marrage du contexte [/sonar] suite aux erreurs
> pr???c???dentes
>
> If i remove the xml file from  /home/sonar/extensions/rules/pmd/,
> sonar just start normally.
>
> How could I set the log level to verbose to see what could be wrong
> since the xml rule is used under Eclipse/PMD and works fine.
>
> Regards
>

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

   http://xircles.codehaus.org/manage_email



 « Return to Thread: PMD customs rules and sonar.rules.extensionsPath