SQ.Cli
1.0.4
dotnet tool install --global SQ.Cli --version 1.0.4
dotnet new tool-manifest
dotnet tool install --local SQ.Cli --version 1.0.4
#tool dotnet:?package=SQ.Cli&version=1.0.4
nuke :add-package SQ.Cli --version 1.0.4
Unofficial SonarQube CLI (sq)
An unofficial command-line interface for SonarQube Server and SonarQube Cloud, inspired by GitHub's gh CLI.
Note: This project is not affiliated with or endorsed by Sonar. SonarQube is a trademark of Sonar.
Features
- Comprehensive API Coverage - 180+ commands covering projects, issues, hotspots, quality gates, metrics, and more
- Multi-Instance Support - Manage multiple SonarQube Server and Cloud instances from a single CLI
- Flexible Output - Table, JSON, CSV, and YAML output formats
- Secure Authentication - Token-based authentication with secure local storage
- Resilient - Automatic retry with exponential backoff for transient failures
- Version-Aware - Supports SonarQube Server 9.9 LTS through 2026.1 and SonarQube Cloud
Installation
Standalone Binary (no .NET required)
Download a prebuilt binary for your platform from the latest GitHub Release:
| Platform | Architecture | Download |
|---|---|---|
| Windows | x64 | sq-<version>-win-x64.zip |
| Windows | ARM64 | sq-<version>-win-arm64.zip |
| Linux | x64 | sq-<version>-linux-x64.tar.gz |
| Linux | ARM64 | sq-<version>-linux-arm64.tar.gz |
| macOS | Intel | sq-<version>-osx-x64.tar.gz |
| macOS | Apple Silicon | sq-<version>-osx-arm64.tar.gz |
Extract and place the sq binary somewhere on your PATH.
.NET Global Tool
If you already have .NET 10 installed:
dotnet tool install --global SQ.Cli
Quick Start
# 1. Configure your SonarQube instance
sq config add-instance --name myserver --url https://sonarqube.example.com --token YOUR_TOKEN
# 2. Initialize your project directory
cd /path/to/my-project
sq init --project my-project-key
# 3. Run commands - project context is automatic!
sq quality-gate status # no project arg needed
sq metrics get # auto-resolves from .sq/project.json
sq issues list # works across all project-scoped commands
sq analysis history
sq init creates a .sq/project.json that stores your project key and instance, so you don't have to pass --project on every command. You can always override with explicit arguments when needed.
<details> <summary>Without <code>sq init</code> (explicit arguments)</summary>
sq config add-instance --name myserver --url https://sonarqube.example.com --token YOUR_TOKEN
sq config set-default --name myserver
sq quality-gate status my-project-key
sq issues list --project my-project-key
sq metrics get my-project-key
</details>
Command Categories
| Category | Description |
|---|---|
init |
Initialize project context for the current directory |
config |
Manage CLI configuration and instances |
projects |
Create, list, search, and manage projects |
issues |
Search, assign, comment, and transition issues |
hotspots |
Manage security hotspots |
analysis |
View analysis history and events |
quality-gate |
Check status and manage quality gates |
quality-profiles |
Manage quality profiles and rules |
metrics |
View project metrics and history |
rules |
Search and manage rules |
users |
Manage users and tokens |
groups |
Manage user groups |
permissions |
Manage project and global permissions |
webhooks |
Manage webhooks |
branches |
Manage project branches |
system |
System status, health, and administration |
devops |
DevOps platform integrations (GitHub, GitLab, Azure, Bitbucket) |
sca |
Software Composition Analysis (Enterprise Edition) |
Global Options
-v, --verbose Enable verbose logging
-i, --instance Use specific instance
-f, --format Output format: table, json, csv, yaml (default: table)
-o, --organization Override organization (required for SonarCloud)
--force-v1 Force use of V1 API even if V2 is available
-h, --help Show help for any command
Output Formats
# Default table output
sq projects list
# JSON for scripting
sq projects list --format json | jq '.[] | .key'
# CSV for spreadsheets
sq issues list --project my-app --format csv > issues.csv
# YAML
sq quality-gate status my-app --format yaml
CI/CD Integration
# GitHub Actions
- name: Check Quality Gate
run: sq quality-gate status ${{ github.repository }}
# GitLab CI
script:
- sq quality-gate status $CI_PROJECT_NAME
# Azure Pipelines
- script: sq quality-gate status $(Build.Repository.Name)
Documentation
- Full Command Reference
- Project Initialization (
sq init) - Installation Guide
- Troubleshooting
- Shell Completion
Platform Support
| Platform | Versions |
|---|---|
| SonarQube Server | 9.9 LTS - 2026.1 |
| SonarQube Cloud | Supported |
Related Packages
- SQ.Api - Standalone .NET library for SonarQube Server and Cloud APIs
dotnet add package SQ.Api
Contributing
Contributions are welcome! Please see CONTRIBUTING.md for guidelines.
License
MIT License - See LICENSE for details.
Disclaimer
This is an independent, individual developer project. It is not officially supported by Sonar. Use at your own risk.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
This package has no dependencies.
Initial stable release with full SonarQube Server and SonarQube Cloud support.