Sonarqub E and J Enkin s Introduction
Sonarqub e is an open source code quality analysis platform that facilitates the management of code quality, and examines the vulnerabilities and potential logic issues of project code. At the same time, it provides a rich number of plug-ins to support the detection of multiple languages, such as J Ava, Python, Groovy, C, C + +, and other dozens of programming languages. Its main core values are shown in the following areas: Check if code follows programming standards: Naming conventions, writing specifications, etc. Check for potential flaws in the design: Sonarqub e detects flaws in the code through tools such as plug-ins F indbugs, Checkstyl E. Duplicate code volume for instrumented code: SONARQUB e can show a large amount of copy-and-paste code in your project. Detect the extent of comments in the code: too many or too few source comments are not good, affecting the program's readable and understandable. Detect the relationships between packages and classes in code: Analyze whether the relationships between classes are reasonable and complex.
The Sonarqub e platform is comprised of 4 parts: SonarQube Server SonarQube Database SonarQube Plugins SonarQube Scanner SonarQube with Sonar Installation and configuration of Qube-scanner SonarQube
In the S Onarqub E official website, we can download the latest S Ona r installation package, this section with L Inu X system For example, build S Onarqub e platform, extract to any directory, such as: Unzip Sonarqube5.6.zip.
Sonarqub e comes with a H2 database, of course, to get better performance we can specify an external database, where we use MySQL database. An S ona R database is established in M ysq L database, which is mainly used to store the data of analysis results, as shown in Figure 1: Figure 1. Creating a MySQL database
Enter the extracted S onarque b directory, in the system path with a good P ATH, configured as follows:
1 2 3) 4 5 |
#sonar profile Export sonar_home=/usr/local/sonarqube-5.6.1 export Path=${sonar_ho Me}/bin:${path} |
and modify the configuration file S onar.properties as follows:
1 2 3 4 5 6 7 |
# sonar.jdbc.username=root #sonar. Jdbc.password=root #sonar. Jdbc.url=jdbc:mysql://localhost:3306/sonar? useunicode=true&characterencoding= Utf8&rewritebatchedstatements=true&useconfigs=maxperformance # Option Properties Sonar.jdbc.driverClassName:com.mysql.jdbc.Driver |
Basic configuration complete, start S Onarqube at command line: Enter s Onarqub e installation directory, enter b i n directory, run./sonar.sh start, open H ttp://localhost:9000, if show S Onar Qub e Home page, the S Onarqub e installation was successful. As shown in Figure 2. Figure 2. SonarQube Start Page
If you need to close S Onarqube, execute the./sonar.sh stop
If you need to restart S onarqube, execute./sonar.sh restart SonarQube Scanner
Download S onar-scanner-2.6.1, unzip to the directory (can be extracted to any directory). Modify the system path P ATH, as follows: