Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Xcode 7 profdata support #104

Open
wants to merge 137 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
137 commits
Select commit Hold shift + click to select a range
5ba12b0
work started on lexer/parser
metebalci Jul 19, 2012
bf32b35
Merge branch 'punc' into gramstat
metebalci Jul 19, 2012
e952c02
simple send message expression grammar rule is added and it seems to …
metebalci Jul 19, 2012
2cba5b8
more
metebalci Jul 20, 2012
cc021ba
Merge branch 'gramstat' of https://github.com/metebalci/sonar-objecti…
Jul 26, 2012
8f891db
Added FauxPas Sensor
Feb 12, 2015
efc80bb
Added global 'Objective-C' profile with OCLint and FauxPas repos
Feb 16, 2015
1db7260
Run fauxpas command line in run-sonar.sh if installed
Feb 17, 2015
ca85f2c
Removed key from rule name updateFauxPasRules.groovy
Feb 17, 2015
8e124d5
Moved OCLint long line threshold to 250
Feb 17, 2015
cdecbf2
Added some FauxPas rules to SQALE model (to be continued)
Feb 18, 2015
9e309a0
Added remaining FauxPas rules to SQALE model
Feb 18, 2015
d2b25bd
Documentation update
Feb 19, 2015
6061690
Mentioned Backelite in new files
Feb 19, 2015
9e1766f
Merge branch 'feat/fauxpas' into develop
Feb 19, 2015
3300a5c
Tried to restore broken files
Feb 19, 2015
f071028
Merge branch 'feat/fauxpas' into develop
Feb 19, 2015
1f34ef4
Restored original headers
Feb 19, 2015
da229cf
Merge branch 'feat/fauxpas' into develop
Feb 19, 2015
a599ae5
Documentation updated
Feb 19, 2015
e233b20
Add the `plain` reporter at build step to get more information in cas…
Feb 20, 2015
12d864b
Updated sample sonar-project.properties
Feb 23, 2015
e626f98
Merge branch 'feat/fauxpas' into develop
Feb 23, 2015
ea952d7
Capitalized OCLint rule names
Feb 27, 2015
2d37a17
Cleared System.out
Feb 27, 2015
ff08878
Documentation update
Feb 27, 2015
09c18e3
Documentation update
Feb 27, 2015
b69ba3b
Added workspace switch to faux pas command
Mar 2, 2015
800d9b5
Merge branch 'feat/fauxpas' into develop
Mar 2, 2015
0ac8b7b
Added default description for FauxPas violation when not available fr…
Jun 22, 2015
8a38dee
Faux Pas support for multiple projects
Jul 6, 2015
a389476
Dynamic coverage file path
Jul 6, 2015
744954e
Multiple OCLint report support
Jul 7, 2015
822b965
Fixed gcovr path in run-script.sh
Jul 7, 2015
966dfd6
Created symlinks for build files to avoid gcovr object-directory bug
Jul 7, 2015
22e0414
glover optimization (runs once only)
Jul 7, 2015
5a0e88e
Fixed wrong coverage report
Jul 8, 2015
5ab1dcf
Fix for high "hits" value in coverage report
Sep 22, 2015
551ab25
Added FauxPas 1.5 new rules to repository
Sep 22, 2015
7c5b2a8
Updated Faux Pas rules for 1.6 support
Oct 19, 2015
6772f61
Refactored SQALE model
Nov 12, 2015
cc45ea7
Build script fix
Nov 12, 2015
968ac83
Merge branch 'develop'
Nov 12, 2015
f9b08f0
Version bumped to 0.4.0.2
Nov 12, 2015
481ba0c
README update
Nov 12, 2015
2737db6
README fix
Nov 12, 2015
4c5480a
profdata support
Dec 15, 2015
8001e89
Fixed legacy coverage xcodebuild command support
Dec 16, 2015
292b129
Added back xctools to required (mandatory for OCLint)
Dec 16, 2015
1974bdd
Merge branch 'develop'
Jan 12, 2016
780e65c
Version and README update
Jan 12, 2016
8a5719b
run-sonar.sh fixes
Jan 25, 2016
f032f09
Updated run script
Jan 25, 2016
f52392b
Script fix
Jan 25, 2016
110ad39
Run script fix (again)
Jan 25, 2016
b81c74a
Run script optim
Jan 26, 2016
3ad174d
Run script update
Jan 26, 2016
63ca251
Coverage computed on first project if multiple provided
Feb 2, 2016
0ca1a87
Added instructions for xcpretty fixed install
Feb 8, 2016
a04a88e
Refactoring of deprecated APIs part 1
Feb 19, 2016
6bc5e90
Finished deprecated API refactoring
Feb 29, 2016
13b6238
Version update
Feb 29, 2016
12b2a7a
Version update
Feb 29, 2016
097b37a
Complexity with Lizard
Mar 3, 2016
74b05cf
Release 0.5.1
Mar 3, 2016
f98522e
Install guide update
Mar 3, 2016
2a6b4cd
README fix
zippy1978 Mar 7, 2016
6681be9
Fixing issues in run-sonar.sh
mikaristimaki Mar 17, 2016
adaa151
Coverage support for Xcode 7.3 with new slather
Apr 6, 2016
077a4a3
Xcode 7.3 coverage fix + README update
Apr 6, 2016
7fa892d
Coverage support for Xcode 7.3 with new slather
Apr 6, 2016
06ff902
Xcode 7.3 coverage fix + README update
Apr 6, 2016
17496bf
README.md update
Apr 19, 2016
141aac8
README.md update
Apr 19, 2016
994944f
Included category naming case when searching for test source files wh…
mihaiparv May 11, 2016
078f548
Fix paths to OCLint online documentation
Aug 3, 2016
8561c7c
Update rules to support OCLint 0.10.3
Aug 3, 2016
f630900
Merge pull request #8 from nberthet/develop
zippy1978 Aug 9, 2016
a514ec1
Updated SQLAE model for OCLint new rules
Aug 9, 2016
96351af
Updated version and release notes
Aug 9, 2016
f2d15ae
Do not check for gcovr as it is not available if there's only Xcode 8…
jcovoluntis Sep 21, 2016
7a701ca
Upgrade rules compatibility to OClint to 0.11
Nov 15, 2016
f6da0bd
Update README.md
leverdeterre Nov 15, 2016
6e042b0
Update OClint documentation link + number of rules
Nov 15, 2016
f161bb8
Restore Backelite ci-travis account
Nov 15, 2016
598bbd0
Merge pull request #13 from leverdeterre/develop
zippy1978 Nov 15, 2016
1406a8c
Merge pull request #10 from LiohAu/master
zippy1978 Dec 1, 2016
c54ee5e
Merge branch 'master' into develop
Dec 1, 2016
638671b
README update
Dec 1, 2016
b798ea6
Enhanced run-script from PR 2
Dec 1, 2016
884894a
Merge branch 'Miksu82-run-sonar-fixes' into develop
Dec 1, 2016
2034272
Updated README
Dec 1, 2016
413ff9d
Merge pull request #3 from mihaiparv/fix-ut-filename-match-pattern
zippy1978 Dec 1, 2016
0f55a13
Merge branch 'develop'
Dec 1, 2016
214eabc
README update
Dec 1, 2016
fe098d3
Support for SonarQube 6
Dec 6, 2016
387a96e
Fixed 'test_data' issue with SonarQube 6.2
Feb 22, 2017
6be95c5
Merge branch 'feat/sonarqube6' into develop
Feb 22, 2017
57f2e4d
pom.xml version bump
Feb 22, 2017
5a8509c
Sonar 6 fix for Faux Pas
Mar 7, 2017
e0c2b5d
Sonar 6 - OCLint compatibility
Mar 7, 2017
5dd7460
Add support for Objective-C++ (.mm) files
Mar 8, 2017
17b311c
Add -nounittests and -usesonarscanner parameters to run-sonar.sh script
davidy4ng Mar 17, 2017
c27b774
Update run-sonar.sh
davidy4ng Mar 17, 2017
3948373
Replace oclint-xcodebuild by xcpretty
davidy4ng Mar 28, 2017
e84077e
fix : XCPRETTY_CMD usage
davidy4ng Mar 28, 2017
bc54b5a
Fix XCPRETTY_CMD usage
davidy4ng Mar 28, 2017
c1c65b2
Prepared README for next release
Apr 21, 2017
418557b
Merge pull request #25 from Backelite/fix-oclint-xcodebuild-deprecated
zippy1978 Apr 21, 2017
434bed6
Merge branch 'master' into develop
Apr 21, 2017
72b10cf
Merge pull request #23 from Backelite/davidy4ng-patch-run-sonar-params
zippy1978 Apr 21, 2017
02a47c9
Merge branch 'master' into develop
Apr 21, 2017
300cf29
Updated README
Apr 21, 2017
efcadb8
Merge pull request #20 from macostea/develop
zippy1978 Apr 21, 2017
755a45f
README update
Apr 21, 2017
d3e52e8
Version bump
Apr 21, 2017
8efcf45
Update run-sonar.sh : xcodebuild optimization
davidy4ng May 3, 2017
6d1d56e
Fix for properties with space
Branlute May 22, 2017
5883e8f
Merge pull request #26 from Backelite/fix/xcodebuild-testwithoutbuilding
zippy1978 Dec 4, 2017
4ee2c10
Version bump
Dec 4, 2017
1ac66c2
Merge pull request #29 from STEAMULO/fixSpace
zippy1978 Dec 4, 2017
61b23f6
Xcode 9 fix with OCLint
Dec 4, 2017
38a74c5
SonarQube 6.5 support
Dec 5, 2017
76b64ca
Added FauxPas new rules
Dec 5, 2017
c933413
OCLint rules update
Dec 5, 2017
446b27c
Develop merge
Dec 5, 2017
66ac34e
Fixed run-sonar.sh conflit
Dec 6, 2017
a960830
Fixed second run-script.sh conflict
Dec 6, 2017
90b5161
Updated README file
Dec 6, 2017
37daaa3
Removed JDK under 8 in Travis
Dec 6, 2017
1e264ed
PersistanceMode dropped by sonarqube 7.0
Mar 8, 2018
e8b0e17
Merge pull request #58 from Pavel87/develop
meltenc Jul 16, 2018
96d4fdd
SonarQube 7.0 support
Aug 23, 2018
b836820
Merge branch 'develop' of https://github.com/Backelite/sonar-objectiv…
Aug 23, 2018
4e8e715
Fixed release number
Aug 23, 2018
57539f1
README.md : maintenance stopped
zippy1978 Aug 28, 2018
8742a6f
Merge branch 'develop' of https://github.com/Backelite/sonar-objectiv…
Aug 28, 2018
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
language: java
jdk:
- oraclejdk8
- oraclejdk7
- openjdk7
- openjdk6
192 changes: 133 additions & 59 deletions README.md
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,88 +1,162 @@
SonarQube Plugin for Objective C
================================
# Important : this plugin is not maintained anymore. Please switch to our (Swift plugin)[https://github.com/Backelite/sonar-swift] which now supports Swift and Objective-C


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.

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.
<p align="left">
<img src="https://www.backelite.com/wp-content/uploads/2016/09/logo-backelite-square.png" width="100"/>
</p>

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.
| Branch | Status |
|----------|:------------------------------------------------------------------------------------------------------------------------------------------:|
| master | [![Build Status](https://travis-ci.org/Backelite/sonar-objective-c.svg?branch=master)](https://travis-ci.org/Backelite/sonar-objective-c) |
| develop| [![Build Status](https://travis-ci.org/Backelite/sonar-objective-c.svg?branch=develop)](https://travis-ci.org/Backelite/sonar-objective-c) |

SonarQube Plugin for Objective-C
================================

Find below an example of an iOS SonarQube dashboard:
This repository is a fork of the open source [SonarQube Plugin for Objective-C](https://github.com/octo-technology/sonar-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](https://github.com/semweb/GreatReader):
<p align="center">
<img src="sample/screen%20shot%20SonarQube%20dashboard.png" alt="Example iOS SonarQube dashboard" width="80%"/>
<img src="sample/screen%20shot%20SonarQube%20dashboard.png" alt="Example iOS SonarQube dashboard" width="100%"/>
</p>

###Features
### Features

- [ ] Complexity
- [ ] Design
- [x] Documentation
- [x] Duplications
- [x] Issues
- [x] Size
- [x] Tests
| Feature | Supported | Details |
|---------------|----------|:-----------:|
| Complexity |YES | Uses [Lizard](https://github.com/terryyin/lizard) |
| Design |NO | |
| Documentation |YES | |
| Duplications |YES | |
| Issues |YES | Uses [OCLint](http://docs.oclint.org/en/dev/intro/installation.html): 71 rules, and [Faux Pas](http://fauxpasapp.com/): 102 rules|
| Size |YES | |
| Tests |YES | Uses [xctool](https://github.com/facebook/xctool), will probably switch to xcodebuild + [xcpretty](https://github.com/supermarin/xcpretty) soon |
| Code coverage |YES | With [gcovr](http://gcovr.com) for project before Xcode 7, otherwise [slather](https://github.com/venmo/slather)|

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

###Compatibility
### Compatibility

- Use 0.3.x releases for SonarQube 3.x
- Use 0.4.x releases for SonarQube 4.x
Releases available from this repository are compliant with SonarQube 4.3.x and above.

###Download
In order not to break compatibility with the original plugin, plugin releases are numbered with 4 digits.

The latest version is the 0.4.x is not yet released and is available as a snapshot [here](https://rfelden.ci.cloudbees.com/job/sonar-objective-c/lastSuccessfulBuild/artifact/target/).
The latest SonarQube 3.x release is the 0.3.1, and it's available [here](http://bit.ly/1fSwd5I).

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

In the worst case, the Maven repository with all snapshots and releases is available here: http://repository-rfelden.forge.cloudbees.com/
### Faux Pas support

[Faux Pas](http://fauxpasapp.com/) is a wonderful tool to analyse iOS or Mac applications source code, however it is not free. A 30 trial version is available [here](http://fauxpasapp.com/try/).

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.6.3
- SonarQube 7.0 support

### 0.6.2
- SonarQube 6.7 support
- FauxPas 1.7.2 support (4 new rules added)
- OCLint 0.13 support (1 new rule added)
- Update run-sonar.sh : xcodebuild optimization (see https://github.com/Backelite/sonar-objective-c/pull/26 thanks to [davidy4ng](https://github.com/davidy4ng)).
- Fix for properties with space (see https://github.com/Backelite/sonar-objective-c/pull/29 thanks to [Branlute](https://github.com/Branlute))


### 0.6.1
- Replaced oclint-xcodebuild by xcpretty (see https://github.com/Backelite/sonar-objective-c/pull/25 thanks to [davidy4ng](https://github.com/davidy4ng)).
- Added -nounittests and -usesonarscanner parameters to run-sonar.sh script (see https://github.com/Backelite/sonar-objective-c/pull/23 thanks to [davidy4ng](https://github.com/davidy4ng)).
- Sonar 6 fix for Faux Pas (see https://github.com/Backelite/sonar-objective-c/pull/20 thanks to [macostea](https://github.com/macostea)).

### 0.6.0
- SonarQube 6 support. Important : will work with SonarQube 5.x and above only. Will not work anymore with SonarQube 4.5.x anymore.

###Prerequisites
### 0.5.2
- OCLint 0.11.0 support (see https://github.com/Backelite/sonar-objective-c/pull/13)
- Removed required gcovr check in run-sonar.sh (see https://github.com/Backelite/sonar-objective-c/pull/10)
- Fixed issued in run-sonar.sh (see https://github.com/Backelite/sonar-objective-c/pull/2)
- Better test file detection pattern (see https://github.com/Backelite/sonar-objective-c/pull/3/files)

- a Mac with Xcode...
#### 0.5.1
- Complexity with Lizard !

#### 0.5.0 (detached from octo project)
- Detached from octo project (to hard to maintain compatibility)
- Removed deprecated API usages for Sonarube 5.3 support

#### 0.4.0.3 (based on 0.4.0)
- Xcode 7 coverage support (profdata)

#### 0.4.0.2 (based on 0.4.0)
- Faux Pas support for release 1.5 and 1.6
- Support for multiple projects in a same workspace

#### 0.4.0.1 (based on 0.4.0)
- Faux Pas support
- Moved OCLint long line threshold to 250
- Add the `plain` reporter at build step to get more information in case of build failure
- Capitalized OCLint rule names


### Prerequisites

- a Mac with Xcode
- [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```)
- [xcpretty](https://github.com/supermarin/xcpretty) (see instructions below)
- [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.
- [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```).
- [gcovr](http://gcovr.com) installed
- [OCLint](http://oclint-docs.readthedocs.io/en/stable/) installed. Version 0.11.0 recommended (0.13.0 since Xcode 9).
- [gcovr](http://gcovr.com) installed for legacy (pre Xcode 7 coverage)
- [slather](https://github.com/SlatherOrg/slather) (```gem install slather```). Version 2.1.0 or above (2.4.4 since Xcode 9).
- [lizard](https://github.com/terryyin/lizard) ([PIP](https://pip.pypa.io/en/stable/installing/) installed and ```sudo pip install lizard```)
- [Faux Pas](http://fauxpasapp.com/) command line tools installed (optional)

### Installation of xcpretty with JUnit reports fix

At the time, xcpretty needs to be fixed to work with SonarQube.

###Installation (once for all your Objective-C projects)
- Install [the plugin](http://bit.ly/1fSwd5I) through the Update Center (of SonarQube) or download it into the $SONARQUBE_HOME/extensions/plugins directory
- Copy [run-sonar.sh](https://rawgithub.com/octo-technology/sonar-objective-c/master/src/main/shell/run-sonar.sh) somewhere in your PATH
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)
- Download the plugin binary into the $SONARQUBE_HOME/extensions/plugins directory
- Copy [run-sonar.sh](https://rawgithub.com/Backelite/sonar-objective-c/master/src/main/shell/run-sonar.sh) somewhere in your PATH
- Restart the SonarQube server.

###Configuration (once per project)
- 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)
- Edit the *sonar-project.properties* file to match your Xcode iOS/MacOS project
### Configuration (once per project)
- Copy [sonar-project.properties](https://rawgithub.com/Backelite/sonar-objective-c/master/sample/sonar-project.properties) in your Xcode project root folder (along your .xcodeproj file)
- Edit the ```sonar-project.properties``` file to match your Xcode iOS/MacOS project

**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.

###Analysis
### Analysis
- Run the script ```run-sonar.sh``` in your Xcode project root folder
- Enjoy or file an issue!

###Update (once per plugin update)
- Install the [latest plugin](http://bit.ly/1fSwd5I) version
- Copy [run-sonar.sh](https://rawgithub.com/octo-technology/sonar-objective-c/master/src/main/shell/run-sonar.sh) somewhere in your PATH
### Update (once per plugin update)
- Install the lastest plugin version
- Copy ```run-sonar.sh``` somewhere in your PATH

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

###Credits
* **Cyril Picat**
* **Denis Bregeon**
* **Gilles Grousset**
* **François Helg**
* **Romain Felden**
* **Mete Balci**

###History
- v0.4.0 (SOON): support for SonarQube 4.x
- v0.3.1 (2013/10): fix release
- v0.3 (2013/10): added support for OCUnit tests and test coverage
- v0.2 (2013/10): added OCLint checks as SonarQube violations
- v0.0.1 (2012/09): v0 with basic metrics such as nb lines of code, nb lines of comment, nb of files, duplications

###License

SonarQube Plugin for Objective C is released under the GNU LGPL 3 license:
http://www.gnu.org/licenses/lgpl.txt
### Contributing

Feel free to contribute to this plugin by issuing pull requests to this repository or to the [original one](https://github.com/octo-technology/sonar-objective-c).

### License

SonarQube Plugin for Objective-C is released under the [GNU LGPL 3 license](http://www.gnu.org/licenses/lgpl.txt).
12 changes: 4 additions & 8 deletions build-and-deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,13 @@ if [ "$?" != 0 ]; then
exit $?
fi

# Run shell tests
#shelltest src/test/shell --execdir --diff
#if [ "$?" != 0 ]; then
# echo "ERROR - Shell tests failed!" 1>&2
# exit $?
#fi

# Deploy new verion of plugin in Sonar dir
cp target/*.jar $SONARQUBE_HOME/extensions/plugins
rm -rf $SONARQUBE_HOME/extensions/plugins/*sonar-objective-c-*
cp sonar-objective-c-plugin/target/*.jar $SONARQUBE_HOME/extensions/plugins
rm $SONARQUBE_HOME/extensions/plugins/*sources.jar

# Stop/start Sonar
unset GEM_PATH GEM_HOME
$SONARQUBE_HOME/bin/macosx-universal-64/sonar.sh stop
$SONARQUBE_HOME/bin/macosx-universal-64/sonar.sh start

Loading