SonarQube CLI commands

A complete reference for SonarQube CLI commands, including options and examples.

circle-check

This page is a reference for all SonarQube CLI commands. Each command entry includes a description, a table of available options with their types, whether they are required, and default values, plus usage examples.

The available top-level commands are:

Command
Description

sonar auth

Manage authentication tokens and credentials

sonar install

Install Sonar tools

sonar integrate

Set up SonarQube integration with AI coding agents and other tools

sonar list

List SonarQube resources such as issues and projects

sonar analyze

Analyze code for security issues

sonar config

Configure CLI settings


sonar auth

Manage authentication tokens and credentials.

sonar auth login

Save authentication token to keychain.

Options:

Option
Type
Required
Description
Default

--server, -s

string

No

SonarQube server URL (default is SonarQube Cloud)

-

--org, -o

string

No

SonarQube Cloud organization key (required for SonarQube Cloud)

-

--with-token, -t

string

No

Token value (skips browser, non-interactive mode)

-

Examples:

Interactive login for SonarQube Cloud with browser

Non-interactive login with direct token

Non-interactive login for custom server with token


sonar auth logout

Remove authentication token from keychain.

Options:

Option
Type
Required
Description
Default

--server, -s

string

No

SonarQube server URL

-

--org, -o

string

No

SonarQube Cloud organization key (required for SonarQube Cloud)

-

Examples:

Remove token for SonarQube Cloud organization

Remove token for custom SonarQube server


sonar auth purge

Remove all authentication tokens from keychain.

Examples:

Interactively remove all saved tokens


sonar auth status

Show active authentication connection with token verification.

Examples:

Show current server connection and token status


sonar install

Install Sonar tools.

sonar install secrets

Install sonar-secrets binary from https://binaries.sonarsource.com.

Options:

Option
Type
Required
Description
Default

--force

boolean

No

Force reinstall even if already installed

-

--status

boolean

No

Check installation status instead of installing

-

Examples:

Install latest sonar-secrets binary

Reinstall sonar-secrets (overwrite existing)

Check if sonar-secrets is installed and up to date


sonar integrate

Setup SonarQube integration (hooks, config...) for various tools, like AI coding agents, git and others.

Options:

Option
Type
Required
Description
Default

--server, -s

string

No

SonarQube server URL

-

--project, -p

string

No

Project key

-

--token, -t

string

No

Existing authentication token

-

--org, -o

string

No

Organization key (for SonarQube Cloud)

-

--non-interactive

boolean

No

Non-interactive mode (no prompts)

-

--skip-hooks

boolean

No

Skip hooks installation

-

--global, -g

boolean

No

Install hooks and config globally to ~/.claude instead of project directory

-

Examples:

Integrate Claude Code with interactive setup

Integrate without installing hooks

Integrate globally and install hooks to ~/.claude which will be available for all projects


sonar list

List Sonar resources.

sonar list issues

Search for issues in SonarQube.

Options:

Option
Type
Required
Description
Default

--server, -s

string

No

SonarQube server URL

-

--token, -t

string

No

Authentication token

-

--project, -p

string

Yes

Project key

-

--severity

string

No

Filter by severity

-

--format

string

No

Output format

json

--branch

string

No

Branch name

-

--pull-request

string

No

Pull request ID

-

--all

boolean

No

Fetch all issues with pagination

-

--page-size

number

No

Page size for pagination

500

Examples:

List issues in a project

Output issues in TOON format for AI agents

Fetch all critical issues


sonar list projects

Search for projects in SonarQube.

Options:

Option
Type
Required
Description
Default

--query, -q

string

No

Search query to filter projects by name or key

-

--page, -p

number

No

Page number

1

--page-size

number

No

Page size (1-500)

500

Examples:

List first 500 accessible projects

Search projects by name or key

Paginate through projects


sonar analyze

Analyze code for security issues.

sonar analyze secrets

Scan a file or stdin for hardcoded secrets.

Options:

Option
Type
Required
Description
Default

--file

string

No

File path to scan for secrets

-

--stdin

boolean

No

Read from standard input instead of a file

-

Examples:

Scan a file for hardcoded secrets

Scan stdin for hardcoded secrets


sonar config

Configure CLI settings.

sonar config telemetry

Configure telemetry settings.

Options:

Option
Type
Required
Description
Default

--enabled

boolean

No

Enable collection of anonymous usage statistics

-

--disabled

boolean

No

Disable collection of anonymous usage statistics

-

Examples:

Enable collection of anonymous usage statistics

Disable collection of anonymous usage statistics

Last updated

Was this helpful?