nano
nano

Reputation: 2521

SonarQube integration with Xcode

I have a remote server where I've deployed a SonarQube system, for tracking the quality of the code, and want to integrate Android Studio and Xcode with it.

For Android Studio it worked using:

* SonarQube plugin
* Gradle parameters (sonar.host.url, login, etc...)

for setting up the server and its credentials.

But for Xcode (v8.2.1) I don't know what's the best way to do this, or if any software is needed to be installed.

Has anyone accomplished this?

Upvotes: 8

Views: 15233

Answers (1)

Mehul Patel
Mehul Patel

Reputation: 23053

I did tried that and able to get install SonarQube and Sonar Scanner in Mac Sierra. But the Objective C plugin for SonarQube requires licence from Sonar Community. I have requested for trial version of that and still waiting response from them.

You can follow below steps to full fill Prerequisites.

  1. Open terminal and run below command to install Homebrew

    /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
    

Or if it is already installed then update it using below command

    brew update
  1. Install SonarQube using below command:

    brew install sonar
    
    ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" < /dev/null 2> /dev/null
    
  2. Install Sonar Scanner

    brew install sonar-scanner
    
  3. Install Xctool

    brew install xctool
    
  4. Install OCLint

    brew tap oclint/formulae
    brew install oclint
    
  5. Install gcovr

    brew install gcovr
    
  6. Set environment variables for Sonar Home

    export SONAR_HOME=/usr/local/Cellar/sonar-runner/2.4/libexec
    export SONAR=$SONAR_HOME/bin
    export PATH=$SONAR:$PATH
    
  7. Install JAVA

    brew cask install java
    
  8. Download .properties file from this Link and change project name, target and scheme

  9. Copy and paste .properties file to your project root directory

  10. Install Maven - It is required to run Objective C plugin

    brew install maven
    
  11. Download Sonar Objective C plugin from this Link

  12. Add your local host for SonarQube server. Open sonar-project.properties file and add below command at top of the file

    sonar.host.url=<YOUR-LOCAL-HOST>
    
  13. In Terminal go to your project's root directory and run below command to scan project for errors and bugs.

    sonar-scanner
    

Upvotes: 12

Related Questions