sonar

Invokes sonar-scanner to programmatically run SonarQube analysis

See http://docs.sonarqube.org/display/SCAN/Analyzing+with+SonarQube+Scanner for details.
It can process unit test results if formatted as junit report as shown in xctest action. It can also integrate coverage reports in Cobertura format, which can be transformed into by the slather action.

sonar
Supported platforms ios, android, mac
Author @c_gretzki
Returns The exit code of the sonar-scanner binary

1 Example

sonar(
  project_key: "name.gretzki.awesomeApp",
  project_version: "1.0",
  project_name: "iOS - AwesomeApp",
  sources_path: File.expand_path("../AwesomeApp")
)

Parameters

Key Description Default
project_configuration_path The path to your sonar project configuration file; defaults to sonar-project.properties
project_key The key sonar uses to identify the project, e.g. name.gretzki.awesomeApp. Must either be specified here or inside the sonar project configuration file
project_name The name of the project that gets displayed on the sonar report page. Must either be specified here or inside the sonar project configuration file
project_version The project's version that gets displayed on the sonar report page. Must either be specified here or inside the sonar project configuration file
sources_path Comma-separated paths to directories containing source files. Must either be specified here or inside the sonar project configuration file
project_language Language key, e.g. objc
source_encoding Used encoding of source files, e.g., UTF-8
sonar_runner_args Pass additional arguments to sonar-scanner. Be sure to provide the arguments with a leading -D e.g. FL_SONAR_RUNNER_ARGS="-Dsonar.verbose=true"
sonar_login Pass the Sonar Login token (e.g: xxxxxxprivate_token_XXXXbXX7e)
sonar_url Pass the url of the Sonar server
branch_name Pass the branch name which is getting scanned

* = default value is dependent on the user's system


Documentation

To show the documentation in your terminal, run

fastlane action sonar

CLI

It is recommended to add the above action into your Fastfile, however sometimes you might want to run one-offs. To do so, you can run the following command from your terminal

fastlane run sonar

To pass parameters, make use of the : symbol, for example

fastlane run sonar parameter1:"value1" parameter2:"value2"

It's important to note that the CLI supports primitive types like integers, floats, booleans, and strings. Arrays can be passed as a comma delimited string (e.g. param:"1,2,3"). Hashes are not currently supported.

It is recommended to add all fastlane actions you use to your Fastfile.


Source code

This action, just like the rest of fastlane, is fully open source, view the source code on GitHub


Back to actions