Use sonarqube to check and Measure code quality (2) -- use sonarqube to analyze code Quality

Source: Internet
Author: User

As mentioned above, sonarqube can be used to analyze code quality in five ways. The first method is omnipotent.


Download the source code to the server where sonarqube is located, for example, the following directory structure:

 



However, under this root directory, create a sonar-project.properties file, as shown in the configuration.

# Required metadatasonar.projectKey=my:testtoolssonar.projectName=testoolssonar.projectVersion=1.0 # Path to the parent source code directory.# Path is relative to the sonar-project.properties file. Replace "\" by "/" on Windows.# Since SonarQube 4.2, this property is optional if sonar.modules is set. # If not set, SonarQube starts looking for source code from the directory containing # the sonar-project.properties file.sonar.sources=src # Encoding of the source codesonar.sourceEncoding=UTF-8sonar.language=py # Additional parameterssonar.my.property=value

1. The project Key and project name must be unique. Do not overwrite a project with the same name?

2. Sonar. Sources = SRC indicates that the source code is in the src directory.

3. Sonar. Language = py: specifies that the source code is Python. If this parameter is not specified, sonarrunner can analyze the language automatically, that is, the speed is slow.

After the analysis, you can see the report through the page, http: // 192.168.22.99: 9001/sonarqube, as shown in.





Carefully analyzing the description of each rule is helpful for developers to improve code quality. At the same time, quality control is also very helpful when QA personnel participate in code review.

Use sonarqube to check and Measure code quality (2) -- use sonarqube to analyze code Quality

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.