added a comment - - edited
Hi Freddy,
I am not sure if I understand your question correctly.
NOSONAR shall work as it does currently.
But I want to have the option to create a violation when there is a //NOSONAR without a comment.
Example:
I have a code line that create a violation, e.g. a "Non-transient non-serializable instance field in serializable class" violation on the following code line:
private Logger logger = Factory.getLogger();
Additionally I have configured a CommentPatternMatcher rule that triggers if //NOSONAR has no comment (with regular expression), as you can see in the mailing list I added in the description.
Now what I want is that I can write
private Logger logger = Factory.getLogger(); // NOSONAR
and the violation "Non-transient non-serializable instance field in serializable class" does no longer occur.
But then I want in this case that the violation triggered by the NOSONAR-CommentPatternMatcher rule pops up.
The NOSONAR tags shall still be counted (e.g. for the taglist plugin).
If a developer writes
private Logger logger = Factory.getLogger(); // NOSONAR because that and that
the violation "Non-transient non-serializable instance field in serializable class" does no longer occur. And neither shall the NOSONAR-CommentPatternMatcher rule pop up. The NOSONAR tags shall still be counted (e.g. for the taglist plugin).
In our company we have the following Sonar-Setting:
All coding-guidelines have the severity BLOCKER and we have an alert that is "ERROR when >0 BLOCKER". Additionally we have the BuildBreakerPlugin that lets our Maven-Build fail when Errors are present.
This means I want to "force" our developers to comment (to reason) when they use NOSONAR, it shall be prohibited to use //NOSONAR without a reason.
I hope it is more clear now.
Regards,
Florian
If my understanding is correct, what you want it just to extend the existing "Avoid use of //NOSONAR marker" rule to add a new optional parameter in order to generate a violation only when there isn't any comment after the NOSONAR tag ?