Does //NOSONAR work on javascript files?

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Does //NOSONAR work on javascript files?

Andrew Reedick

Does the “//NOSONAR” tag work with javascript files i.e. does the JavaScript plugin respect the tag?  (JavaScript 1.6)

 

 

Reply | Threaded
Open this post in threaded view
|

Re: Does //NOSONAR work on javascript files?

Linda Martin
Hi Andrew,

Yes the JavaScript plugin is suppose to respect the tag "// NOSONAR". 
Have you encountered a problem with it ?

Best regards,

-- 
Linda.

On 5 September 2014 16:18, Andrew Reedick <[hidden email]> wrote:

Does the “//NOSONAR” tag work with javascript files i.e. does the JavaScript plugin respect the tag?  (JavaScript 1.6)

 

 


Reply | Threaded
Open this post in threaded view
|

RE: Does //NOSONAR work on javascript files?

Andrew Reedick

I think my problem is that the “//NOSONAR” is not at the end of the code statement (as opposed to the “end of the line” as per the documentation:  http://docs.codehaus.org/display/SONAR/Frequently+Asked+Questions#FrequentlyAskedQuestions-NOSONAR)

 

The following snippets are not respecting the //NOSONAR tag:

 

Rule:  javascript:S138

(function ($) { //NOSONAR Functions should not have too many lines

 

Rule: javascript:S1067

          options = $.extend({}, $.Autocompleter.defaults, { //NOSONAR Expressions should not be too complex

                url: isUrl ? urlOrData : null,

                data: isUrl ? null : urlOrData,

                delay: isUrl ? $.Autocompleter.defaults.delay : 10,

                max: options && !options.scroll ? 10 : 150

            }, options);

 

Supposedly, the tags worked previously i.e. the tag worked in a Sonar server that was set up and maintained by a small Development group (pre 4.x?), but the tag has now stopped working in our official/prod sonar server (Sonar 4.3 and the Javascript 1.6 plugin. )  Needless to say, “it worked in Dev when Dev configured it” isn’t the best help when troubleshooting.

 

For the latter case, I’m thinking that the NOSONAR tag should go after the last line, e.g. “} , options); //NOSONAR”

 

For the former case, I get the impression that the tag isn’t going to work for an entire function by design (which is a good thing.)  What is the proper method of ignoring a S138 error for functions with too many lines?

 

 

 

From: Linda Martin [mailto:[hidden email]]
Sent: Monday, September 08, 2014 11:38 AM
To: [hidden email]
Subject: Re: [sonar-user] Does //NOSONAR work on javascript files?

 

Hi Andrew,

 

Yes the JavaScript plugin is suppose to respect the tag "// NOSONAR". 

Have you encountered a problem with it ?


Best regards,

 

-- 

Linda.

 

On 5 September 2014 16:18, Andrew Reedick <[hidden email]> wrote:

Does the “//NOSONAR” tag work with javascript files i.e. does the JavaScript plugin respect the tag?  (JavaScript 1.6)

 

 

 

Reply | Threaded
Open this post in threaded view
|

Re: Does //NOSONAR work on javascript files?

Linda Martin
Hi Andrew,

Sorry for the delayed answer. 

The "NOSONAR" tag was actually never supported by the JavaScript plugin.

But the code snippet you gave for the rule "javascript:S138" raise another issue: 
Immediately-Invoked Function Expression should be excluded from this rule. 
So I created the following ticket: SONARJS-293.

Best regards,

-- 
Linda.

On 8 September 2014 18:02, Andrew Reedick <[hidden email]> wrote:

I think my problem is that the “//NOSONAR” is not at the end of the code statement (as opposed to the “end of the line” as per the documentation:  http://docs.codehaus.org/display/SONAR/Frequently+Asked+Questions#FrequentlyAskedQuestions-NOSONAR)

 

The following snippets are not respecting the //NOSONAR tag:

 

Rule:  javascript:S138

(function ($) { //NOSONAR Functions should not have too many lines

 

Rule: javascript:S1067

          options = $.extend({}, $.Autocompleter.defaults, { //NOSONAR Expressions should not be too complex

                url: isUrl ? urlOrData : null,

                data: isUrl ? null : urlOrData,

                delay: isUrl ? $.Autocompleter.defaults.delay : 10,

                max: options && !options.scroll ? 10 : 150

            }, options);

 

Supposedly, the tags worked previously i.e. the tag worked in a Sonar server that was set up and maintained by a small Development group (pre 4.x?), but the tag has now stopped working in our official/prod sonar server (Sonar 4.3 and the Javascript 1.6 plugin. )  Needless to say, “it worked in Dev when Dev configured it” isn’t the best help when troubleshooting.

 

For the latter case, I’m thinking that the NOSONAR tag should go after the last line, e.g. “} , options); //NOSONAR”

 

For the former case, I get the impression that the tag isn’t going to work for an entire function by design (which is a good thing.)  What is the proper method of ignoring a S138 error for functions with too many lines?

 

 

 

From: Linda Martin [mailto:[hidden email]]
Sent: Monday, September 08, 2014 11:38 AM
To: [hidden email]
Subject: Re: [sonar-user] Does //NOSONAR work on javascript files?

 

Hi Andrew,

 

Yes the JavaScript plugin is suppose to respect the tag "// NOSONAR". 

Have you encountered a problem with it ?


Best regards,

 

-- 

Linda.

 

On 5 September 2014 16:18, Andrew Reedick <[hidden email]> wrote:

Does the “//NOSONAR” tag work with javascript files i.e. does the JavaScript plugin respect the tag?  (JavaScript 1.6)

 

 

 


Reply | Threaded
Open this post in threaded view
|

Re: Does //NOSONAR work on javascript files?

Freddy Mallet
And I've created ticket http://jira.codehaus.org/browse/SONARJS-294 to make this JavaScript plugin support the "//NOSONAR" exclusion mechanism.

Kind regards

-----
SonarQube for Continuous Inspection

On Fri, Sep 12, 2014 at 9:54 AM, Linda Martin <[hidden email]> wrote:
Hi Andrew,

Sorry for the delayed answer. 

The "NOSONAR" tag was actually never supported by the JavaScript plugin.

But the code snippet you gave for the rule "javascript:S138" raise another issue: 
Immediately-Invoked Function Expression should be excluded from this rule. 
So I created the following ticket: SONARJS-293.

Best regards,

-- 
Linda.

On 8 September 2014 18:02, Andrew Reedick <[hidden email]> wrote:

I think my problem is that the “//NOSONAR” is not at the end of the code statement (as opposed to the “end of the line” as per the documentation:  http://docs.codehaus.org/display/SONAR/Frequently+Asked+Questions#FrequentlyAskedQuestions-NOSONAR)

 

The following snippets are not respecting the //NOSONAR tag:

 

Rule:  javascript:S138

(function ($) { //NOSONAR Functions should not have too many lines

 

Rule: javascript:S1067

          options = $.extend({}, $.Autocompleter.defaults, { //NOSONAR Expressions should not be too complex

                url: isUrl ? urlOrData : null,

                data: isUrl ? null : urlOrData,

                delay: isUrl ? $.Autocompleter.defaults.delay : 10,

                max: options && !options.scroll ? 10 : 150

            }, options);

 

Supposedly, the tags worked previously i.e. the tag worked in a Sonar server that was set up and maintained by a small Development group (pre 4.x?), but the tag has now stopped working in our official/prod sonar server (Sonar 4.3 and the Javascript 1.6 plugin. )  Needless to say, “it worked in Dev when Dev configured it” isn’t the best help when troubleshooting.

 

For the latter case, I’m thinking that the NOSONAR tag should go after the last line, e.g. “} , options); //NOSONAR”

 

For the former case, I get the impression that the tag isn’t going to work for an entire function by design (which is a good thing.)  What is the proper method of ignoring a S138 error for functions with too many lines?

 

 

 

From: Linda Martin [mailto:[hidden email]]
Sent: Monday, September 08, 2014 11:38 AM
To: [hidden email]
Subject: Re: [sonar-user] Does //NOSONAR work on javascript files?

 

Hi Andrew,

 

Yes the JavaScript plugin is suppose to respect the tag "// NOSONAR". 

Have you encountered a problem with it ?


Best regards,

 

-- 

Linda.

 

On 5 September 2014 16:18, Andrew Reedick <[hidden email]> wrote:

Does the “//NOSONAR” tag work with javascript files i.e. does the JavaScript plugin respect the tag?  (JavaScript 1.6)

 

 

 



Reply | Threaded
Open this post in threaded view
|

RE: Does //NOSONAR work on javascript files?

Andrew Reedick

Excellent.  Thanks for the update/confirmation, y’all.

 

 

From: Freddy Mallet [mailto:[hidden email]]
Sent: Saturday, September 13, 2014 4:55 AM
To: user
Subject: Re: [sonar-user] Does //NOSONAR work on javascript files?

 

And I've created ticket http://jira.codehaus.org/browse/SONARJS-294 to make this JavaScript plugin support the "//NOSONAR" exclusion mechanism.

 

Kind regards


-----

SonarQube for Continuous Inspection

 

On Fri, Sep 12, 2014 at 9:54 AM, Linda Martin <[hidden email]> wrote:

Hi Andrew,

 

Sorry for the delayed answer. 

 

The "NOSONAR" tag was actually never supported by the JavaScript plugin.

 

But the code snippet you gave for the rule "javascript:S138" raise another issue: 

Immediately-Invoked Function Expression should be excluded from this rule. 

So I created the following ticket: SONARJS-293.


Best regards,

 

-- 

Linda.

 

On 8 September 2014 18:02, Andrew Reedick <[hidden email]> wrote:

I think my problem is that the “//NOSONAR” is not at the end of the code statement (as opposed to the “end of the line” as per the documentation:  http://docs.codehaus.org/display/SONAR/Frequently+Asked+Questions#FrequentlyAskedQuestions-NOSONAR)

 

The following snippets are not respecting the //NOSONAR tag:

 

Rule:  javascript:S138

(function ($) { //NOSONAR Functions should not have too many lines

 

Rule: javascript:S1067

          options = $.extend({}, $.Autocompleter.defaults, { //NOSONAR Expressions should not be too complex

                url: isUrl ? urlOrData : null,

                data: isUrl ? null : urlOrData,

                delay: isUrl ? $.Autocompleter.defaults.delay : 10,

                max: options && !options.scroll ? 10 : 150

            }, options);

 

Supposedly, the tags worked previously i.e. the tag worked in a Sonar server that was set up and maintained by a small Development group (pre 4.x?), but the tag has now stopped working in our official/prod sonar server (Sonar 4.3 and the Javascript 1.6 plugin. )  Needless to say, “it worked in Dev when Dev configured it” isn’t the best help when troubleshooting.

 

For the latter case, I’m thinking that the NOSONAR tag should go after the last line, e.g. “} , options); //NOSONAR”

 

For the former case, I get the impression that the tag isn’t going to work for an entire function by design (which is a good thing.)  What is the proper method of ignoring a S138 error for functions with too many lines?

 

 

 

From: Linda Martin [mailto:[hidden email]]
Sent: Monday, September 08, 2014 11:38 AM
To: [hidden email]
Subject: Re: [sonar-user] Does //NOSONAR work on javascript files?

 

Hi Andrew,

 

Yes the JavaScript plugin is suppose to respect the tag "// NOSONAR". 

Have you encountered a problem with it ?


Best regards,

 

-- 

Linda.

 

On 5 September 2014 16:18, Andrew Reedick <[hidden email]> wrote:

Does the “//NOSONAR” tag work with javascript files i.e. does the JavaScript plugin respect the tag?  (JavaScript 1.6)