Disable NOSONAR comment

Hello,

Is there any way to disable the NOSONAR comment?
I don’t want the developers to use this comment to bypass the Sonar scan. I want to manage all issues/bugs on the sonar dashboard.

Hi,

yes, use the java:NoSonar Track uses of "NOSONAR" comments rule.

Gilbert

Thank you @Rebse .Could you share more details about the way to use it?
Should I use the NoSonarCheck to overwrite the NoSonar rule?

In fact, as Sonarqube admin you need to activate two rules.

  1. java:NoSonar ‘Track uses of “NOSONAR” comments’
    to prevent the use of //NOSONAR for hiding issues
    call https://$yoursonarhost/coding_rules?open=java%3ANoSonar&rule_key=java%3ANoSonar
    for activation

  1. java:S1309 ‘Track uses of “@SuppressWarnings” annotations’
    with an appropriate whitelist to prevent some clever developers
    using @SuppressWarnings("all") in all their classes
    see documentation => Java

call https://$yoursonarhost/coding_rules?open=java%3AS1309&rule_key=java%3AS1309
for activation and configuration of the whitelist

1 Like

thank you @Rebse . It works

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.