SonarQube CSS / SCSS / Less Analyzer
Please visit https://github.com/racodond/sonar-css-plugin as its an updated version of the plugin
This SonarQube plugin analyzes:
and:
A live example is available here.
For a quick try, a simple package and procedure is available at https://github.com/racodond/package-test-sonarqube-css
The plugin analyzes CSS code embedded in <style type="text/css">...</style>
tags in HTML/XHTML files.
To do so, as a prerequisite, SonarQube has to import those files. Either:
sonar.import_unknown_files
to true
The list of files containing embedded CSS to analyze can be customized through the sonar.css.embedded.file.suffixes
property.
If you are already using stylelint, adding SonarQube to your stack will help you bring code quality to another level.
The stylelint / SonarQube rule mapping may be of great help to define your SonarQube quality profile.
You’re thinking of new valuable checks? Version 2.1 or greater provides an API to write your own custom checks.
A sample plugin with detailed explanations is available here.
If your custom checks may benefit the community, feel free to create a pull request in order to make the check available in the CSS / SCSS / Less analyzer.
You’re thinking of new checks that may benefit the community but don’t have the time or the skills to write them? Feel free to create an issue for your checks to be taken under consideration.
Number of rules.
The following elements increment the complexity by one:
It computes the complexity/rule, meaning the average number of selectors per rule. It gives a measurement on how specific the selectors are.
Any contribution is more than welcome!
You feel like: