Branch | Status |
---|---|
master | |
develop |
This is an open source initiative for Apple Swift language support in SonarQube. The structure of the plugin is based on the sonar-objective-c plugin.
In SonarQube under Quality Profiles the used Linter can be specified by selecting either the SwiftLint Profile or the Tailor Profile as Default profile for Swift Projects:
Feature | Supported | MacOS | Unix |
---|---|---|---|
Complexity | YES | Uses Lizard | Uses Lizard |
Design | NO | ||
Documentation | YES | ||
Duplications | YES | ||
Issues | YES | Uses SwiftLint and/or Tailor for Swift. OCLint and Faux Pas for Objective-C | Uses Tailor |
Size | YES | ||
Tests | YES | Uses xcodebuild + xcpretty xcpretty | Not Supported |
Code coverage | YES | Uses slather | Not Supported |
Faux Pas is a wonderful tool to analyse iOS or Mac applications Objective-C 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).
Checkout the Releases page.
The full release history is also available in CHANGELOG.md.
If you use fastlane, please read our fastlane integration doc.
Otherwise, run the run-sonar-swift.sh
script from your Xcode project root folder
brew install swiftlint
). Version 0.3.0 or above.brew install tailor
). Version 0.11.1 or above.gem install slather
). Version 2.1.0 or above (2.4 since Xcode 8.3).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
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-swift.sh
somewhere in your PATHIf you still have run-sonar-swift.sh file in each of your project (not recommended), you will need to update all those files.
Thank you for your interest in the project! Contributions are welcome and appreciated.
Make sure to read these guides before getting started:
SonarQube Plugin for Swift is released under the GNU LGPL v3 license. See the LICENSE file for more info.