SonarQube CSS Plugin
Project homepage: https://github.com/SonarQubeCommunity/sonar-css
Issue tracking: https://github.com/SonarQubeCommunity/sonar-css/issues
CI builds: https://travis-ci.org/SonarQubeCommunity/sonar-css
Download: https://github.com/SonarQubeCommunity/sonar-css/releases
Plugin versions and compatibility with SonarQube versions: http://docs.sonarqube.org/display/PLUG/Plugin+Version+Matrix
Description
This plugin enables code QA analysis of CSS source code within SonarQube:
- Computes metrics: lines of code, number of CSS rules, complexity, etc.
- Validates your CSS code
- Performs more than 50 checks such as: Stylesheets should not contain too many selectors, Empty declarations should be removed, Box model size should be carefully reviewed, etc.
Usage
Getting started in two minutes
Download the package and follow the instructions of the README file. This package contains the SonarQube server with the CSS plugin, the analyzer (SonarQube Runner) and a sample project.
Installing and configuring your SonarQube platform from scratch
- Install SonarQube
- Install the CSS plugin either by a direct download or through the update center.
- Install your favorite analyzer (SonarQube Runner, Maven, etc.) and analyze your code.
Metrics
Functions
Number of rules.
Complexity
The following elements increment the complexity by one:
- Class selector
- ID selector
- Attribute selector
- Type selector
- Pseudo-class selector
- At-rule
Complexity/function
It computes the complexity/rule, meaning the average number of selectors per rule.
It gives a measurement on how specific the selectors are.