Using Oclint and sonar for iOS code analysis and quality management

Source: Internet
Author: User

Oclint is a powerful static code analysis tool that can be used to improve code quality, find potential bugs, and focus on static analysis of c,c++ and Objective-c.

Sonar is an open platform for code quality management. Through the plug-in mechanism, Sonar can integrate different test tools, code analysis tools, and continuous integration tools.

Sonarqube Installation
1 Brew Install Sonarqube
Sonarqube of Chinese

Chinese-Typed plugin

Https://github.com/SonarQubeCommunity/sonar-l10n-zh

After downloading, put in the following directory:

1 /usr/local/cellar/sonarqube/6.5/libexec/extensions/plugins
MySQL Installation
1 Brew Install MySQL

Create a Sonar database

Configuring sonar to connect to MySQL
123456 sonar.jdbc.url=jdbc:mysql://localhost:3306/sonar?useunicode=true&characterencoding=utf8& Rewritebatchedstatements=true&useconfigs=maxperformance&usessl=falsesonar.jdbc.username= Rootsonar.jdbc.password=rootsonar.sorceencoding=utf-8sonar.login=adminsonar.password=admin
Installing Xcpretty
1 Gem Install Xcpretty
Installing Oclint
12 Brew Tap Oclint/formulabrew Install Oclint
Installing Sonar-scanner
1 Brew Install Sonar-scanner
Installing Sonar-objective-c-plugin

Backelite-sonar-objective-c-plugin-0.6.2.jar

After downloading, put in the following directory:

1 /usr/local/cellar/sonarqube/6.5/libexec/extensions/plugins
Restart Sonar
1 Sonar restart

To this sonar environment has been basically configured, open http://127.0.0.1:9000

Project configuration

Place run-sonar.sh and sonar-project.properties template in the root directory, modify .properties the contents of the file, and then execute run-sonar.sh it. File Address Https://github.com/LeoXu92/SonarShell-iOS

Final effect

(Ps. The accumulation of technical debt is much more, it is time to change.) )

The problem encountered when executing Sonar-scanner prompt "The rule ' XXX ' does not exist"

In the new version of Oclint, there are additional rules that need to update the corresponding list of rules on the sonar server.

Download the HTTPS://GITHUB.COM/LEOXU92/SONAR-OBJECTIVE-C code first.

And then after the path: Sonar-objective-c-develop/sonar-objective-c-plugin/src/main/resources/org/sonar/plugins/oclint under the profile-oclint.xml rules.txtthese two files. Add the corresponding rule.

build-and-deploy.shThe new jar package is then compiled and executed.

If you can't start Sonarqube

Remove the folder restart and try sonarqube/6.7.1/libexec/temp again.

Using Oclint and sonar for iOS code analysis and quality management

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.