|
| 1 | +# Sonar Scanner Python CLI Arguments |
| 2 | + |
| 3 | +## Authentication |
| 4 | + |
| 5 | +| Option | Description | |
| 6 | +| ------ | ----------- | |
| 7 | +| `--sonar-host-url`, `-Dsonar.host.url` | SonarQube Server base URL. For example, http://localhost:9000 for a local instance of SonarQube Server | |
| 8 | +| `--sonar-organization`, `-Dsonar.organization` | The key of the organization to which the project belongs | |
| 9 | +| `--sonar-region`, `-Dsonar.region` | The region to contact, only for SonarQube Cloud | |
| 10 | +| `-t`, `--token`, `--sonar-token`, `-Dsonar.token` | Token used to authenticate against the SonarQube Server or SonarQube Cloud | |
| 11 | + |
| 12 | +## Project Configuration |
| 13 | + |
| 14 | +| Option | Description | |
| 15 | +| ------ | ----------- | |
| 16 | +| `--sonar-project-base-dir`, `-Dsonar.projectBaseDir` | Directory containing the project to be analyzed. Default is the current directory | |
| 17 | +| `--sonar-project-description`, `-Dsonar.projectDescription` | Description of the project | |
| 18 | +| `--sonar-project-key`, `-Dsonar.projectKey` | Key of the project that usually corresponds to the project name in SonarQube | |
| 19 | +| `--sonar-project-name`, `-Dsonar.projectName` | Name of the project in SonarQube | |
| 20 | +| `--sonar-project-version`, `-Dsonar.projectVersion` | Version of the project | |
| 21 | +| `--sonar-sources`, `-Dsonar.sources` | The analysis scope for main source code (non-test code) in the project | |
| 22 | +| `--sonar-tests`, `-Dsonar.tests` | The analysis scope for test source code in the project | |
| 23 | + |
| 24 | +## Analysis Configuration |
| 25 | + |
| 26 | +| Option | Description | |
| 27 | +| ------ | ----------- | |
| 28 | +| `--sonar-filesize-limit`, `-Dsonar.filesize.limit` | Sets the limit in MB for files to be discarded from the analysis scope if the size is greater than specified | |
| 29 | +| `--sonar-python-version`, `-Dsonar.python.version` | Python version used for the project | |
| 30 | +| `-v`, `--verbose`, `--no-verbose`, `--sonar-verbose`, `--no-sonar-verbose`, `-Dsonar.verbose` | Increase output verbosity | |
| 31 | + |
| 32 | +## Report Integration |
| 33 | + |
| 34 | +| Option | Description | |
| 35 | +| ------ | ----------- | |
| 36 | +| `--sonar-external-issues-report-paths`, `-Dsonar.externalIssuesReportPaths` | Comma-delimited list of paths to generic issue reports | |
| 37 | +| `--sonar-python-bandit-report-paths`, `--bandit-report-paths`, `-Dsonar.python.bandit.reportPaths` | Comma-separated bandit report paths, relative to project's root | |
| 38 | +| `--sonar-python-coverage-report-paths`, `--coverage-report-paths`, `-Dsonar.python.coverage.reportPaths` | Comma-delimited list of paths to coverage reports in the Cobertura XML format. | |
| 39 | +| `--sonar-python-flake8-report-paths`, `--flake8-report-paths`, `-Dsonar.python.flake8.reportPaths` | Comma-separated flake8 report paths, relative to project's root | |
| 40 | +| `--sonar-python-mypy-report-paths`, `--mypy-report-paths`, `-Dsonar.python.mypy.reportPaths` | Comma-separated mypy report paths, relative to project's root | |
| 41 | +| `--sonar-python-pylint-report-path`, `--pylint-report-path`, `-Dsonar.python.pylint.reportPath` | Path to third-parties issues report file for pylint | |
| 42 | +| `--sonar-python-ruff-report-paths`, `--ruff-report-paths`, `-Dsonar.python.ruff.reportPaths` | Comma-separated ruff report paths, relative to project's root | |
| 43 | +| `--sonar-python-xunit-report-path`, `--xunit-report-path`, `-Dsonar.python.xunit.reportPath` | Path to the report of test execution, relative to project's root | |
| 44 | +| `--sonar-python-xunit-skip-details`, `--no-sonar-python-xunit-skip-details`, `--xunit-skip-details`, `--no-xunit-skip-details` | When enabled, the test execution statistics is provided only on project level | |
| 45 | +| `--sonar-sarif-report-paths`, `-Dsonar.sarifReportPaths` | Comma-delimited list of paths to SARIF issue reports | |
| 46 | + |
| 47 | +## Other |
| 48 | + |
| 49 | +| Option | Description | |
| 50 | +| ------ | ----------- | |
| 51 | +| `--skip-jre-provisioning`, `-Dsonar.scanner.skipJreProvisioning` | If provided, the provisioning of the JRE will be skipped | |
| 52 | +| `--sonar-branch-name`, `-Dsonar.branch.name` | Name of the branch being analyzed | |
| 53 | +| `--sonar-build-string`, `-Dsonar.buildString` | The string passed with this property will be stored with the analysis and available in the results of api/project_analyses/search, thus allowing you to later identify a specific analysis and obtain its key for use with api/new_code_periods/set on the SPECIFIC_ANALYSIS type | |
| 54 | +| `--sonar-cpd-python-minimum-lines`, `-Dsonar.cpd.python.minimumLines` | Minimum number of tokens to be considered as a duplicated block of code | |
| 55 | +| `--sonar-cpd-python-minimum-tokens`, `-Dsonar.cpd.python.minimumTokens` | Minimum number of tokens to be considered as a duplicated block of code | |
| 56 | +| `--sonar-links-ci`, `-Dsonar.links.ci` | The URL of the continuous integration system used | |
| 57 | +| `--sonar-links-homepage`, `-Dsonar.links.homepage` | The URL of the build project home page | |
| 58 | +| `--sonar-links-issue`, `-Dsonar.links.issue` | The URL to the issue tracker being used | |
| 59 | +| `--sonar-links-scm`, `-Dsonar.links.scm` | The URL of the build project source code repository | |
| 60 | +| `--sonar-log-level`, `-Dsonar.log.level` | Log level during the analysis | |
| 61 | +| `--sonar-modules`, `-Dsonar.modules` | Comma-delimited list of modules to analyze | |
| 62 | +| `--sonar-newcode-reference-branch`, `-Dsonar.newCode.referenceBranch` | Reference branch for new code definition | |
| 63 | +| `--sonar-pullrequest-base`, `-Dsonar.pullrequest.base` | Base branch of the pull request being analyzed | |
| 64 | +| `--sonar-pullrequest-branch`, `-Dsonar.pullrequest.branch` | Branch of the pull request being analyzed | |
| 65 | +| `--sonar-pullrequest-key`, `-Dsonar.pullrequest.key` | Key of the pull request being analyzed | |
| 66 | +| `--sonar-python-skip-unchanged`, `--no-sonar-python-skip-unchanged` | Override the SonarQube configuration of skipping or not the analysis of unchanged Python files | |
| 67 | +| `--sonar-qualitygate-timeout`, `-Dsonar.qualitygate.timeout` | The number of seconds that the scanner should wait for a report to be processed | |
| 68 | +| `--sonar-qualitygate-wait`, `--no-sonar-qualitygate-wait` | Forces the analysis step to poll the server instance and wait for the Quality Gate status | |
| 69 | +| `--sonar-scanner-api-url`, `-Dsonar.scanner.apiUrl` | Base URL for all REST-compliant API calls, https://api.sonarcloud.io for example | |
| 70 | +| `--sonar-scanner-arch`, `-Dsonar.scanner.arch` | Architecture on which the scanner will be running | |
| 71 | +| `--sonar-scanner-cloud-url`, `-Dsonar.scanner.cloudUrl` | SonarQube Cloud base URL, https://sonarcloud.io for example | |
| 72 | +| `--sonar-scanner-connect-timeout`, `-Dsonar.scanner.connectTimeout` | Time period to establish connections with the server (in seconds) | |
| 73 | +| `--sonar-scanner-internal-dump-to-file`, `-Dsonar.scanner.internal.dumpToFile` | Filename where the input to the scanner engine will be dumped. Useful for debugging | |
| 74 | +| `--sonar-scanner-internal-sq-version`, `-Dsonar.scanner.internal.sqVersion` | Emulate the result of the call to get SQ server version. Useful for debugging with --sonar-scanner-internal-dump-to-file | |
| 75 | +| `--sonar-scanner-java-exe-path`, `-Dsonar.scanner.javaExePath` | If defined, the scanner engine will be run with this JRE | |
| 76 | +| `--sonar-scanner-java-opts`, `-Dsonar.scanner.javaOpts` | Arguments provided to the JVM when running the scanner | |
| 77 | +| `--sonar-scanner-keystore-password`, `-Dsonar.scanner.keystorePassword` | Password to access the keystore | |
| 78 | +| `--sonar-scanner-keystore-path`, `-Dsonar.scanner.keystorePath` | Path to the keystore containing the client certificates used by the scanner. By default, <sonar.userHome>/ssl/keystore.p12 | |
| 79 | +| `--sonar-scanner-metadata-filepath`, `-Dsonar.scanner.metadataFilepath` | Sets the location where the scanner writes the report-task.txt file containing among other things the ceTaskId | |
| 80 | +| `--sonar-scanner-os`, `-Dsonar.scanner.os` | OS running the scanner | |
| 81 | +| `--sonar-scanner-proxy-host`, `-Dsonar.scanner.proxyHost` | Proxy host | |
| 82 | +| `--sonar-scanner-proxy-password`, `-Dsonar.scanner.proxyPassword` | Proxy password | |
| 83 | +| `--sonar-scanner-proxy-port`, `-Dsonar.scanner.proxyPort` | Proxy port | |
| 84 | +| `--sonar-scanner-proxy-user`, `-Dsonar.scanner.proxyUser` | Proxy user | |
| 85 | +| `--sonar-scanner-response-timeout`, `-Dsonar.scanner.responseTimeout` | Time period required to process an HTTP call: from sending a request to receiving a response (in seconds) | |
| 86 | +| `--sonar-scanner-socket-timeout`, `-Dsonar.scanner.socketTimeout` | Maximum time of inactivity between two data packets when exchanging data with the server (in seconds) | |
| 87 | +| `--sonar-scanner-truststore-password`, `-Dsonar.scanner.truststorePassword` | Password to access the truststore | |
| 88 | +| `--sonar-scanner-truststore-path`, `-Dsonar.scanner.truststorePath` | Path to the keystore containing trusted server certificates, used by the Scanner in addition to OS and the built-in certificates | |
| 89 | +| `--sonar-scm-exclusions-disabled`, `--no-sonar-scm-exclusions-disabled` | Defines whether files ignored by the SCM, e.g., files listed in .gitignore, will be excluded from the analysis or not | |
| 90 | +| `--sonar-scm-force-reload-all`, `--no-sonar-scm-force-reload-all` | Set this property to true to load blame information for all files, which may significantly increase analysis duration | |
| 91 | +| `--sonar-scm-revision`, `-Dsonar.scm.revision` | Overrides the revision, for instance, the Git sha1, displayed in analysis results | |
| 92 | +| `--sonar-source-encoding`, `-Dsonar.sourceEncoding` | Encoding of the source files. For example, UTF-8, MacRoman, Shift_JIS | |
| 93 | +| `--sonar-user-home`, `-Dsonar.userHome` | Base sonar directory, ~/.sonar by default | |
| 94 | +| `--sonar-working-directory`, `-Dsonar.working.directory` | Path to the working directory used by the Sonar scanner during a project analysis to store temporary data | |
| 95 | +| `--toml-path` | Path to the pyproject.toml file. If not provided, it will look in the SONAR_PROJECT_BASE_DIR | |
| 96 | +| `-Dsonar.python.skipUnchanged` | Equivalent to --sonar-python-skip-unchanged | |
| 97 | +| `-Dsonar.python.xunit.skipDetails` | Equivalent to -Dsonar.python.xunit.skipDetails | |
| 98 | +| `-Dsonar.qualitygate.wait` | Equivalent to --sonar-qualitygate-wait | |
| 99 | +| `-Dsonar.scm.exclusions.disabled` | Equivalent to --sonar-scm-exclusions-disabled | |
| 100 | +| `-Dsonar.scm.forceReloadAll` | Equivalent to --sonar-scm-force-reload-all | |
0 commit comments