DEV Community

Shivani Sharma
Shivani Sharma

Posted on

Running sonarqube to check javascript code(part 2)

Once SonarQube is running at port 9000, we are done with the sonarqube server setup.

Next we'll be creating a project and generating a token.
Alt Text

Alt Text

Once you click on setup while you give a project name as new-project. Next you need to generate a token.
You can either generate a new token or use existing.

Alt Text
The token is used to identify you when an analysis is performed.

Select the build technology and OS.

Alt Text

In order to run analysis on your project, you will need to download sonar-scanner
http://localhost:9000/documentation/analysis/scan/sonarscanner/

Now move to the project folder(terminal) where you want to run analysis like:

cd myprojects/first
Get the path of sonar-scanner from where you have downloaded and unzipped sonar-scanner, mine was /Users/shivani/Downloads/sonar-scanner-4.5.0.2216-macosx/bin/sonar-scanner

while you are on your project where you want to run the analysis(in my case it is first) just run command
/Users/shivani/Downloads/sonar-scanner-4.5.0.2216-macosx/bin/sonar-scanner -Dsonar.projectKey=new-project \
-Dsonar.sources=. \
-Dsonar.host.url=http://localhost:9000 \
-Dsonar.login=785b95e8e1b80ea398f7a7b00983985feda59255

the arguments we have passed you can get when you have created generated a token....
Alt Text

Once execution is successful, you will see
Alt Text

And we are done with the sonarqube setup.

Top comments (0)