Improvement : NO [SONAR|PMD|CHECKSTYLE] authorized if commented

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

Improvement : NO [SONAR|PMD|CHECKSTYLE] authorized if commented

Alix LOURME

Hi,

 

When you are using some rules parser, you must not (as far it can) switch off some violations.

But there isn't any real project where you haven't to switch off some (justified) cases.

In this case, you can consider that comment this switch off is mandatory.

 

Currently squid rule exist to check the switch off:

-          squid:S1315       “CHECKSTYLE:OFF" suppression comments should not be used”

-          squid:S1310       “NOPMD" suppression comments should not be used”

-          squid:NoSonar “NOSONAR" marker should not be used to switch-off issues”

 

But there is no way (with squid) to authorize the switch off with a comment (in the code) …

 

This feature could be done with checkstyle:com.puppycrawl.tools.checkstyle.checks.regexp.RegexpSinglelineCheck ; but if you want use only squid (as many threads promote in on ML), no way todo it …

 

Could this feature feasible with squid in the future ?

-          IMO : Current rule could be

o   (\s) added to end of pattern

o   Suffix added for name : “without justification”

o   Compliant solution snipet with a comment

Or

-          3 new rules (same as current with previous improvement)

Or

-          A “squid:regexp” extensible rule, to configure case user wants

 

Thanks in advance.

Best Regrads.

Alix.

Reply | Threaded
Open this post in threaded view
|

Re: Improvement : NO [SONAR|PMD|CHECKSTYLE] authorized if commented

Nicolas Peru
Hi Alix, 

There is also another solution : 
Is there a reason why the handling of false positive issue in certain context could not be handled directly in the platform by setting the status of the issue to false positive ? 

This way, no need to clutter your code with comments dedicated to some tools. 

Cheers,



Nicolas PERU | SonarSource
Senior Developer
http://sonarsource.com


2015-05-21 11:37 GMT+02:00 ALIX LOURME <[hidden email]>:

Hi,

 

When you are using some rules parser, you must not (as far it can) switch off some violations.

But there isn't any real project where you haven't to switch off some (justified) cases.

In this case, you can consider that comment this switch off is mandatory.

 

Currently squid rule exist to check the switch off:

-          squid:S1315       “CHECKSTYLE:OFF" suppression comments should not be used”

-          squid:S1310       “NOPMD" suppression comments should not be used”

-          squid:NoSonar “NOSONAR" marker should not be used to switch-off issues”

 

But there is no way (with squid) to authorize the switch off with a comment (in the code) …

 

This feature could be done with checkstyle:com.puppycrawl.tools.checkstyle.checks.regexp.RegexpSinglelineCheck ; but if you want use only squid (as many threads promote in on ML), no way todo it …

 

Could this feature feasible with squid in the future ?

-          IMO : Current rule could be

o   (\s) added to end of pattern

o   Suffix added for name : “without justification”

o   Compliant solution snipet with a comment

Or

-          3 new rules (same as current with previous improvement)

Or

-          A “squid:regexp” extensible rule, to configure case user wants

 

Thanks in advance.

Best Regrads.

Alix.


Reply | Threaded
Open this post in threaded view
|

RE: Improvement : NO [SONAR|PMD|CHECKSTYLE] authorized if commented

Alix LOURME

Hi Nicolas,

 

Yes of course ... but if you are using multiple SonarQube platform or branch process (for multi-profiles) or on some legacy code (with switch off commented), this false positive tag is required each time.

=> Having the feature in the code is (IMO) a value added.

 

My purpose is on the rule behavior ... because if I was the devil's advocate, why these 3 rules exist … the false positive tag process in the platform could be used ;-).

 

Best regards.

De : Nicolas Peru [mailto:[hidden email]]
Envoyé : jeudi 21 mai 2015 11:47
À : [hidden email]
Objet : Re: [sonar-user] Improvement : NO [SONAR|PMD|CHECKSTYLE] authorized if commented

 

Hi Alix, 

 

There is also another solution : 

Is there a reason why the handling of false positive issue in certain context could not be handled directly in the platform by setting the status of the issue to false positive ? 

 

This way, no need to clutter your code with comments dedicated to some tools. 

 

Cheers,

 

 


Nicolas PERU | SonarSource

Senior Developer
http://sonarsource.com

 

 

2015-05-21 11:37 GMT+02:00 ALIX LOURME <[hidden email]>:

Hi,

 

When you are using some rules parser, you must not (as far it can) switch off some violations.

But there isn't any real project where you haven't to switch off some (justified) cases.

In this case, you can consider that comment this switch off is mandatory.

 

Currently squid rule exist to check the switch off:

-          squid:S1315       “CHECKSTYLE:OFF" suppression comments should not be used”

-          squid:S1310       “NOPMD" suppression comments should not be used”

-          squid:NoSonar “NOSONAR" marker should not be used to switch-off issues”

 

But there is no way (with squid) to authorize the switch off with a comment (in the code) …

 

This feature could be done with checkstyle:com.puppycrawl.tools.checkstyle.checks.regexp.RegexpSinglelineCheck ; but if you want use only squid (as many threads promote in on ML), no way todo it …

 

Could this feature feasible with squid in the future ?

-          IMO : Current rule could be

o   (\s) added to end of pattern

o   Suffix added for name : “without justification”

o   Compliant solution snipet with a comment

Or

-          3 new rules (same as current with previous improvement)

Or

-          A “squid:regexp” extensible rule, to configure case user wants

 

Thanks in advance.

Best Regrads.

Alix.

 

Reply | Threaded
Open this post in threaded view
|

Re: Improvement : NO [SONAR|PMD|CHECKSTYLE] authorized if commented

David RACODON
In reply to this post by Nicolas Peru
Hi,

We'd really like to not clutter our code with NOSONAR tags. But SonarQube does not support branching. So, there's no other solution
Regards,

David RACODON
Freelance QA Consultant

On Thu, May 21, 2015 at 11:47 AM, Nicolas Peru <[hidden email]> wrote:
Hi Alix, 

There is also another solution : 
Is there a reason why the handling of false positive issue in certain context could not be handled directly in the platform by setting the status of the issue to false positive ? 

This way, no need to clutter your code with comments dedicated to some tools. 

Cheers,



Nicolas PERU | SonarSource
Senior Developer
http://sonarsource.com


2015-05-21 11:37 GMT+02:00 ALIX LOURME <[hidden email]>:

Hi,

 

When you are using some rules parser, you must not (as far it can) switch off some violations.

But there isn't any real project where you haven't to switch off some (justified) cases.

In this case, you can consider that comment this switch off is mandatory.

 

Currently squid rule exist to check the switch off:

-          squid:S1315       “CHECKSTYLE:OFF" suppression comments should not be used”

-          squid:S1310       “NOPMD" suppression comments should not be used”

-          squid:NoSonar “NOSONAR" marker should not be used to switch-off issues”

 

But there is no way (with squid) to authorize the switch off with a comment (in the code) …

 

This feature could be done with checkstyle:com.puppycrawl.tools.checkstyle.checks.regexp.RegexpSinglelineCheck ; but if you want use only squid (as many threads promote in on ML), no way todo it …

 

Could this feature feasible with squid in the future ?

-          IMO : Current rule could be

o   (\s) added to end of pattern

o   Suffix added for name : “without justification”

o   Compliant solution snipet with a comment

Or

-          3 new rules (same as current with previous improvement)

Or

-          A “squid:regexp” extensible rule, to configure case user wants

 

Thanks in advance.

Best Regrads.

Alix.