Use OCLint and Sonar for iOS code analysis and quality management, oclintios

Source: Internet
Author: User
Tags continuous integration tools

Use OCLint and Sonar for iOS code analysis and quality management, oclintios

OCLint is a powerful static code analysis tool that can be used to improve code quality and find potential bugs, mainly for Static Analysis of c, c ++ and Objective-c.

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

Install SonarQube
1 Brew install sonarqube
SonarQube Chinese

Chinese INS

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

Put the downloaded file in the following directory:

1 /Usr/local/Cellar/sonarqube/6.5/libexec/extensions/plugins
Install Mysql
1 Brew install mysql

Create a sonar Database

Configure 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
Install xcpretty
1 Gem install xcpretty
Install OCLint
12 Brew tap oclint/formulabrew install oclint
Install sonar-plugin
1 Brew install sonar-Example
Install sonar-objective-c-plugin

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

Put the downloaded file in the following directory:

1 /Usr/local/Cellar/sonarqube/6.5/libexec/extensions/plugins
Restart sonar
1 Sonar restart

Now the Sonar environment has been basically configured. Open http: // 127.0.0.1: 9000


Project Configuration

Setrun-sonar.shAndsonar-project.propertiesPut the template in the root directory and modify it..propertiesFile content, and then executerun-sonar.shYou can. File address https://github.com/LeoXu92/SonarShell-iOS

Final Effect

(Ps. The technical debt accumulation is quite large, so it's time to change it .)

The system prompts "The rule 'xxx' does not exist" when executing sonar-example"

In the new oclint version, some rules are added. You need to update the rule list on the sonar server.

Download https://github.com/leoxu92/sonar-objective-ccode.

Then, in the path sonar-objective-c-develop/sonar-objective-c-plugin/src/main/resources/org/sonar/plugins/oclintprofile-oclint.xmlAndrules.txtThese two files. Add the corresponding rule.

Then executebuild-and-deploy.shCompile a new jar package.

If SonarQube cannot be started

Deletesonarqube/6.7.1/libexec/tempRestart the folder.


Related Article

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.