Extending the web plug in with new rules

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

Extending the web plug in with new rules

mattadamson

Team,

 

Is it possible to extend the web plug in with new custom rules as per our application requirements? E.g. if certain HTML / JSP attributes are used the required values? Or perhaps limiting the attributes that are valid? I couldn’t see an XPath rule nor a regular expression custom rule

 

Thanks

 

Matt

Reply | Threaded
Open this post in threaded view
|

Re: Extending the web plug in with new rules

Dinesh Bolkensteyn-2
Hi Matthew,

Technically it's definitely possible to implement your own rules: The plugin is open source and so you could make your own build with your custom rules added.

There are also a few 'generic' rules which can be configured to do what you want: 'Child Element Illegal', 'Child Element Required', 'Element Required'. Their drawback is that they are bit too generic, the description and issue message will not tell developers *why* there is a problem nor what corrective action to take.

If the rules you wish to implement can be valuable to all the users of the Web plugin, then feel free to suggest them, or even better make a pull request.

Kind regards,



On Wed, Aug 7, 2013 at 12:46 AM, Adamson, Matthew <[hidden email]> wrote:

Team,

 

Is it possible to extend the web plug in with new custom rules as per our application requirements? E.g. if certain HTML / JSP attributes are used the required values? Or perhaps limiting the attributes that are valid? I couldn’t see an XPath rule nor a regular expression custom rule

 

Thanks

 

Matt


Reply | Threaded
Open this post in threaded view
|

RE: Extending the web plug in with new rules

mattadamson

Thanks Dinesh,

 

I’m quite compelled to try and create a custom rule myself within this plug in as a learning exercise then I can share my findings with the group.  Do I simply need to modify the source to add the new rule, re build jar and overlay back into the extensions folder?

 

From: Dinesh Bolkensteyn [mailto:[hidden email]]
Sent: Wednesday, August 07, 2013 7:00 AM
To: [hidden email]
Subject: Re: [sonar-user] Extending the web plug in with new rules

 

Hi Matthew,

 

Technically it's definitely possible to implement your own rules: The plugin is open source and so you could make your own build with your custom rules added.

 

There are also a few 'generic' rules which can be configured to do what you want: 'Child Element Illegal', 'Child Element Required', 'Element Required'. Their drawback is that they are bit too generic, the description and issue message will not tell developers *why* there is a problem nor what corrective action to take.

 

If the rules you wish to implement can be valuable to all the users of the Web plugin, then feel free to suggest them, or even better make a pull request.

 

Kind regards,


 

On Wed, Aug 7, 2013 at 12:46 AM, Adamson, Matthew <[hidden email]> wrote:

Team,

 

Is it possible to extend the web plug in with new custom rules as per our application requirements? E.g. if certain HTML / JSP attributes are used the required values? Or perhaps limiting the attributes that are valid? I couldn’t see an XPath rule nor a regular expression custom rule

 

Thanks

 

Matt

 

Reply | Threaded
Open this post in threaded view
|

Re: Extending the web plug in with new rules

Dinesh Bolkensteyn-2
Yep, that's it.

Have a look at this commit for example which adds a new rule to the Web plugin:



On Wed, Aug 7, 2013 at 8:04 AM, Adamson, Matthew <[hidden email]> wrote:

Thanks Dinesh,

 

I’m quite compelled to try and create a custom rule myself within this plug in as a learning exercise then I can share my findings with the group.  Do I simply need to modify the source to add the new rule, re build jar and overlay back into the extensions folder?

 

From: Dinesh Bolkensteyn [mailto:[hidden email]]
Sent: Wednesday, August 07, 2013 7:00 AM
To: [hidden email]
Subject: Re: [sonar-user] Extending the web plug in with new rules

 

Hi Matthew,

 

Technically it's definitely possible to implement your own rules: The plugin is open source and so you could make your own build with your custom rules added.

 

There are also a few 'generic' rules which can be configured to do what you want: 'Child Element Illegal', 'Child Element Required', 'Element Required'. Their drawback is that they are bit too generic, the description and issue message will not tell developers *why* there is a problem nor what corrective action to take.

 

If the rules you wish to implement can be valuable to all the users of the Web plugin, then feel free to suggest them, or even better make a pull request.

 

Kind regards,


 

On Wed, Aug 7, 2013 at 12:46 AM, Adamson, Matthew <[hidden email]> wrote:

Team,

 

Is it possible to extend the web plug in with new custom rules as per our application requirements? E.g. if certain HTML / JSP attributes are used the required values? Or perhaps limiting the attributes that are valid? I couldn’t see an XPath rule nor a regular expression custom rule

 

Thanks

 

Matt