Sonar ignore issues by block not working

  • ALM used: GitHub
  • CI system used: Circle CI
  • Scanner command used: sonar-scanner
  • Languages of the repository: C++
  • Error observed: no error is given, sonar just continues to scan the ignore issue block as if the regex isn’t there
  • Steps to reproduce: run scanner
  • Potential workaround: not clear

Per the title, sonarcloud’s ignore issues in blocks feature is not working as expected. Our beginning regex is \/\/ @SONAR_STOP@ and the end regex is \/\/ @SONAR_START@. We would like to use these tags in order to ignore a block of code that uses a third party library, however all the code between the comments // @SONAR_STOP and // @SONAR_START@ is still being scanned. We have also tried using SONAR_STOP, SONAR_START, @SONAR_STOP@, and @SONAR_START@ as tags based on various other forum responses on the issue, however none have worked.

Hi Jtbaird,

I just tested those regexes on a sample project and they do work correctly.

Please confirm that your Analysis Scope settings look like this:

And that you are indeed using the delimiters in the correct order. i.e.,

// @SONAR_STOP@
code to ignore
// @SONAR_START@