Step 1. Add the JitPack repository to your build file
Add it in your root settings.gradle at the end of repositories:
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
mavenCentral()
maven { url 'https://jitpack.io' }
}
}
Add it in your settings.gradle.kts at the end of repositories:
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
mavenCentral()
maven { url = uri("https://jitpack.io") }
}
}
Add to pom.xml
<repositories>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
</repositories>
Add it in your build.sbt at the end of resolvers:
resolvers += "jitpack" at "https://jitpack.io"
Add it in your project.clj at the end of repositories:
:repositories [["jitpack" "https://jitpack.io"]]
Step 2. Add the dependency
dependencies {
implementation 'com.github.Backelite:sonar-objective-c:'
}
dependencies {
implementation("com.github.Backelite:sonar-objective-c:")
}
<dependency>
<groupId>com.github.Backelite</groupId>
<artifactId>sonar-objective-c</artifactId>
<version></version>
</dependency>
libraryDependencies += "com.github.Backelite" % "sonar-objective-c" % ""
:dependencies [[com.github.Backelite/sonar-objective-c ""]]
| Branch | Status |
|----------|:------------------------------------------------------------------------------------------------------------------------------------------:|
| master | |
| develop|
|
This repository is a fork of the open source SonarQube Plugin for Objective-C. It provides modifications and extra features needed for our internal use.
A SonarQube 5.0 dashboard of the iOS open source project GreatReader:
<p align="center"> <img src="sample/screen%20shot%20SonarQube%20dashboard.png" alt="Example iOS SonarQube dashboard" width="100%"/> </p>| Feature | Supported | Details | |---------------|----------|:-----------:| | Complexity |YES | Uses Lizard | | Design |NO | | | Documentation |YES | | | Duplications |YES | | | Issues |YES | Uses OCLint: 71 rules, and Faux Pas: 102 rules| | Size |YES | | | Tests |YES | Uses xctool, will probably switch to xcodebuild + xcpretty soon | | Code coverage |YES | With gcovr for project before Xcode 7, otherwise slather|
Releases available from this repository are compliant with SonarQube 4.3.x and above.
In order not to break compatibility with the original plugin, plugin releases are numbered with 4 digits.
Faux Pas is a wonderful tool to analyse iOS or Mac applications source code, however it is not free. A 30 trial version is available here.
The plugin runs fine even if Faux Pas is not installed (Faux Pas analysis will be skipped).
Binary packages are available in the release section.
plain
reporter at build step to get more information in case of build failurebrew install sonar-runner
)brew install xctool
). If you are using Xcode 6, make sure to update xctool (brew upgrade xctool
) to a version > 0.2.2.gem install slather
). Version 2.1.0 or above (2.4.4 since Xcode 9).sudo pip install lizard
)At the time, xcpretty needs to be fixed to work with SonarQube.
To install the fixed version, follow those steps :
git clone https://github.com/Backelite/xcpretty.git
cd xcpretty
git checkout fix/duration_of_failed_tests_workaround
gem build xcpretty.gemspec
sudo gem install --both xcpretty-0.2.2.gem
Since Xcode 7, Apple changed its coverage data format to a new format called 'profdata'. By default this format will be used by the plugin, except if you explicitly force it to legacy mode (for Xcode 6 and below) in your sonar-project.properties with this line:
sonar.objectivec.coverageType=legacy
sonar-project.properties
file to match your Xcode iOS/MacOS projectThe good news is that you don't have to modify your Xcode project to enable SonarQube!. Ok, there might be one needed modification if you don't have a specific scheme for your test target, but that's all.
run-sonar.sh
in your Xcode project root folderrun-sonar.sh
somewhere in your PATHIf you still have run-sonar.sh file in each of your project (not recommended), you will need to update all those files.
Feel free to contribute to this plugin by issuing pull requests to this repository or to the original one.
SonarQube Plugin for Objective-C is released under the GNU LGPL 3 license.