Skip to end of metadata
Go to start of metadata

Features

The plugin sends HTML documents to the W3C Markup Validator for validation. This validator checks the markup validity of Web documents in HTML, XHTML, SMIL, MathML, etc.

For more information see http://validator.w3.org/.

The W3C Markup Validator is an online validator and always available. The sonar plugin interacts with the W3C Validator by default via the Internet, so the analysis of a set of files may take some time. 

There are quite a few different errors and warnings returned by the W3C Validator. In Sonar, these checks are represented as rules in the W3C Markup Profile. It would be possible to copy the default profile and configure priorities.

Warning

Please note that high volume usage of the W3C Validator is not allowed. This service has already a lot of requests to handle. The W3C blocks IP addresses that are using the service excessively.

The sonar plugin has a minimum waiting time between requests of 1000 milliseconds in order to respect the availability of the W3C Validator.

It is recommended to work around this limitation by installing your own W3C Validator. For local installations the waiting time can be set to 0. Please refer to the Installation guide how to install the W3C Validator. The sonar plugin has a property to configure the URL of the validation service. 

Usage & Installation

Requirements

The W3C Markup Validator plugin depends on the Sonar Web Plugin, which must be installed as a sonar plugin. 

Installation

  1. Copy the jar of the Web Plugin into /extensions/plugins/ directory
  2. Copy the jar of the Markup Validator Plugin into /extensions/plugins/ directory
  3. Restart Sonar Web server

Analysis
Create a maven pom for your project. Set the following properties:

  • sonar.language: web
  • sonar.dynamicAnalysis: false
  • sonar.web.sourceDirectory: [folder of the HTML files]
  • sonar.web.fileExtensions: html
  • sonar.profile: W3C Markup Validation

Example

Save your HTML files with extension .html to the folder src/html and create the following maven pom:

With this pom, you can simply call mvn:

Plugin Settings

property

default value

comments

URL of the W3C Markup Validation API

http://validator.w3.org/check

Optionally change this to the URL of your local installation of the W3C Validator

Waiting time between validation requests

1000

Minimum value is 1000 for the default W3C Validator, and 0 for local installations

Proxy host

 

Optionally configure the proxy host

Proxy port

 

Optionally configure proxy port

Changelog

Labels
  • None