If you already use Fastlane, you can simply setup a new lane performing the analysis as follows:
lane :metrics do
scan(scheme: "[SCHEME]", code_coverage: true, xcargs: "-derivedDataPath ./DerivedData", output_directory: "./reports")
slather(cobertura_xml: true, jenkins: true, scheme: "[SCHEME]", build_directory: "./DerivedData", 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
Fastlane's sonar
action allows you to define or override a number of SonarQube properties, such as sonar.project-version
.
For instance:
sonar(project_version: "1.0b")
You can read the complete documentation of Fastlane's sonar
action on your terminal via:
fastlane action sonar
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