2

I would like to disable a block of code(say a function) in a file for analysis by SonarQube... Any suggestions on how to do that..

I found something for java here --> Turning Sonar off for certain code

Community
  • 1
  • 1
computnik
  • 247
  • 1
  • 3
  • 15

2 Answers2

5

As far as I know Sonar respects // NOSONAR tag for Java projects but it looks like that is also has been implemented for JS: https://jira.sonarsource.com/browse/SONARJS-294

Rafal Wiliński
  • 2,036
  • 1
  • 19
  • 26
  • 7
    Apologies for such delay. `// NOSONAR` works for a single line, is there something for a block of code? like a function, or if-else-if block. – computnik Feb 27 '17 at 04:28
4

SonarQube provides plenty of options for ignoring issues in specific files and/or code blocks, see Narrowing the Focus documentation (and to your specific case: look for Ignore Issues in Blocks).

Jan P
  • 716
  • 5
  • 25
Nicolas B.
  • 6,979
  • 15
  • 29