Quantcast

RegexpSinglelineJavaCheck does not recognize "// NOSONAR"

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

RegexpSinglelineJavaCheck does not recognize "// NOSONAR"

florian.huonder
Hi all,

I have copied the RegexpSinglelineJavaCheck rule and made the following settings:

format: ^.*//.*NOSONAR\s*$
message: balbal
ignoreCase: true
minimum: 0
maximum: 0
ignoreComments: false

I want that all NOSONAR comments that have no trailing comment to be detected.
Examples:
- // NOSONAR    <- detected
- // NOSONAR  blabla <- not detected

But it does not work.
Does anybody have me a hint why this rule does not work?

Best regards,
Florian
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: RegexpSinglelineJavaCheck does not recognize "// NOSONAR"

Freddy Mallet
Hi Florian,

You must use the dedicated "Avoid use of //NOSONAR marker" to track usage of NOSONAR. Otherwise when using for instance the "RegexpSinglelineJavaCheck" as soon as you get a violation on this rule, this violation is obviously and automatically switched off by the //NOSONAR tag :

Inline image 1

-----
Sonar for Continuous Inspection



On Fri, Mar 9, 2012 at 4:34 PM, <[hidden email]> wrote:
Hi all,

I have copied the RegexpSinglelineJavaCheck rule and made the following settings:

format: ^.*//.*NOSONAR\s*$
message: balbal
ignoreCase: true
minimum: 0
maximum: 0
ignoreComments: false

I want that all NOSONAR comments that have no trailing comment to be detected.
Examples:
- // NOSONAR    <- detected
- // NOSONAR  blabla <- not detected

But it does not work.
Does anybody have me a hint why this rule does not work?

Best regards,
Florian

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Antwort: Re: [sonar-user] RegexpSinglelineJavaCheck does not recognize "// NOSONAR"

florian.huonder
Hi Freddy,
Thanks a lot, it's clear :)

Ok now, do you have an idea how I can achieve the following goal.
All //NOSONAR comments without a reason shall be detected with severity Critical and all // NOSONAR comments with a reason shall be detected with severity Info:
* cricital: if(sonar does complain) { //NOSONAR
* info: if(sonar does complain) { //NOSONAR because that and that

Any ideas?

Best regards,
Florian



Von:        Freddy Mallet <[hidden email]>
An:        [hidden email],
Datum:        11.03.2012 15:42
Betreff:        Re: [sonar-user] RegexpSinglelineJavaCheck does not recognize "// NOSONAR"




Hi Florian,

You must use the dedicated "Avoid use of //NOSONAR marker" to track usage of NOSONAR. Otherwise when using for instance the "RegexpSinglelineJavaCheck" as soon as you get a violation on this rule, this violation is obviously and automatically switched off by the //NOSONAR tag :

Inline image 1

-----
twitter.com/FreddyMallet
Sonar for Continuous Inspection



On Fri, Mar 9, 2012 at 4:34 PM, <florian.huonder@...> wrote:
Hi all,

I have copied the RegexpSinglelineJavaCheck rule and made the following settings:


format: ^.*//.*NOSONAR\s*$

message: balbal

ignoreCase: true

minimum: 0

maximum: 0

ignoreComments: false


I want that all NOSONAR comments that have no trailing comment to be detected.

Examples:

- // NOSONAR    <- detected

- // NOSONAR  blabla <- not detected


But it does not work.

Does anybody have me a hint why this rule does not work?


Best regards,

Florian


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Antwort: Re: [sonar-user] RegexpSinglelineJavaCheck does not recognize "// NOSONAR"

Freddy Mallet
Hi Florian,

Ok now, do you have an idea how I can achieve the following goal.
All //NOSONAR comments without a reason shall be detected with severity Critical and all // NOSONAR comments with a reason shall be detected with severity Info:
* cricital: if(sonar does complain) { //NOSONAR
* info: if(sonar does complain) { //NOSONAR because that and that

That's not possible to cover this use case as requested but here is another possible approach :
  • Track all new incoming usages of //NOSONAR tag with the Sonar differential view mechanism
  • Flag those violations as "False-Positive" when you think that the usage of //NOSONAR is justified. Otherwise assign the review.
Kind regards,
Freddy
 

Any ideas?

Best regards,
Florian



Von:        Freddy Mallet <[hidden email]>
An:        [hidden email],
Datum:        11.03.2012 15:42
Betreff:        Re: [sonar-user] RegexpSinglelineJavaCheck does not recognize "// NOSONAR"




Hi Florian,

You must use the dedicated "Avoid use of //NOSONAR marker" to track usage of NOSONAR. Otherwise when using for instance the "RegexpSinglelineJavaCheck" as soon as you get a violation on this rule, this violation is obviously and automatically switched off by the //NOSONAR tag :

Inline image 1

-----
twitter.com/FreddyMallet
Sonar for Continuous Inspection



On Fri, Mar 9, 2012 at 4:34 PM, <[hidden email]> wrote:
Hi all,

I have copied the RegexpSinglelineJavaCheck rule and made the following settings:


format: ^.*//.*NOSONAR\s*$

message: balbal

ignoreCase: true

minimum: 0

maximum: 0

ignoreComments: false


I want that all NOSONAR comments that have no trailing comment to be detected.

Examples:

- // NOSONAR    <- detected

- // NOSONAR  blabla <- not detected


But it does not work.

Does anybody have me a hint why this rule does not work?


Best regards,

Florian



Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Antwort: Re: [sonar-user] Antwort: Re: [sonar-user] RegexpSinglelineJavaCheck does not recognize "// NOSONAR"

florian.huonder
Hi Freddy,

Thanks for your answer.
Isn't there a possibility like copying the rule (maybe the Java-Service) and make the needed adjustments, so that I have two rules (one with reason and one without) that I can handle separately?

More context for my issue:
We configured Sonar in that way, that all Blocker-Violations lead to a breaking build. We have all rules declared as blocker that reflect our coding-guidlines. Our coding-guideline says, that a //NOSONAR comment must be reasoned.
I want to "enforce" that somehow.

Best regards,
Florian




Von:        Freddy Mallet <[hidden email]>
An:        [hidden email],
Datum:        12.03.2012 10:00
Betreff:        Re: [sonar-user] Antwort: Re: [sonar-user] RegexpSinglelineJavaCheck does not recognize "// NOSONAR"




Hi Florian,

Ok now, do you have an idea how I can achieve the following goal.
All //NOSONAR comments without a reason shall be detected with severity Critical and all // NOSONAR comments with a reason shall be detected with severity Info:

* cricital: if(sonar does complain) { //NOSONAR

* info: if(sonar does complain) { //NOSONAR because that and that


That's not possible to cover this use case as requested but here is another possible approach :
  • Track all new incoming usages of //NOSONAR tag with the Sonar differential view mechanism
  • Flag those violations as "False-Positive" when you think that the usage of //NOSONAR is justified. Otherwise assign the review.
Kind regards,
Freddy
 

Any ideas?


Best regards,

Florian




Von:        
Freddy Mallet <freddy.mallet@...>
An:        
user@...,
Datum:        
11.03.2012 15:42
Betreff:        
Re: [sonar-user] RegexpSinglelineJavaCheck does not recognize "// NOSONAR"





Hi Florian,

You must use the dedicated "Avoid use of //NOSONAR marker" to track usage of NOSONAR. Otherwise when using for instance the "RegexpSinglelineJavaCheck" as soon as you get a violation on this rule, this violation is obviously and automatically switched off by the //NOSONAR tag :

Inline image 1

-----

twitter.com/FreddyMallet
Sonar for Continuous Inspection



On Fri, Mar 9, 2012 at 4:34 PM, <
florian.huonder@...> wrote:
Hi all,


I have copied the RegexpSinglelineJavaCheck rule and made the following settings:


format: ^.*//.*NOSONAR\s*$

message: balbal

ignoreCase: true

minimum: 0

maximum: 0

ignoreComments: false


I want that all NOSONAR comments that have no trailing comment to be detected.

Examples:

- // NOSONAR    <- detected

- // NOSONAR  blabla <- not detected


But it does not work.

Does anybody have me a hint why this rule does not work?


Best regards,

Florian



Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Antwort: Re: [sonar-user] Antwort: Re: [sonar-user] RegexpSinglelineJavaCheck does not recognize "// NOSONAR"

Freddy Mallet
Hi Florian,

Thanks for your answer.
Isn't there a possibility like copying the rule (maybe the Java-Service) and make the needed adjustments, so that I have two rules (one with reason and one without) that I can handle separately?

No sorry this is not possible
 
More context for my issue:
We configured Sonar in that way, that all Blocker-Violations lead to a breaking build. We have all rules declared as blocker that reflect our coding-guidlines. Our coding-guideline says, that a //NOSONAR comment must be reasoned.
I want to "enforce" that somehow.

I see what you mean Florian but there is no way to do this out of the box. 

Kind regards,
Freddy
 

Best regards,
Florian




Von:        Freddy Mallet <[hidden email]>
An:        [hidden email],
Datum:        12.03.2012 10:00
Betreff:        Re: [sonar-user] Antwort: Re: [sonar-user] RegexpSinglelineJavaCheck does not recognize "// NOSONAR"




Hi Florian,

Ok now, do you have an idea how I can achieve the following goal.
All //NOSONAR comments without a reason shall be detected with severity Critical and all // NOSONAR comments with a reason shall be detected with severity Info:

* cricital: if(sonar does complain) { //NOSONAR

* info: if(sonar does complain) { //NOSONAR because that and that


That's not possible to cover this use case as requested but here is another possible approach :
  • Track all new incoming usages of //NOSONAR tag with the Sonar differential view mechanism
  • Flag those violations as "False-Positive" when you think that the usage of //NOSONAR is justified. Otherwise assign the review.
Kind regards,
Freddy
 

Any ideas?


Best regards,

Florian




Von:        
Freddy Mallet <[hidden email]>
An:        
[hidden email],
Datum:        
11.03.2012 15:42
Betreff:        
Re: [sonar-user] RegexpSinglelineJavaCheck does not recognize "// NOSONAR"





Hi Florian,

You must use the dedicated "Avoid use of //NOSONAR marker" to track usage of NOSONAR. Otherwise when using for instance the "RegexpSinglelineJavaCheck" as soon as you get a violation on this rule, this violation is obviously and automatically switched off by the //NOSONAR tag :

Inline image 1

-----

twitter.com/FreddyMallet
Sonar for Continuous Inspection



On Fri, Mar 9, 2012 at 4:34 PM, <
[hidden email]> wrote:
Hi all,


I have copied the RegexpSinglelineJavaCheck rule and made the following settings:


format: ^.*//.*NOSONAR\s*$

message: balbal

ignoreCase: true

minimum: 0

maximum: 0

ignoreComments: false


I want that all NOSONAR comments that have no trailing comment to be detected.

Examples:

- // NOSONAR    <- detected

- // NOSONAR  blabla <- not detected


But it does not work.

Does anybody have me a hint why this rule does not work?


Best regards,

Florian




Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Antwort: Re: [sonar-user] Antwort: Re: [sonar-user] Antwort: Re: [sonar-user] RegexpSinglelineJavaCheck does not recognize "// NOSONAR"

florian.huonder
Freddy,

Thanks. Is it maybe possible with a (custom) plugin?
Or do I need do open feature request?

Regards,
Florian



Von:        Freddy Mallet <[hidden email]>
An:        [hidden email],
Datum:        12.03.2012 15:32
Betreff:        Re: [sonar-user] Antwort: Re: [sonar-user] Antwort: Re: [sonar-user] RegexpSinglelineJavaCheck does not recognize "// NOSONAR"




Hi Florian,

Thanks for your answer.
Isn't there a possibility like copying the rule (maybe the Java-Service) and make the needed adjustments, so that I have two rules (one with reason and one without) that I can handle separately?


No sorry this is not possible
 
More context for my issue:
We configured Sonar in that way, that all Blocker-Violations lead to a breaking build. We have all rules declared as blocker that reflect our coding-guidlines. Our coding-guideline says, that a //NOSONAR comment must be reasoned.

I want to "enforce" that somehow.


I see what you mean Florian but there is no way to do this out of the box. 

Kind regards,
Freddy
 

Best regards,

Florian





Von:        
Freddy Mallet <freddy.mallet@...>
An:        
user@...,
Datum:        12.03.2012 10:00
Betreff:        
Re: [sonar-user] Antwort: Re: [sonar-user] RegexpSinglelineJavaCheck does not recognize "// NOSONAR"




Hi Florian,

Ok now, do you have an idea how I can achieve the following goal.

All //NOSONAR comments without a reason shall be detected with severity Critical and all // NOSONAR comments with a reason shall be detected with severity Info:

* cricital: if(sonar does complain) { //NOSONAR

* info: if(sonar does complain) { //NOSONAR because that and that


That's not possible to cover this use case as requested but here is another possible approach :
  • Track all new incoming usages of //NOSONAR tag with the Sonar differential view mechanism
  • Flag those violations as "False-Positive" when you think that the usage of //NOSONAR is justified. Otherwise assign the review.
Kind regards,
Freddy
 


Any ideas?


Best regards,

Florian




Von:        
Freddy Mallet <freddy.mallet@...>
An:        
user@...,
Datum:        
11.03.2012 15:42
Betreff:        
Re: [sonar-user] RegexpSinglelineJavaCheck does not recognize "// NOSONAR"





Hi Florian,

You must use the dedicated "Avoid use of //NOSONAR marker" to track usage of NOSONAR. Otherwise when using for instance the "RegexpSinglelineJavaCheck" as soon as you get a violation on this rule, this violation is obviously and automatically switched off by the //NOSONAR tag :

Inline image 1

-----

twitter.com/FreddyMallet
Sonar for Continuous Inspection



On Fri, Mar 9, 2012 at 4:34 PM, <
florian.huonder@...> wrote:
Hi all,


I have copied the RegexpSinglelineJavaCheck rule and made the following settings:


format: ^.*//.*NOSONAR\s*$

message: balbal

ignoreCase: true

minimum: 0

maximum: 0

ignoreComments: false


I want that all NOSONAR comments that have no trailing comment to be detected.

Examples:

- // NOSONAR    <- detected

- // NOSONAR  blabla <- not detected


But it does not work.

Does anybody have me a hint why this rule does not work?


Best regards,

Florian




Loading...