Sonar Importer
Category: Importer (takes in SonarQube Instance and outputs cc.json)
The Sonar-Importer generates visualisation data from SonarQube data through an API call to a SonarQube server. This requires that the SonarQube instance is running.
Supported Languages
- All languages that are supported by SonarQube. A full list can be found here.
Supported Metrics
- All metrics that are generated by SonarQube. A full list can be found here.
Usage and Parameters
Parameter | Description |
---|---|
URL |
url of sonarqube server |
PROJECT_ID |
sonarqube project id |
-h, --help |
Please locate: - sonar.host.url (e.g. https://sonar.foo) - sonar.login (e.g. c123d456) - sonar.projectKey (e.g. de.foo:bar) That you use to upload your code to sonar. Then execute ccsh sonarimport https://sonar.foo de.foo:<br/> bar -u c123d456 |
-m, --metrics=<metrics> |
comma-separated list of metrics to import |
--merge-modules |
merges modules in multi-module projects |
-nc, --not-compressed |
save uncompressed output File |
-o, --output-file=<outputFile> |
output File |
-u, --user-token=<userToken> |
user token for connecting to remote sonar instance |
Usage: ccsh sonarimport [-h] [--merge-modules] [-nc] [-o=<outputFile>]
[-u=<userToken>] [-m=<metrics>]... URL PROJECT_ID
Examples
ccsh sonarimport <url> <projectKey> --user-token=<userToken> --output-file=<fileName> --merge-modules=<Boolean>
If you use SonarQube locally, an example command would look like the following:
ccsh sonarimport "http://localhost:9000/" "CodeCharta" "--user-token=squ_12345" "--output-file=output" "--merge-modules=false"
For a more detailed example, please check out this article.
If a project is piped into the SonarImporter, the results and the piped project are merged. The resulting project has the project name specified for the SonarImporter.