sonar-tools
A collection of command line tools to help in SonarQube administration tasks
6.4K
Command line tools to help in SonarQube administration tasks. Available as a pypi.org package or a docker image.
sonar-tools is compatible with:
DISCLAIMER: This software is community software. None of the tools it contains are neither supported nor endorsed by SonarSource Sàrl, the company publishing the SonarQube Server, SonarQube Cloud and SonarQube for IDE (ex- SonarLint) products
The following utilities are available:
:warning: sonar-tools 2.7 or higher is required for compatibility with SonarQube Cloud or SonarQube Server 10 and higher
sonar-tools requires python 3.9 or higherpython3 -m pip install sonar-tools (or python3 -m pip upgrade sonar-tools)
If install does not behave as expected you can try the pip --force-reinstall option (see pip documentation).whl file from https://pypi.org/project/sonar-tools or attached to the release at https://github.com/okorach/sonar-tools/releases. The file should be something like. sonar_tools-<VERSION>-py3-none-any.whlpython3 -m pip install sonar_tools-<VERSION>-py3-none-any.whlargparse, datetime, python-dateutil, requests and jprops python packages that are automatically installed when installing sonar-toolssonar-tools is now also available as a docker image.docker pull olivierkorach/sonar-tools:latest to installThen see Using sonar-tools in Docker for details
All tools accept the following common parameters:
-h : Displays a help and exits-u : URL of the SonarQube Server or Cloud. The default is environment variable $SONAR_HOST_URL
or http://localhost:9000 by default if the environment variable is not set-t : User token to invoke the Server or Cloud APIs, like squ_83356c9b2db891d45da2a119a29cdc4d03fe654e.
The default is environment variable $SONAR_TOKEN.
Using login/password is not possible.
The user corresponding to the token must have enough permissions to achieve the tool tasks-o : Organization, for SonarQube Cloud - Ignored if running against a SonarQube Server-v : Logging verbosity level (WARN, ÌNFO or DEBUG). The default is INFO.
ERROR and above is always active.-c or --clientCert : Allows to specify an optional client certificate file (as .pem file)--skipCertVerify : Skips SSL certificate verification. This is useful when connecting to a SonarQube Server that uses a self-signed certificate--httpTimeout : Sets the timeout for HTTP(S) requests to the SonarQube Server or Cloud platform, in seconds--skipVersionCheck : Starting with sonar-tools 2.11, by default all sonar tools occasionnally check on pypi.org if there is a new version of sonar-tools available, and output a warning log if that is the case. You can skip this check with this option.-l <logFile> : Send logs to , stdout by default--threads <nbThreads>: Allows to define number of threads for projects auditing (default 1). More threads
will stress SonarQube APIs more but will be much faster on large platforms with many projectsSee common error exit codes at the bottom of this page
sonar-audit allows to audit a SonarQube Server or Cloud instance and output warning logs for all anomalies found.
See complete documentation for details
sonar-findings-sync allows to synchronizes issues and hotspots changelog (false positives, won't fix, issue severity or type change, review status, tags and comments) between branches, projects or SonarQube Server or Cloud instances.
See complete documentation for details
Deletes obsolete/outdated data from SonarQube See complete documentation for details
Exports all projects lines of code as they would be counted by the commercial licences. See complete documentation for details
Exports one or all projects with all (or some selected) measures in a CSV or JSON file. See complete documentation for details
(Also available as sonar-issues-export for backward compatibility, but deprecated)
Exports a list of issues as CSV, JSON or SARIF format. The export is sent to standard output or into a file
Plenty of issue filters can be specified from the command line, type sonar-findings-export -h for details.
See complete documentation for details
Exports (or imports) projects of a given Server instance to / from zip files (This is NOT possible with SonarQube Cloud) See complete documentation for details
Exports or imports all or part of a SonarQube Server or Cloud platform configuration. See complete documentation for details
When tools complete successfully they return exit code 0. En case of fatal error the following exit codes may be returned:
Copyright (C) 2019-2026 Olivier Korach mailto:olivier.korach AT gmail DOT com
This program is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
Content type
Image
Digest
sha256:11ca86c79…
Size
51.4 MB
Last updated
24 days ago
docker pull olivierkorach/sonar-tools