For the complete documentation index, see llms.txt. This page is also available as Markdown.

Tracking in-line suppression comments

How to track the use of in-line suppression comments in the code.

Note: For C, C++, and Objective-C, we recommend using sonar-resolve to resolve issues directly in the code rather than suppressing them with //NOSONAR. See Resolving issues in the code for more information.

Issue suppression on a specific line is possible in most languages by using the //NOSONAR comment or a comparable in-line suppression mechanism suited to the language.

To track the use of in-line suppression comments:

  • For C, C++, Objective-C, PHP, T-SQL:

    • Use the rule NoSonar to track the use of the NOSONAR comment.

  • For COBOL, PL/SQL:

    • Use the rule NoSonarCheck to track the use of the NOSONAR comment.

  • For JavaScript, TypeScript:

    • Use the rule S1291 to track the use of the NOSONAR comment.

  • For Java:

    • Use the rule S1309 to track the use of the @SuppressWarnings annotation.

  • For Python:

    • Use the rule S1291 to track the use of the NOSONAR comment.

    • Use the rule S1309 to track the use of the noqa comment.

    • Use the rule S7632 to detect malformed NOSONAR and noqa comments.

For more information about the in-line suppression of issues for a given language, refer to the corresponding section in Languages .

Last updated

Was this helpful?