[sonar-dev] Params on custom template Rule

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

[sonar-dev] Params on custom template Rule

Juan Ignacio Barisich
The problem is, at the rule repository class https://github.com/SonarSource/sonar-examples/blob/master/plugins/java-custom-rules/src/main/java/org/sonar/samples/java/JavaExtensionRulesRepository.java on method createJavaFileScanners. This method creates a new empty instance of the rule (new ExampleCheck()) and the params are ignored (they keep in null). The same occurs with the rule templates, I mean, only one instance of the rule is created, even if there are more instances created (throw the Sonarqube UI).

So, ¿Is there an example to create a custom template rule with params?

Thanks you

Best regards.

Reply | Threaded
Open this post in threaded view
|

Re: [sonar-dev] Params on custom template Rule

Simon Brandhof
Hi,

I updated the sample with :
Regards


Simon BRANDHOF | SonarSource
http://twitter.com/SimonBrandhof

On 30 December 2014 at 16:00, Juan Ignacio Barisich <[hidden email]> wrote:
The problem is, at the rule repository class https://github.com/SonarSource/sonar-examples/blob/master/plugins/java-custom-rules/src/main/java/org/sonar/samples/java/JavaExtensionRulesRepository.java on method createJavaFileScanners. This method creates a new empty instance of the rule (new ExampleCheck()) and the params are ignored (they keep in null). The same occurs with the rule templates, I mean, only one instance of the rule is created, even if there are more instances created (throw the Sonarqube UI).

So, ¿Is there an example to create a custom template rule with params?

Thanks you

Best regards.


Reply | Threaded
Open this post in threaded view
|

Re: [sonar-dev] Params on custom template Rule

Simon Brandhof
Reply | Threaded
Open this post in threaded view
|

Re: [sonar-dev] Params on custom template Rule

Juan Ignacio Barisich
Great work Simon!
Thanks you very much.

Regards