Commands

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

circle-exclamation

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 verify

Analyze a file for issues

sonar config

Configure CLI settings

sonar self-update

Update the sonar CLI to the latest version


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 a browser.

Non-interactive login with a direct token.

Non-interactive login for a custom server with a 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 the token for a SonarQube Cloud organization.

Remove the token for a 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 the 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 the latest sonar-secrets binary.

Reinstall sonar-secrets (overwrite existing).

Check if sonar-secrets is installed and up to date.


sonar integrate

Set up SonarQube integration for AI coding agents, git, and others.

sonar integrate claude

Set up SonarQube integration for Claude Code. This installs secrets scanning hooks and configures the SonarQube MCP Server.

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)

-

--global, -g

boolean

No

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

-

Examples:

Integrate Claude Code with an interactive setup.

Integrate globally and install hooks to ~/.claude that 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

--project, -p

string

Yes

Project key

-

--org, -o

string

No

Organization key (for SonarQube Cloud)

-

--severity

string

No

Filter by severity

-

--format

string

No

Output format

json

--branch

string

No

Branch name

-

--pull-request

string

No

Pull request ID

-

--page-size

number

No

Page size (1-500)

500

--page

number

No

Page number

1

Examples:

List issues in a project.

Output issues in TOON format for AI agents.

Filter issues by severity.


sonar list projects

Search for projects in SonarQube.

Options:

Option
Type
Required
Description
Default

--org, -o

string

No

Organization key (for SonarQube Cloud)

-

--query, -q

string

No

Search query to filter projects by name or key

-

--page

number

No

Page number

1

--page-size

number

No

Page size (1-500)

500

Examples:

List the first 500 accessible projects.

Search projects by name or key.

Paginate through projects.


sonar analyze

Analyze code for security issues.

sonar analyze secrets

Scan files or stdin for hardcoded secrets.

Arguments:

Argument
Description

[paths…]

File or directory paths to scan for secrets

Options:

Option
Type
Required
Description
Default

--stdin

boolean

No

Read from standard input instead of paths

-

Examples:

Scan a file for hardcoded secrets.

Scan stdin for hardcoded secrets.


sonar analyze sqaa

Run SQAA server-side analysis on a file (SonarQube Cloud only).

Options:

Option
Type
Required
Description
Default

--file

string

Yes

File path to analyze

-

--branch

string

No

Branch name for analysis context

-

--project

string

No

SonarCloud project key (overrides auto-detected project)

-

Examples:

Run SQAA analysis on a file.

Run an analysis on a specific branch.


sonar verify

Analyze a file for issues.

Options:

Option
Type
Required
Description
Default

--file

string

Yes

File path to analyze

-

--branch

string

No

Branch name for analysis context

-

--project

string

No

SonarCloud project key (overrides auto-detected project)

-

Examples:

Analyze a file for issues.

Analyze a file on a specific branch.


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 the collection of anonymous usage statistics.

Disable the collection of anonymous usage statistics.


sonar self-update

Update the sonar CLI to the latest version.

Options:

Option
Type
Required
Description
Default

--status

boolean

No

Check for a newer version without installing

-

--force

boolean

No

Install the latest version even if already up to date

-

Examples:

Update the CLI to the latest version.

Check if a newer version is available.

Force reinstall the latest version.

Last updated

Was this helpful?