An overview of the
SonarQube is an automated code review tool that detects errors, bugs, and anomalies in code. It can be integrated with your existing workflow to enable continuous code reviews across project branches and extract requests
The only prerequisite for running SonarQube is Java (Oracle JRE 11 or OpenJDK 11) installed on your computer
Note: This works only in a JDK11 or JDK9 environment
Install SonarQube
www.sonarqube.org/
Go directly to the official website to download the latest zip package, and then unzip
Next configure the database
SonarQube supports PostgreSQL,Microsoft SQL Server, And Oracle databases by default. Mysql is not supported in the latest version
Take PostgreSQL as an example
In the configuration file to update database connection user configuration, sonar.. JDBC url = JDBC: postgresql: / / localhost/sonarqube sonarqube for the database name
After the Sonarqube service is started, by default, related table data is written to the specified database because the Scanner writes the corresponding scan data to the table
Then run startsonar.bat under \bin\windows-x86-64\
The appearance of the above interface represents
SonarQube
The service started successfully
Open a browser enter http://localhost:9000/, SonarQube service port is 9000 by default
Both username and password are amdin. Log in and you’ll see your home page
Next, we need to use the Scanner tool to scan our code
Install the Scanner
Docs.sonarqube.org/latest/anal…
Go directly to the official website to download the latest zip package, and then unzip
Modify the configuration file
Create the sonar-project.properties configuration file at the root of the project where you need to scan the code
Then open the CMD panel, locate the current directory and execute sonar-scanner
Then go to the SonarQube panel to see the results of the scan
Other instructions
localization
Find the corresponding language package can be installed