I’m using SonarQube Developer EditionVersion 9.6.1 (build 59531) in a Docker container
and am scanning a JavaScript file.
In this file, I have a variable declaration as follows:
var showBrowserButtonNavigationWarning = true;
and it is being used in some functions:
function allowBrowserButtonNavigation(event) {
showBrowserButtonNavigationWarning = false;
}
function blockBrowserButtonNavigation() {
showBrowserButtonNavigationWarning = true;
}
SQ reports a violation of rule javascript:S3504
But in this location it should be a var.
I tried to suppress this rule by adding the lines:
@ SuppressWarnings(“javascript:S3504”)
// 3504: Unexpected var, use let or const instead.
and the line:
//noinspection SonarLint/javascript:S3504
but both are not working.
How can I tell SQ to not report this ‘violation’?
Kind regards,
Rob