Skip to end of metadata
Go to start of metadata
You are viewing an old version of this page. View the current version. Compare with Current ·  View Page History
Live example

If you want to see a live example of the capabilities of the JavaScript plugin, you can have a look at the analysis of the jQuery project on Nemo.

Description / Features

The plugin enables analysis of JavaScript projects within Sonar.

Installation

  1. Install the JavaScript plugin through the Update Center or download it into the SONAR_HOME/extensions/plugins directory
  2. Restart the Sonar server

Usage

Run a Sonar Analysis with the Sonar Runner (Recommended Way)

To launch a Sonar analysis of your JavaScript project, use the Sonar Runner.

A sample project is available on github that can be browsed or downloaded: /projects/languages/javascript/javascript-sonar-runner.

Run a Sonar Analysis with the other Analyzers

Maven and Ant can also be used to launch analysis on Web projects.

Unit Tests and Code Coverage Reports

Reports from JsTestDriver can be imported into Sonar.

Sample projects are available on github that can be browsed or downloaded:

  1. JavaScript project analyzed with the Sonar Runner reusing unit tests and code coverage reports generated with JsTestDriver: /projects/languages/javascript/javascript-sonar-runner-JsTestDriver
  2. JavaScript project analyzed with Maven running unit tests and code coverage reports with JsTestDriver (integrated through jstd-maven-plugin): /projects/languages/javascript/javascript-maven-JsTestDriver

Extending Coding Rules using XPath

New coding rules can be added using XPath. See the related documentation.

To navigate the AST, download the SSLR JavaScript Toolkit.

Roadmap Ideas

Change Log

Release 1.1 (20 issues)
Type Key Summary Priority Status Resolution
Improvement SONARPLUGINS-2047 Upgrade to SSLR 1.14 Major Closed Fixed
Improvement SONARPLUGINS-2045 When a JavaScript file starts with the BOM(Byte Order Mark) character, the source code can't be parsed Major Closed Fixed
Improvement SONARPLUGINS-2043 The Javascript analyser doesn't support the HTML comment embedded into the javascript source code Major Closed Fixed
Bug SONARPLUGINS-2079 Rule AlwaysUseCurlyBracesCheck should not produce false-positive in case of 'if-else-if' Major Closed Fixed
Bug SONARPLUGINS-1957 Compound and labelled statements should not be included into metric 'statements' Major Closed Fixed
Improvement SONARPLUGINS-1955 Improve performance of parser by refactoring of grammar Major Closed Fixed
Improvement SONARPLUGINS-1951 Follow best-practice: replace NOK by Non-Compliant and OK by Compliant in descriptions of rules Major Closed Fixed
Bug SONARPLUGINS-1949 Unable to lex regular expression literal which contains "/" Major Closed Fixed
New Feature SONARPLUGINS-2183 Make the Javascript plugin support the Developer Cockpit plugin by providing the measures comments and loc by line Major Closed Fixed
New Feature SONARPLUGINS-2235 Rule: Avoid switch without default clause Major Closed Fixed
Bug SONARPLUGINS-2213 Prevent conflicts in l10n of description for JavaScript rules Major Closed Fixed
New Feature SONARPLUGINS-2208 Embed the sonar-common-rules library Major Closed Fixed
Bug SONARPLUGINS-2200 Misleading position of violation for rule AlwaysUseCurlyBraces Major Closed Fixed
Task SONARPLUGINS-2197 Remove metric comment_blank_lines Major Closed Fixed
Bug SONARPLUGINS-2292 Rule CommentedCode should not produce false-positive in JSDoc comments Major Closed Fixed
New Feature SONARPLUGINS-2290 Rule: Do not use HTML comments, because they are not part of EcmaScript specification Major Closed Fixed
New Feature SONARPLUGINS-2282 Rule: Avoid using 'continue' branching statement Major Closed Fixed
New Feature SONARPLUGINS-2249 Provide new version of sslr-javascript-toolkit instead of javascript-devkit Major Closed Fixed
New Feature SONARPLUGINS-2236 Rule: An unconditional break statement shall terminate every non-empty switch-clause Major Closed Fixed
Bug SONARPLUGINS-2178 Rule NestedIfDepthCheck should not produce false-positive in case of 'if-else-if' Minor Closed Fixed

 

Release 1.0 (36 issues)
Type Key Summary Priority Status Resolution
New Feature SONARPLUGINS-1842 Rule: Avoid use of parentheses where not required by syntax or semantics Major Closed Fixed
New Feature SONARPLUGINS-1841 Rule: Detect conditional operators Major Closed Fixed
New Feature SONARPLUGINS-1840 Rule: "UnreachableCore" - return, break, continue, or throw statements should be followed by a } or case or default. Major Closed Fixed
Task SONARPLUGINS-1829 Do not use jslint4java Major Closed Fixed
New Feature SONARPLUGINS-1828 Rule: Avoid trailing comma in array and object literals Major Closed Fixed
New Feature SONARPLUGINS-1826 Rule: Avoid doing assignments in the condition part of if/while/for statements Major Closed Fixed
New Feature SONARPLUGINS-1827 Rule: Only while/do/for statements can be labelled Major Closed Fixed
New Feature SONARPLUGINS-1823 Rule: Use single quote for string literals Major Closed Fixed
New Feature SONARPLUGINS-1822 Rule: Do not allow function declarations within blocks Major Closed Fixed
New Feature SONARPLUGINS-1820 Rule: Do not use wrapper objects for primitive types Major Closed Fixed
New Feature SONARPLUGINS-1817 Rule: Do not use Array and Object constructors Major Closed Fixed
New Feature SONARPLUGINS-1816 Rule: Avoid multiline string literals Major Closed Fixed
New Feature SONARPLUGINS-1819 Rule: For-in statement must filter items Major Closed Fixed
New Feature SONARPLUGINS-1818 Rule: Avoid usage of bitwise operators Major Closed Fixed
New Feature SONARPLUGINS-1814 Rule: Each statement must end with a semicolon Major Closed Fixed
New Feature SONARPLUGINS-1815 Rule: Always use curly braces for if/else/for/while/do statements Major Closed Fixed
New Feature SONARPLUGINS-1813 Rule: Avoid usage of with statement Major Closed Fixed
New Feature SONARPLUGINS-1812 Rule: One statement per line Major Closed Fixed
New Feature SONARPLUGINS-1811 Rule: Regular expression on comment Major Closed Fixed
New Feature SONARPLUGINS-1808 Rule: Avoid usage of == and != Major Closed Fixed
New Feature SONARPLUGINS-1806 Rule: Avoid usage of eval Major Closed Fixed
New Feature SONARPLUGINS-1809 Rule: Line too long Major Closed Fixed
New Feature SONARPLUGINS-1807 Rule: Avoid usage of debugger statement Major Closed Fixed
New Feature SONARPLUGINS-1799 Rule: Avoid too complex function Major Closed Fixed
New Feature SONARPLUGINS-1855 Rule: Avoid deeply nested if statements Major Closed Fixed
Bug SONARPLUGINS-1703 Problem in the calculation of cyclomatic complexity Major Closed Fixed
New Feature SONARPLUGINS-1702 Support for JsTest unit test execution and code coverage reports should be added Major Closed Fixed
New Feature SONARPLUGINS-1794 Rule: When there is a parsing error, this error should be added like a violation on that JavaScript file Major Closed Fixed
New Feature SONARPLUGINS-1795 Rule: Detect commented-out lines of code Major Closed Fixed
New Feature SONARPLUGINS-1790 Metric: blank comments Major Closed Fixed
New Feature SONARPLUGINS-1792 Provide "Sonar Way" profile for JavaScript Major Closed Fixed
New Feature SONARPLUGINS-1791 Metric: statements Major Closed Fixed
New Feature SONARPLUGINS-1793 Rule: Generic JavaScript rule to define some homemade checks with an XPath expression Major Closed Fixed
New Feature SONARPLUGINS-1789 Integrate JavaScript parser based on SSLR Major Closed Fixed
New Feature SONARPLUGINS-1788 Provide JavaScript rule engine based on SSLR Major Closed Fixed
New Feature SONARPLUGINS-1796 Provide a default SQALE mapping for the JavaScript rules Major Closed Fixed

 

Release 0.4 (5 issues)
Type Key Summary Priority Status Resolution
Bug SONARPLUGINS-1625 NullPointer on loading test file Major Closed Fixed
New Feature SONARPLUGINS-1587 Support of JsTestDriver unit test execution and code coverage reports should be added Major Closed Fixed
Bug SONARPLUGINS-1319 Doesn't work with SCM Plugin Major Closed Fixed
Bug SONARPLUGINS-1295 Cannot specify sonar.javascript.lslint.predef in POM Major Closed Fixed
Bug SONARPLUGINS-1139 Cannot define multiple predefined variables Major Closed Fixed

 

Release 0.3 (1 issues)
Type Key Summary Priority Status Resolution
New Feature SONARPLUGINS-1006 Migrate JavaScript plugin from code.google.com to Codehaus Minor Closed Fixed

Labels
  • None