sonarqubesonarjs

How to disable a rule for a variable


I am a new user of sonarQube. I installed the 6.3 version and analyzed old projects that we use in our group. We have a variable named ourProduct that is existing in all the projects (and we will still used for future projects.

But when I analyze the projects on my local machine, I get this error

"ourProduct" does not exist. Change its name or declare it so that its usage doesn't result in a "ReferenceError".

Is there a solution to disable this rule for this variable for all the projects (previous and future ones)?

Should I make an exclusion for this variable or write a new rule? And how do I do that?


Solution

  • Go to Administration > JavaScript > Global variables and add ourProduct to the list of global variables. That tells the SonarJS analyzer that ourProduct is defined but the definition is outside the current file.