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
SonarQube integration with XCode
提问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 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.
我确实尝试过,并且能够在 Mac Sierra 中安装SonarQube
和安装Sonar Scanner
。但是 SonarQube 的 Objective C 插件需要 Sonar Community 的许可。我已要求提供试用版,但仍在等待他们的回复。
You can follow below steps to full fill Prerequisites.
您可以按照以下步骤完成先决条件。
Open terminal and run below command to install Homebrew
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/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
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
Install Sonar Scanner
brew install sonar-scanner
Install Xctool
brew install xctool
Install OCLint
brew tap oclint/formulae brew install oclint
Install gcovr
brew install gcovr
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
Install JAVA
brew cask install java
Download
.properties
file from this Linkand change project name, target and schemeCopy and paste
.properties
file to your project root directoryInstall Maven - It is required to run Objective C plugin
brew install maven
Download Sonar Objective C plugin from this Link
Add your local host for SonarQube server. Open
sonar-project.properties
file and add below command at top of the filesonar.host.url=<YOUR-LOCAL-HOST>
In Terminal go to your project's root directory and run below command to scan project for errors and bugs.
sonar-scanner
使用以下命令安装 SonarQube:
brew install sonar ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" < /dev/null 2> /dev/null
安装声纳扫描仪
brew install sonar-scanner
安装 Xctool
brew install xctool
安装 OCLint
brew tap oclint/formulae brew install oclint
安装 gcovr
brew install gcovr
为 Sonar Home 设置环境变量
export SONAR_HOME=/usr/local/Cellar/sonar-runner/2.4/libexec export SONAR=$SONAR_HOME/bin export PATH=$SONAR:$PATH
安装JAVA
brew cask install java
.properties
从此链接下载文件并更改项目名称、目标和方案将
.properties
文件复制并粘贴到您的项目根目录安装 Maven - 需要运行 Objective C 插件
brew install maven
从此链接下载声纳目标 C 插件
为 SonarQube 服务器添加本地主机。打开
sonar-project.properties
文件并在文件顶部添加以下命令sonar.host.url=<YOUR-LOCAL-HOST>
在终端中,转到项目的根目录并运行以下命令以扫描项目中的错误和错误。
sonar-scanner