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.mihaiparv:sonar-objective-c:0.5.1'
}
dependencies {
implementation("com.github.mihaiparv:sonar-objective-c:0.5.1")
}
<dependency>
<groupId>com.github.mihaiparv</groupId>
<artifactId>sonar-objective-c</artifactId>
<version>0.5.1</version>
</dependency>
libraryDependencies += "com.github.mihaiparv" % "sonar-objective-c" % "0.5.1"
:dependencies [[com.github.mihaiparv/sonar-objective-c "0.5.1"]]
| 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>###Features
| Feature | Supported | Details | |---------------|----------|:-----------:| | Complexity |YES | Uses Lizard | | Design |NO | | | Documentation |YES | | | Duplications |YES | | | Issues |YES | Uses OCLint: 63 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|
###Compatibility
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 support
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).
###Download
Binary packages are available in the release section.
###Release history
####0.5.1
####0.5.0 (detached from octo project)
####0.4.0.3 (based on 0.4.0)
####0.4.0.2 (based on 0.4.0)
####0.4.0.1 (based on 0.4.0)
plain
reporter at build step to get more information in case of build failure###Prerequisites
brew 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.sudo pip install lizard
)###Installation of xcpretty with JUnit reports fix
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
###Code coverage data format
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
###Installation (once for all your Objective-C projects)
###Configuration (once per project)
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.
###Analysis
run-sonar.sh
in your Xcode project root folder###Update (once per plugin update)
run-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.
###Contributing
Feel free to contribute to this plugin by issuing pull requests to this repository or to the original one.
###License
SonarQube Plugin for Objective-C is released under the GNU LGPL 3 license.