Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  1. Install the Web 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 Web project, use the Sonar Runner.

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

Run a Sonar Analysis with the other Analyzers

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

Advanced Properties

The following properties of the plugin are configurable:

propertyProperty

default Default value

sonar.web.sourceDirectory

 

sonar.web.fileExtensions

xhtml,jspf,jsp

sonar.cpd.web.minimumTokens

70

...

Metrics

Rules

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 .

See Metrics documentation page.

Complexity
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 see rules library

Duplication
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
Comments are counted by adding the lines for server side and client side comments.

Rules

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 .

Plugin Architecture

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.

No further external tools or maven plugins are being used for analyzing the code.

Roadmap Ideas

  • Run analysis directly from maven (without sonar)
  • More support for WCAG, webrichtlijnen
  • Enhanced validation of unified expressions (using JSFUnit?)
  • Dependency analysis

Change Log

JIRA Issues
anonymoustrue
titleRelease 1.2
width800
columnstype;key;summary;priority;status;resolution
urlhttp://jira.codehaus.org/sr/jira.issueviews:searchrequest-xml/temp/SearchRequest.xml?jqlQuery=project+%3D+SONARPLUGINS+AND+fixVersion+%3D+%22WEB-1.2%22+AND+status+%3D+Closed+ORDER+BY+priority+DESC&tempMax=1000

...

JIRA Issues
anonymoustrue
titleRelease 0.1
height250
width800
columnstype;key;summary;priority;status;resolution
urlhttp://jira.codehaus.org/sr/jira.issueviews:searchrequest-xml/temp/SearchRequest.xml?fixfor=16708&pid=11911&sorter/field=priority&sorter/order=DESC&tempMax=1000

Roadmap Ideas

  • Run analysis directly from maven (without sonar)
  • More support for WCAG, webrichtlijnen
  • Enhanced validation of unified expressions (using JSFUnit?)
  • Dependency analysis