
# In Sonarqube support multiple formats of test coverage. Then using official SonarJS documentation try to achieve it.
#Sonar 8 problems code#
# To have nicely generated code coverage report lets run test with the following parameters.
#Sonar 8 problems install#
# In order to run tests we need to install dependencies Firstly modify our dockerfile to look like this: FROM sonar-scanner-image:latest AS sonarqube_scan We are still missing some pieces in our analysis to be as efficient as possible – code coverage is the key missing part. # sonar.exclusions it is global exclusion from the whole analysis. Using official analysis parameters documentation and using this document (example patterns are at the bottom) try to achieve it. Dsonar.projectName="SONAR_PROJECT_NAME" \įor this example, let’s assume that we don’t want to analyse any login files in the src/routes/login data and routes folder. # adding exclusions setting to area name is common pattern # sonar.cpd is group of settings for duplication area Show example solution (click here to open) FROM sonar-scanner-image:latest AS sonarqube_scan Let’s exclude the passport.js file using official analysis parameters documentation and using this document (example patterns are at the bottom). Let’s assume that our current duplication metric is false and we need to add some exclusion for duplications. Remember to execute them in the project root directory! You will be running this command multiple times during the next examples. Run docker build -network=host -no-cache. # sonar.projectName property used for providing human-friendly project name in addition FROM sonar-scanner-image:latest AS sonarqube_scan Let’s begin our tutorial by editing our dockerfile by adding a project name property. If not please check the tutorial for “SonarScanner tutorial” for instructions. It is usually located on continuous integration agents (workers) or in separate docker images depending on your project flow.ĭuring this tutorial, I assume that you have finished the SonarQube introduction and you have your SonarQube server, sonar scanner and example projects set and ready to play with.

SonarScanner can handle most programming languages supported by SonarQube except C# and VB. SonarScanner is a separate client type application that in connection with the SonarQube server will run project analysis and then send the results to the SonarQube server to process it. What is SonarScanner and why do we need it?
#Sonar 8 problems how to#
In the previous tutorial we set up our environment and ran our first analysis, but what is this tutorial about? While SonarQube is a server that keeps our process analysis and project data, it also requires something that will provide its necessary data. That’s why we need SonarScanner and in this article you will get to know what it is and how to use it!
