If you want to see a live example of the capabilities of the Web plugin, you can have a look at the analysis of the Shopizer project on Nemo.
Description / Features
The plugin enables analysis of Web projects within Sonar. Currently JSP and JSF are supported. Some initial support is provided for Ruby templating (erb files).
It is compatible with the Issues Report plugin to run pre-commit local analysis.
- Install the Web plugin through the Update Center or download it into the SONAR_HOME/extensions/plugins directory
- Restart the Sonar server
Run a Sonar Analysis with the Sonar Runner (Recommended Way)
To launch a Sonar analysis of your Web project, use the Sonar Runner.
Run a Sonar Analysis with the other Analyzers
The following properties of the plugin are configurable:
Complexity of the web page is measured by counting the decision tags (such as if and forEach) and boolean operators in expressions ("&&" and "||"), plus one for the body of the document. It is a measure of the minimum number possible paths to render the page.
The decision tags and the operators are configurable. For details see rules library
Duplication is counted by comparing tokens. Duplication is reported if more than a minimum amount of tokens are replicated (in the same file or another file). The default minimum tokens is set to 70.
Comments are counted by adding the lines for server side and client side comments.
There are about 20 checks in the library. Please read the documentation of the checks on the page Web Rules Library.
The ruleset is inspired on the following standards and guidelines:
A complete explanation of the available checks is given here .
The plugin uses a simple tokenizer to parse the web pages. The tokenizer is based on the sonar-channel library. The output of the tokenizer is analyzed by a set of analyzers and checks. Expressions written in the Unified Expression Language (EL) are validated with JBoss EL.
- Run analysis directly from maven (without sonar)
- More support for WCAG, webrichtlijnen
- Enhanced validation of unified expressions (using JSFUnit?)
- Dependency analysis
|Release 1.2 (13 issues)|
|SONARPLUGINS-1201||Struts tags suport: wrongly report Invalid OGNL Expression|
|SONARPLUGINS-1973||Replace all the Web profiles by a single Sonar Way Profile|
|SONARPLUGINS-1903||Add Greek Localization|
|SONARPLUGINS-1897||Add commented-out code detection capability|
|SONARPLUGINS-1890||Most violations don't have any message|
|SONARPLUGINS-1889||By default, all rules are declared to have mutliple cardinality but this shouldn't be the case|
|SONARPLUGINS-1888||Impossible to set property "taglibs" on IllegalTagLibsCheck rule|
|SONARPLUGINS-1887||Add L10n mechanism to the Web plugin|
|SONARPLUGINS-1878||Improve syntax highlighting|
|SONARPLUGINS-1874||Source headers should not be counted as comments|
|SONARPLUGINS-1873||Deprecate the specific "sonar.web.sourceDirectory" property in favor of the standard properties|
|SONARPLUGINS-1858||Make the Sonar Web plugin compatible with Sonar 2.12+|
|SONARPLUGINS-1187||Allow configuration via sonar-project.properties rather than pom.xml|
|Release 1.0.2 (1 issues)|
|SONARPLUGINS-857||XMLProfileParser shouldn't be instantiated by plugin|
|Release 1.0.1 (1 issues)|
|SONARPLUGINS-858||Sonar with web plugin fails to start on Oracle database|