Verifying HTML, CSS and JavaScript validity using SonarQube
You going to static code on the application comprises HTML, CSS, and JavaScript files.
Getting ready
- Go to the Jenkins dashboard click on
New Item
. - Give the
Name
and selectFreestyle project
:

- Provide the
Repository URL
in theSource Code Management
section:

- Any project that has HTML, CSS, and JavaScript files can be utilized.
How to do it...
- Go to the
Build
section and selectExecute SonarQube Scanner
:

- You can provide the location of
sonar-project.properties
or provide details directly for static code analysis.
# Required metadata sonar.projectKey=SonarHTMLCSSJS sonar.projectName=Simple HTML CSS JS project analyzed with the SonarQube sonar.projectVersion=1.0 # Comma-separated paths to directories with sources (required) sonar.sources=. # Encoding of the source files sonar.sourceEncoding=UTF-8
sonar.sources
is the main property for static code analysis. With this property, you inform SonarQube which directory needs to be analyzed...