Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Installation and configuration of SonarQube Code quality Management platform

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

I. introduction of SonarQube

SonarQube is an open platform for managing code quality.

Code quality can be detected from seven dimensions (why use SonarQube):

(1) complexity distribution (complexity):: too complex code will be difficult to understand and maintain

(2) duplicate code (duplications):: a program containing a large number of copied and pasted code is a sign of poor quality.

(3) Unit testing (unit tests):: statistics and display unit test coverage

(4) coding specification (coding rules): written by Findbugs,PMD,CheckStyle and other specification codes

(5) Note (comments):: less readable, more looks laborious

(6) potential Bug (potential bugs): detect potential bug by Findbugs,PMD,CheckStyle, etc.

(7) structure and design (architecture & design):: dependence, coupling, etc.

Sonar can integrate different testing tools, code analysis tools, continuous integration tools, IDE.

Sonar measures the results of code quality analysis by reprocessing the data and quantifying it.

The change of code quality, so that it is convenient to manage the code quality of the project.

Supported languages include: Java, PHP, C #, C, Cobol, PL/SQL, Flex and so on.

Second, the composition of SonarQube platform:

(1) Database: stores SonarQube configuration data and code quality snapshot data

(2) Web service: used to view SonarQube configuration data and code quality snapshot data

(3) Analyzer: analyze the project code, generate quality result data and store it in the database

(there are many kinds of analyzers, we choose SonarQube Maven Plugin.)

III. Installation and configuration of SonarQube code quality management platform

IP: 192.168.1.253

Environment: CentOS 6.6, JDK1.8, MySQL5.6, SonarQube6.3

Preparation: JDK1.8 is installed and environment variables are configured

1. Install MySQL5.6

Wget http://repo.mysql.com//mysql-community-release-el6-5.noarch.rpmyum install mysql-community-serverservice mysqld startchkconfig-- list | grep mysqldmysqld 0:off 1:off 2:off 3:off 4:off 5:off 6:off

Use the above command to see that MySQL does not set boot, so you need to set boot

Chkconfig mysqld on

Create sonar libraries and users and authorize

CREATE DATABASE sonar CHARACTER SET utf8 COLLATE utf8_general_ci;GRANT ALL PRIVILEGES ON sonar.* TO 'sonar'@'localhost' IDENTIFIED BY' sonar2017'FLUSH PRIVILEGES

3. Install sonarqube

Cd / usr/local/srcwget https://sonarsource.bintray.com/Distribution/sonarqube/sonarqube-6.3.1.zipunzip sonarqube-6.3.1.zipmv sonarqube-6.3.1 / usr/local/ln-sv / usr/local/sonarqube-6.3.1 sonarqubeln-sv / usr/local/sonarqube/bin/linux-x86-64/sonar.sh / etc/init.d/sonar

4. Configure sonarqube

Vim / usr/local/sonarqube/conf/sonar.propertiessonar.jdbc.username=sonarsonar.jdbc.password=sonar2017#- MySQL 5.6 or greatersonar.jdbc.url=jdbc:mysql://localhost:3306/sonar?useUnicode=true&characterEncoding=utf8&rewriteBatchedStatements=true&useConfigs=maxPerformance&useSSL=falsesonar.web.host=0.0.0.0sonar.web.port=9090

5. In order to facilitate remote management, open port 3306pc9090 in the firewall

Vim / etc/sysconfig/iptables-An INPUT-m state-- state NEW-m tcp-p tcp-- dport 3306-j ACCEPT-An INPUT-m state-- state NEW-m tcp-p tcp-- dport 9090-j ACCEPT

Restart the firewall for the port configuration to take effect

Service iptables restart

6. Start SonarQube

/ etc/init.d/sonar start

7. Enter http://192.168.1.253:9090 in the browser

Login account / password default: admin/admin

The default is English, and plug-ins need to be installed in Chinese (plug-ins can be installed online or downloaded on the official website and placed in the plug-in directory)

The installation configuration is complete.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report