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

[Usage] Add Fastlane example doc #33

Merged
merged 1 commit into from
Jun 29, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ The structure of the plugin is based on the [sonar-objective-c](https://github.c

Checkout the [Releases](https://github.com/Backelite/sonar-swift/releases) page.

###Launching an analysis
If you use [Fastlane](https://fastlane.tools), please read [our Fastlane integration doc](docs/sonarqube-fastlane.md).
Otherwise, run the ```run-sonar-swift.sh``` script from your Xcode project root folder

###Release history

####0.2.3
Expand Down Expand Up @@ -76,7 +80,7 @@ Checkout the [Releases](https://github.com/Backelite/sonar-swift/releases) page.

###Installation of xcpretty with JUnit reports fix

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

To install the fixed version, follow those steps :

Expand All @@ -97,10 +101,6 @@ To install the fixed version, follow those steps :

**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
- Run the script ```run-sonar-swift.sh``` in your Xcode project root folder
- Enjoy or file an issue!

###Update (once per plugin update)
- Install the lastest plugin version
- Copy ```run-sonar-swift.sh``` somewhere in your PATH
Expand Down
42 changes: 42 additions & 0 deletions docs/sonarqube-fastlane.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# Using with Fastlane 🚀

If you already use Fastlane, you can simply setup a new lane performing the analysis as follows:

```ruby
lane :metrics do
scan(scheme: "[SCHEME]", code_coverage: true, output_directory: "./reports")
slather(cobertura_xml: true, scheme: "[SCHEME]", output_directory: "./reports", proj: "./[PROJECT].xcodeproj")
sh("cd .. && lizard ./[SOURCE_FOLDER] -l swift --xml > ./reports/lizard-report.xml")
swiftlint(output_file: "./reports/swiftlint.txt", ignore_exit_status: true)
sonar
end

```

## Options

Fastlane's `sonar` action allows you to define or override a number of SonarQube properties, such as `sonar.project-version`.

For instance:

```ruby
sonar(project_version: "1.0b")
```

You can read the complete documentation of Fastlane's `sonar` action on your terminal via:

```bash
fastlane action sonar
```

## `sonar-project.properties`

Please note that, in order to have your analysis performed via the tools above, you'll need to setup your `sonar-project.properties` file accordingly, as per the following example.

```
sonar.junit.reportsPath=reports/
sonar.junit.include=*.junit
sonar.swift.lizard.report=reports/lizard-report.xml
sonar.swift.coverage.reportPattern=reports/cobertura.xml
sonar.swift.swiftlint.report=reports/*swiftlint.txt
```