Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to surpress SonarQube JavaScript issues

module.exports = function (grunt) { // NOSONAR

grunt.initConfig({

Unfortunately Sonar detects a false positive when it comes to certain functions like this one (or AMD module definitions).

The rule in question is: "Functions should not have too many lines"

The // NOSONAR or //NOSONAR approach does not work for some reason.

Can somebody provide me with a valid work-around? This rule cannot be deactivated on a file-to-file bases since it is triggered for all AMD modules as well.

SonarQube version: 3.7.4 - Sonar-Runner: 2.4

Thank you!

like image 367
Eiden Eiden Avatar asked Sep 06 '25 16:09

Eiden Eiden


1 Answers

Javascript plugin provides "NOSONAR" mechanism since 2.2 version (see https://jira.sonarsource.com/browse/SONARJS-294).

And since v2.6 there is improvement of this rule "Functions should not have too many lines" to ignore AMD pattern (see https://jira.sonarsource.com/browse/SONARJS-404)

So update of Javascript plugin should work.

like image 141
Elena Vilchik Avatar answered Sep 09 '25 06:09

Elena Vilchik