SonarQube 与 XCode 的集成

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/43629698/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 09:56:25  来源:igfitidea点击:

SonarQube integration with XCode

iosxcodesonarqube

提问by nano

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.

我有一个远程服务器,我在其中部署了 SonarQube 系统,用于跟踪代码质量,并希望将 Android Studio 和 XCode 与其集成。

For Android Studio it worked using:

对于 Android Studio,它使用:

* 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.

但是对于 XCode (v8.2.1),我不知道这样做的最佳方法是什么,或者是否需要安装任何软件。

Has anyone accomplished this?

有没有人做到这一点?

回答by Kampai

I did tried that and able to get install SonarQubeand Sonar Scannerin 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.

我确实尝试过,并且能够在 Mac Sierra 中安装SonarQube和安装Sonar Scanner。但是 SonarQube 的 Objective C 插件需要 Sonar Community 的许可。我已要求提供试用版,但仍在等待他们的回复。

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)"
    
  1. 打开终端并运行以下命令来安装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 .propertiesfile from this Linkand change project name, target and scheme

  9. Copy and paste .propertiesfile 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.propertiesfile 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
    
  1. 使用以下命令安装 SonarQube:

    brew install sonar
    
    ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" < /dev/null 2> /dev/null
    
  2. 安装声纳扫描仪

    brew install sonar-scanner
    
  3. 安装 Xctool

    brew install xctool
    
  4. 安装 OCLint

    brew tap oclint/formulae
    brew install oclint
    
  5. 安装 gcovr

    brew install gcovr
    
  6. 为 Sonar Home 设置环境变量

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

    brew cask install java
    
  8. .properties从此链接下载文件并更改项目名称、目标和方案

  9. .properties文件复制并粘贴到您的项目根目录

  10. 安装 Maven - 需要运行 Objective C 插件

    brew install maven
    
  11. 从此链接下载声纳目标 C 插件

  12. 为 SonarQube 服务器添加本地主机。打开sonar-project.properties文件并在文件顶部添加以下命令

    sonar.host.url=<YOUR-LOCAL-HOST>
    
  13. 在终端中,转到项目的根目录并运行以下命令以扫描项目中的错误和错误。

    sonar-scanner