Skip to content

Commit 5d55c56

Browse files
committed
Get rid of the nasty shell script, update sample properites and README
1 parent 2e7ca7b commit 5d55c56

File tree

6 files changed

+173
-843
lines changed

6 files changed

+173
-843
lines changed

README.md

+127-42
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,25 @@
1-
SonarQube Plugin for Objective C
2-
================================
1+
# SonarQube Plugin for Objective-C
32

4-
This repository hosts the Objective-C plugin for [SonarQube](http://www.sonarqube.org/). This plugin enables to analyze and track the quality of iOS (iPhone, iPad) and MacOS developments.
3+
This repository hosts the Objective-C plugin for
4+
[SonarQube](http://www.sonarqube.org/). This plugin aims to analyze and track
5+
the quality of iOS (iPhone, iPad) and MacOS projects, but it can be used with
6+
other Objective-C projects.
57

6-
This plugin is not supported by SonarSource. SonarSource offers a [commercial SonarSource Objective-C plugin](http://www.sonarsource.com/products/plugins/languages/objective-c/) as well. Both plugins do not offer the same functionalities/support.
8+
This plugin is not supported by SonarSource. SonarSource offers a
9+
[commercial SonarSource Objective-C plugin](http://www.sonarsource.com/products/plugins/languages/objective-c/)
10+
as well. The plugins do not offer the same features/support.
711

8-
The development of this plugin has always been done thanks to the community. If you wish to contribute, check the [Contributing](https://github.com/octo-technology/sonar-objective-c/wiki/Contributing) wiki page.
12+
The development of this plugin has always been done thanks to the community.
13+
If you wish to contribute, check the
14+
[Contributing](https://github.com/octo-technology/sonar-objective-c/wiki/Contributing)
15+
wiki page.
916

1017
Find below an example of an iOS SonarQube dashboard:
1118
<p align="center">
1219
<img src="sample/screen%20shot%20SonarQube%20dashboard.png" alt="Example iOS SonarQube dashboard" width="80%"/>
1320
</p>
1421

15-
###Features
22+
## Features
1623

1724
- [x] Complexity
1825
- [ ] Design
@@ -22,69 +29,147 @@ Find below an example of an iOS SonarQube dashboard:
2229
- [x] Size
2330
- [x] Tests
2431

25-
For more details, see the list of [SonarQube metrics](https://github.com/octo-technology/sonar-objective-c/wiki/Features) implemented or pending.
32+
For more details, see the list of
33+
[SonarQube metrics](https://github.com/octo-technology/sonar-objective-c/wiki/Features)
34+
implemented or pending.
2635

27-
###Compatibility
36+
37+
## Compatibility
2838

2939
- Use 0.3.x releases for SonarQube < 4.3
30-
- Use 0.4.x releases for SonarQube >= 4.3 (4.x and 5.x)
40+
- Use 0.4.0 or later releases for SonarQube >= 4.3 (4.x and 5.x)
41+
3142

32-
###Download
43+
## Download
3344

3445
The latest version is the 0.4.0 and it's available [here](http://bit.ly/18A7OkE).
3546
The latest SonarQube 3.x release is the 0.3.1, and it's available [here](http://bit.ly/1fSwd5I).
3647

37-
You can also download the latest build of the plugin from [Cloudbees](https://rfelden.ci.cloudbees.com/job/sonar-objective-c/lastSuccessfulBuild/artifact/target/).
48+
You can also download the latest build of the plugin from
49+
[Cloudbees](https://rfelden.ci.cloudbees.com/job/sonar-objective-c/lastSuccessfulBuild/artifact/target/).
3850

39-
In the worst case, the Maven repository with all snapshots and releases is available here: http://repository-rfelden.forge.cloudbees.com/
51+
In the worst case, the Maven repository with all snapshots and releases is
52+
available here: http://repository-rfelden.forge.cloudbees.com/
53+
54+
55+
## Prerequisites
56+
57+
- A Mac with Xcode
58+
- Optional: [Homebrew](http://brew.sh) for easier prerequisite installation
59+
- [SonarQube](http://docs.codehaus.org/display/SONAR/Setup+and+Upgrade)
60+
- [SonarQube Runner](http://docs.codehaus.org/display/SONAR/Installing+and+Configuring+SonarQube+Runner) (```brew install sonar-runner```)
61+
62+
### JUnit
63+
64+
Any of the following will produce JUnit XML reports for your project:
65+
66+
- [xctool](https://github.com/facebook/xctool) (```brew install xctool```)
67+
- This is actually a substitute for xcodebuild, so it will compile your app and run tests as part of the process
68+
- Make sure the version of xctool you use is compatible with the version of Xcode you will be building with
69+
- [xcpretty](https://github.com/supermarin/xcpretty) (```gem install xcpretty```)
70+
- This will parse xcodebuild's output and prettify it, with the option of generating a JUnit XML report and/or JSON compilation database
71+
- [ocunit2junit](https://github.com/ciryon/OCUnit2JUnit) (```gem install ocunit2junit```)
72+
- This will parse xcodebuild's output and generate a JUnit XML report
73+
74+
75+
### Coverage
76+
77+
Run your tests with code coverage enabled, then run one of the following tools
78+
to produce a Cobertura XML report which can be imported by this plugin.
79+
80+
- With Xcode prior to version 7, use [gcovr](http://gcovr.com) to parse ```*.gcda``` and ```*.gcno``` files
81+
- With Xcode 7 or greater, use [slather](https://github.com/venmo/slather) to parse the ```Coverage.profdata``` file
82+
- Note: at time of writing, support for the ```*.profdata``` format has not been released, but can be installed by running ```gem install specific_install && gem specific_install -l https://github.com/viteinfinite/slather.git -b 61f00988e6ad65f817ba81b08533cf78615fff16```
83+
- Note: at time of writing, xctool is not capable of producing coverage data when using Xcode 7+
84+
85+
86+
### Clang
87+
88+
[Clang Static Analyzer](http://clang-analyzer.llvm.org/) can produce Plist
89+
reports which can be imported by this plugin.
90+
91+
There are different ways to produce the reports, such as using Clang's
92+
[scan-build](http://clang-analyzer.llvm.org/scan-build.html), however it's
93+
probably easiest to use xcodebuild's ```analyze``` action. Xcodebuild will
94+
invoke the analyzer with all the proper arguments and use any additional
95+
analyzer configuration from your settings under ```*.xcodeproj```. By default,
96+
it will produce the Plist reports this plugin needs.
97+
4098

41-
###Prerequisites
99+
### OCLint
42100

43-
- a Mac with Xcode...
44-
- [SonarQube](http://docs.codehaus.org/display/SONAR/Setup+and+Upgrade) and [SonarQube Runner](http://docs.codehaus.org/display/SONAR/Installing+and+Configuring+SonarQube+Runner) installed ([HomeBrew](http://brew.sh) installed and ```brew install sonar-runner```)
45-
- [xctool](https://github.com/facebook/xctool) ([HomeBrew](http://brew.sh) installed and ```brew install xctool```). If you are using Xcode 6, make sure to update xctool (```brew upgrade xctool```) to a version > 0.2.2.
46-
- [OCLint](http://docs.oclint.org/en/dev/intro/installation.html) installed. Version 0.8.1 recommended ([HomeBrew](http://brew.sh) installed and ```brew install https://gist.githubusercontent.com/TonyAnhTran/e1522b93853c5a456b74/raw/157549c7a77261e906fb88bc5606afd8bd727a73/oclint.rb```).
47-
- [gcovr](http://gcovr.com) installed
48-
- [lizard](https://github.com/terryyin/lizard) installed
101+
[OCLint](http://docs.oclint.org/en/dev/intro/installation.html) version 0.8.1 recommended
102+
(```brew install https://gist.githubusercontent.com/TonyAnhTran/e1522b93853c5a456b74/raw/157549c7a77261e906fb88bc5606afd8bd727a73/oclint.rb```).
103+
Use it to produce a PMD-formatted XML report that can be imported by this
104+
plugin.
49105

50-
###Installation (once for all your Objective-C projects)
51-
- Install [the plugin](http://bit.ly/18A7OkE) through the Update Center (of SonarQube) or download it into the $SONARQUBE_HOME/extensions/plugins directory
52-
- Copy [run-sonar.sh](https://rawgithub.com/octo-technology/sonar-objective-c/master/src/main/shell/run-sonar.sh) somewhere in your PATH
53-
- Restart the SonarQube server.
54106

55-
###Configuration (once per project)
56-
- Copy [sonar-project.properties](https://rawgithub.com/octo-technology/sonar-objective-c/master/sample/sonar-project.properties) in your Xcode project root folder (along your .xcodeproj file)
57-
- Edit the *sonar-project.properties* file to match your Xcode iOS/MacOS project
107+
### Complexity
58108

59-
**The 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.
109+
Use [Lizard](https://github.com/terryyin/lizard) (```pip install lizard```)
110+
to produce an XML report that can be imported by this plugin.
60111

61-
###Analysis
62-
- Run the script ```run-sonar.sh``` in your Xcode project root folder
112+
113+
## Installation (once for all your Objective-C projects)
114+
115+
1. Install [the plugin](http://bit.ly/18A7OkE) through the Update Center (of SonarQube) or download it into the $SONARQUBE_HOME/extensions/plugins directory
116+
2. Restart the SonarQube server.
117+
118+
119+
## Configuration (once per project)
120+
121+
Create a ```sonar-project.properties``` file defining some basic project
122+
configuration and the location of the reports you want to import.
123+
124+
**The good news is that you don't have to modify your Xcode project to enable
125+
SonarQube!**. Ok, there might be needed modification if you don't have a
126+
specific scheme for your test target or if coverage is not enabled, but that's all.
127+
128+
129+
## Analysis
130+
131+
- Run your build script to produce the various reports
132+
- Run ```sonar-runner```
63133
- Enjoy or file an issue!
64134

65-
###Update (once per plugin update)
135+
136+
## Update
137+
66138
- Install the [latest plugin](http://bit.ly/18A7OkE) version
67-
- Copy [run-sonar.sh](https://rawgithub.com/octo-technology/sonar-objective-c/master/src/main/shell/run-sonar.sh) somewhere in your PATH
139+
- Check for documented migration steps
140+
141+
### Migration to v0.5.x
142+
143+
- Analysis property names have changed. Check the sample.
144+
- Coverage report property no longer supports pattern matching. Only one coverage XML file is supported.
145+
- ```sonar.language``` key changed from ```objc``` to ```objectivec```
146+
- As a side effect you may have to reconfigure your Quality Profiles
68147

69-
If you still have *run-sonar.sh* file in each of your project (not recommended), you will need to update all those files.
70148

71-
###Credits
72-
* **Cyril Picat**
73-
* **Gilles Grousset**
74-
* **Denis Bregeon**
75-
* **François Helg**
76-
* **Romain Felden**
77-
* **Mete Balci**
149+
## Contributors
78150

79-
###History
151+
- Cyril Picat
152+
- Gilles Grousset
153+
- Denis Bregeon
154+
- François Helg
155+
- Romain Felden
156+
- Mete Balci
157+
- Andrés Gil Herrera
158+
- Matthew DeTullio
159+
160+
161+
## History
162+
163+
- v0.5.0 (2015/11): added support for Clang, made properties configurable in SonarQube UI, major refactoring
80164
- v0.4.1 (2015/05): added support for Lizard to implement complexity metrics.
81165
- v0.4.0 (2015/01): support for SonarQube >= 4.3 (4.x & 5.x)
82166
- v0.3.1 (2013/10): fix release
83167
- v0.3 (2013/10): added support for OCUnit tests and test coverage
84168
- v0.2 (2013/10): added OCLint checks as SonarQube violations
85169
- v0.0.1 (2012/09): v0 with basic metrics such as nb lines of code, nb lines of comment, nb of files, duplications
86170

87-
###License
88171

89-
SonarQube Plugin for Objective C is released under the GNU LGPL 3 license:
172+
## License
173+
174+
SonarQube Plugin for Objective-C is released under the GNU LGPL 3 license:
90175
http://www.gnu.org/licenses/lgpl.txt

sample/sonar-project.properties

+46-43
Original file line numberDiff line numberDiff line change
@@ -1,60 +1,63 @@
1-
##########################
2-
# Required configuration #
3-
##########################
4-
5-
sonar.projectKey=my-project
1+
# Required
2+
sonar.projectKey=com.example:my-project
3+
# Required
64
sonar.projectName=My project
5+
# Required
76
sonar.projectVersion=1.0
8-
sonar.language=objc
9-
10-
# Project description
7+
8+
# Optional
119
sonar.projectDescription=Fake description
12-
13-
# Path to source directories
10+
11+
# Required
12+
# Path to source directories
1413
sonar.sources=srcDir1,srcDir2
15-
# Path to test directories (comment if no test)
14+
15+
# Optional
16+
sonar.inclusions=subDir1/**,subDir2/**
17+
# Optional
18+
sonar.exclusions=**/generatedDir/**,**/thirdpartyDir/**
19+
20+
# Optional
21+
# Path to test directories
1622
sonar.tests=testSrcDir
1723

18-
19-
# Xcode project configuration (.xcodeproj or .xcworkspace)
20-
# -> If you have a project: configure only sonar.objectivec.project
21-
# -> If you have a workspace: configure sonar.objectivec.workspace and sonar.objectivec.project
22-
# and use the later to specify which project(s) to include in the analysis (comma separated list)
23-
sonar.objectivec.project=myApplication.xcodeproj
24-
# sonar.objectivec.workspace=myApplication.xcworkspace
25-
26-
# Scheme to build your application
27-
sonar.objectivec.appScheme=myApplication
28-
# Scheme to build and run your tests (comment following line of you don't have any tests)
29-
sonar.objectivec.testScheme=myApplicationTests
30-
31-
##########################
32-
# Optional configuration #
33-
##########################
24+
# Optional
25+
sonar.test.inclusions=subDir3/**
26+
# Optional
27+
sonar.test.exclusions=
28+
29+
# Recommended
30+
# Add language property to limit to single-language analysis
31+
sonar.language=objectivec
32+
33+
# Define suffixes for multi-language analysis
34+
# There will likely be problems if you have any other C/C++/Obj-C plugin(s) installed due to each language using .h files
35+
sonar.objectivec.file.suffixes=.h,.m
3436

3537
# Encoding of the source code
3638
sonar.sourceEncoding=UTF-8
3739

38-
# JUnit report generated by run-sonar.sh is stored in sonar-reports/TEST-report.xml
39-
# Change it only if you generate the file on your own
40-
# The XML files have to be prefixed by TEST- otherwise they are not processed
41-
# sonar.junit.reportsPath=sonar-reports/
40+
# Optional
41+
# Folder with JUnit XML reports matching format of "TEST*.xml"
42+
# Generate this with xctool, xcpretty, or ocunit2junit
43+
sonar.objectivec.junit.reportsPath=sonar-reports/junit
4244

43-
# Cobertura report generated by run-sonar.sh is stored in sonar-reports/coverage.xml
44-
# Change it only if you generate the file on your own
45-
# sonar.objectivec.coverage.reportPattern=sonar-reports/coverage*.xml
45+
# Optional
46+
# Path to Cobertura XML report
47+
# Generate this with gcovr (Xcode < 7) or slather (Xcode >= 7)
48+
sonar.objectivec.cobertura.reportPath=sonar-reports/cobertura.xml
4649

47-
# OCLint report generated by run-sonar.sh is stored in sonar-reports/oclint.xml
48-
# Change it only if you generate the file on your own
49-
# sonar.objectivec.oclint.report=sonar-reports/oclint.xml
50+
# Optional
51+
# Path to OCLint PMD formatted XML report
52+
sonar.objectivec.oclint.reportPath=sonar-reports/oclint.xml
5053

51-
# Lizard report generated by run-sonar.sh is stored in sonar-reports/lizard-report.xml
52-
# Change it only if you generate the file on your own
53-
# sonar.objectivec.lizard.report=sonar-reports/lizard-report.xml
54+
# Optional
55+
# Folder with Clang Plist reports matching format of "*.plist"
56+
sonar.objectivec.clang.reportsPath=sonar-reports/clang
5457

55-
# Paths to exclude from coverage report (tests, 3rd party libraries etc.)
56-
# sonar.objectivec.excludedPathsFromCoverage=pattern1,pattern2
57-
sonar.objectivec.excludedPathsFromCoverage=.*Tests.*
58+
# Optional
59+
# Path to Lizard XML report
60+
sonar.objectivec.lizard.reportPath=sonar-reports/lizard.xml
5861

5962
# Project SCM settings
6063
# sonar.scm.enabled=true

0 commit comments

Comments
 (0)