|
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 |
|
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 :
![]() -----
Sonar for Continuous Inspection
On Fri, Mar 9, 2012 at 4:34 PM, <[hidden email]> wrote: Hi all, |
|
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 : ----- 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 |
|
Hi Florian,
Ok now, do you have an idea how I can achieve the following goal. That's not possible to cover this use case as requested but here is another possible approach :
Kind regards, Freddy
|
|
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 :
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 : ----- 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 |
|
Hi Florian,
Thanks for your answer. No sorry this is not possible More context for my issue: I see what you mean Florian but there is no way to do this out of the box. Kind regards, Freddy Datum: 12.03.2012 10:00 |
|
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 :
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 : ----- 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 |
| Powered by Nabble | Edit this page |
