opticyclic opticyclic - 2 months ago 23
Javascript Question

Exclude Javascript Libraries From Sonar

If you look at this site analysing javascript with sonar you see that there are lots of errors reported on the javascript libraries.

http://nemo.sonarsource.org/drilldown/violations/jquery?rids%5B%5D=421365&severity=MAJOR

How can I prevent Sonar reporting the errors in the javascript libraries that I am using (since I can't fix any issues)?

At the same time, if I do manage to exclude the library, I don't want errors like "undefined variables" to appear in my files because they are referencing the javascript library.

If it makes any difference, I am using ExtJS 4.0.

Answer

I am using maven and extjs 4.1 in my project. I have managed to run the analysis only on my source code by putting these lines in my pom.xml:

<properties>
    <sonar.language>js</sonar.language>
    <sonar.exclusions>extjs/**</sonar.exclusions>
</properties>

<build>
    <sourceDirectory>src/main/webapp</sourceDirectory>
</build>

I don't know whether you're using maven as well, but perhaps this will give you some hints.

Comments