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

Features

FeatureScreenshot
Unit test and code coverage reports with JsTestDriver
 Expand...

 

Code metrics:

  • sizing (files, lines of code)
  • duplication
  • comments
  • cyclomatic complexity (function complexity, file complexity, complexity density)
 Expand...

 

Usage & Installation

Installation

  1. Install JavaScript plugin through Update Center
  2. Restart Sonar

Analysis with Maven

Create a maven pom for your project and run "mvn sonar:sonar" to run analysis and import JsTestDriver results

Sample pom.xml

Sample JavaScript project analysis with Maven

  1. Checkout http://javascript-plugin-for-sonar.googlecode.com/svn/trunk/sample

  2. Update <browser> in pom.xml to point to browser where JavaScript unit tests should be run

  3. Run "mvn test" to execute JsTestDriver unit tests and gather code coverage statistics
  4. Run "mvn sonar:sonar" to analyse JavaScript code and import unit test results

Analysis with simple Java runner

  1. Download latest version of Simple Java Runner
  2. Create sonar-project.properties file for your project

 

Sample sonar-project.properties

Sample JavaScript project analysis with Simple Java Runner

  1. Checkout https://javascript-plugin-for-sonar.googlecode.com/svn/trunk/sample-simple-runner

  2. Change "<base_dir>" placeholders to actual path in sample JsTestDriver coverage file "jstestdriver/jsTestDriver.conf-coverage.dat"

  3. Run "sonar-runner"

Unit Tests and Code Coverage Reports

Unit test and code coverage reports produced by JsTestDriver. Integrated through jstd-maven-plugin.

Changelog

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

Roadmap Ideas

 

Labels
  • None