# NOSONAR not working in vscode sonarlint

Please provide

  • Operating system: macOS Monterey version 12.3.1
  • IDE name and flavor/env: vscode version 1.68.0 Python env
  • SonarLint plugin version: v3.5.4
  • Is connected mode used:
    • Connected to SonarCloud or SonarQube (and which version): SonarCloud online

And a thorough description of the problem / question:

Hi there! All of the sudden, my intentional # NOSONAR warning ignores are not working using sonarlint extension in vscode. For some of our use cases, we like to ignore some warnings by line. What I mean by it’s not working, I am receiving the error warnings in my Problems tab in vscode as if # NOSONAR was not applied. No settings have been changed. Any help would be appreciated.

Hello, welcome to the community! And thank you for reporting this behavior.

I managed to reproduce this issue, although not for all rules. E.g with the following:

#!/usr/bin/env python3

import sys

# Line below raises python:S1186 which is correctly suppressed
def myfunction(): # NOSONAR
  pass

def main(*args):
  x = args[0]
  cond = args[1]
  # Line below raises python:S3358 and python:S3923 which are _not_ suppressed
  a = (1 if x else 1) if cond else 1 # NOSONAR
  print(a)


if __name__ == '__main__':
  main(*sys.argv)

We are going to investigate this behavior with the analyzer team and will keep this thread updated.

3 Likes

Hi @marcisprouse ,

Thanks a lot for reporting this regression.
The following ticket has been created: SONARPY-1046.

The fix is expected to be deployed in SonarCloud in the following days.

3 Likes