Eiden Eiden
Eiden Eiden

Reputation: 87

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!

Upvotes: 4

Views: 7312

Answers (1)

Elena Vilchik
Elena Vilchik

Reputation: 1090

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.

Upvotes: 4

Related Questions