Credence Analytics - Code Testing through SonarQube

SonarQube is an open-source platform developed by SonarSource for continuous inspection of code quality to perform automatic reviews with static analysis of code to detect bugs and code smells

 · 2 min read

Sonarcube

About Sonarqube

  • SonarQube is an open-source platform developed by SonarSource for continuous inspection of code quality to perform automatic reviews with static analysis of code to detect bugs and code smells on 29 programming languages. SonarQube offers reports on duplicated code, coding standards, unit tests, code coverage, code complexity, comments, bugs, and security recommendations.

Installation of Sonarqube

Prequisite

  • Docker Desktop
  • WSL 2.0

Installation Steps

  • Run the below command in Terminal which is integrated with your docker desktop.
    docker pull sonarqube:latest
    
    
  • After installation, open Docker Desktop
  • In the Container you will see sonarqube, click on start button.
  • Now it will ask you to enter port number.
  • Enter any port number e.g 9000.
  • Before executing further steps follow SonarScanner setup

SonarScanner setup

  • Download the SonarScanner zip link
  • Unzip the downloaded file.
  • copy the path till bin folder.
  • add this path to the path variable in system environment variable.
  • Now you can use sonarScanner.

Creating Project in Sonarqube

Steps for creating project in Sonarqube.

  • After Successfully installation of sonarqube, go on the port on which sonarqube is started e.g http://localhost:9000.
  • It will ask username and password.

    Default
    Username : admin
    Password : admin
    
    
  • After login, on the top-right click on the create project -> manually.

  • Write project name, project key and branch name e.g master.

  • Click on set up.
  • Now click on Locally -> Generate -> continue -> select your program language -> select your os.
  • After this, There will be command on the screen.

  • Copy that command.
  • Go in your Project directory which is locally present.
  • Open cmd in that directory.
  • Paste the copied command.

  • press enter.
  • Also save this command somewhere for future use.
  • After execution refresh your sonarqube page, you will see the report of your project in sonarqube.

No comments yet.

Add a comment
Ctrl+Enter to add comment