Skip to content

SonarSource/sonarqube-cli

Repository files navigation

SonarQube CLI

Build Quality Gate Status

A CLI application for interacting with SonarQube products.

Beta Notice: This product is currently in Beta, and we are actively collecting feedback on it. Please share your thoughts via this form!

Installation

Linux/Mac OS:

curl -o- https://raw.githubusercontent.com/SonarSource/sonarqube-cli/refs/heads/master/user-scripts/install.sh | bash

Windows (from PowerShell):

irm https://raw.githubusercontent.com/SonarSource/sonarqube-cli/refs/heads/master/user-scripts/install.ps1 | iex

Setup steps for Claude Code integration

Below is an example of a setup which will work for SonarQube Cloud EU (default). The authentication step is optional. With authentication, more types of secrets can be detected.

sonar auth login
sonar integrate claude -g

For SonarQube Cloud US, pass the server URL explicitly:

sonar auth login --server https://sonarqube.us
sonar integrate claude -g

For SonarQube Server, pass your instance URL:

sonar auth login --server https://sonarqube.mycompany.com
sonar integrate claude -g

Commands

The full list of commands is available at https://cli.sonarqube.com

Exit Codes

Code Meaning
0 Success
1 Error (validation, execution, etc.)

State Management

See State Management for more information.

Uninstalling

Linux/Mac OS

  1. Delete the ~/.local/share/sonarqube-cli/ folder.
  2. Remove export PATH="$HOME/.local/share/sonarqube-cli/bin:$PATH" from your ~/.bashrc or ~/.zshrc files.

Windows

  1. Delete the %localappdata%\sonarqube-cli\ folder.
  2. Remove this folder from the PATH user-level environment variable.

Data collection

The SonarQube CLI collects anonymous usage data and error reports to help improve the product.

Telemetry: Anonymous command usage statistics are sent to SonarSource.

Error reporting: Unhandled exceptions are reported to Sentry to help us identify and fix crashes.

Both are enabled by default and share the same opt-out toggle. To disable all data collection:

sonar config telemetry --disabled

No personally identifiable information is transmitted.

Contributing

Please be aware that we are not actively looking for feature contributions. The truth is that it's extremely difficult for someone outside SonarSource to comply with our roadmap and expectations. Therefore, we typically only accept minor cosmetic changes and typo fixes.

See CONTRIBUTING.md for setup instructions, coding guidelines, and how to run tests.

License

Copyright SonarSource Sàrl.

SonarQube CLI is released under the GNU Lesser General Public License, Version 3.0⁠,.

Generated from src/cli/command-tree.ts — do not edit manually

About

CLI tool to provide access to Sonar features

Resources

License

Contributing

Security policy

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages