Sonar-XSL-Plugin

Logo

A Schematron-based SonarQube plugin for XSL code quality measurement.

View the Project on GitHub sonar-xsl/Sonar-XSL-Plugin

Sonar-XSL-Plugin

A Schematron-based SonarQube plugin for XSL code quality measurement.

it brings the benefits of SonarQube to XSL projects :

Contact / Updates roadmap

Contact : Sonar-XSL-Plugin is mainly maintained by Jim Etevenard

Development roadmap and upcoming updates :
See main milestones and active issues on Github

How it works

This plugin runs an XSL-related Best-practice Schematron on each XSLT file of your project.

It embeds the xslt-quality schematron from @mricaud.
That Schematron Script, based on Mukul Gandhi’s work, checks some common XSL pitfalls.

A few examples of rules :

Since this plugin is open source, one can embed any additional Schematron script to support custom rules.

Download and install

Public releases are available on Github :
https://github.com/sonar-xsl/Sonar-XSL-Plugin/releases

  1. Download sonar-xsl-plugin-x.x.x.jar from the link above
  2. Copy it to $SONARQUBE_HOME/extensions/plugins
  3. Restart your SonarQube instance and voilà.

In most cases, on Linux, $SONARQUBE_HOME refers to /opt/sonarqube/ making the full path to be /opt/sonarqube/extensions/plugins/

The process of installing a SonarQube plugin is documented here :
https://docs.sonarqube.org/latest/setup/install-plugin/, see § Manual Installation

Build from sources

The Sonar-XSL-Plugin is built via Maven.

Running mvn package will invoke the sonar-packaging-maven-plugin to build a SonarQube-Ready JAR file.

The JAR to be installed in SonarQube will be delivered at /sonar-xsl-plugin/target/sonar-xsl-plugin-1.x.x.jar

Architecture / Extending

It embeds two main modules

Sonar-Schematron-Reactor

Makes the link between Schematron and the SonarQube API.

Cf. https://github.com/sonar-xsl/Sonar-Schematron-Reactor

Some Schematrons modules

Out of the box, the unique xslt-quality

Packaged for this plugin, via the dedicated Maven Plugin. (See module ./sonar-schematron-packaging-plugin)

This mechanism can be used to extend this plugin :

  1. Write some XSL-Related Schematron rules
  2. Package them with the plugin
  3. Add the resulting artifact as a dependency

So, does it actually works ?

:+1: Yes, it works !

Still, there is some TODOs to fix :

See Issues and next Milestones

Realese and pushish !

As for now, if you wana try it, you have to build it locally from the sources.

The execution is quite slow…

NB : The actual implementation is based on the Skeleton XSLT implementation of ISO-Schematron.

Improve the integration with SonarQube

Improve the integration of xslt-quality ruleSet.

Integration with the XSPEC Maven plugin

To bring XSLT code coverage into SonarQube