SonarQube CSS Plugin
Project homepage: https://github.com/SonarCommunity/sonar-css
Issue tracking: https://github.com/SonarCommunity/sonar-css/issues
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.
Getting started in two minutes
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.
Number of rules.
The following elements increment the complexity by one:
- Class selector
- ID selector
- Attribute selector
- Type selector
- Pseudo-class selector
It computes the complexity/rule, meaning the average number of selectors per rule.
It gives a measurement on how specific the selectors are.
As the computation of complexity in the CSS plugin is still in its early stage, it can be turned off if necessary at global and project levels.