Integrate SonarQube code quality and security analysis directly into your Claude Code workflow.
- Issue Fixing: Fix specific code quality issues by rule key and location
- Issue Listing: Search and filter issues in your SonarQube project
- Project Discovery: List accessible SonarQube projects to find project keys
- Secrets Scanning: Prevent secrets from being propagated to AI agents via pre-tool hooks
- Session Check: On startup, reports whether prerequisites are installed and configured
# Local development
claude --plugin-dir ./path/to/sonarqube-claude-code-plugin-
Node.js — required to run the
SessionStarthook (scripts/setup.js). -
sonarqube-cli (
sonar) — install it yourself before running/sonarqube:configuring-sonarqube:Platform Command macOS / Linux curl -o- https://raw.githubusercontent.com/SonarSource/sonarqube-cli/refs/heads/master/user-scripts/install.sh | bashWindows (PowerShell) irm https://raw.githubusercontent.com/SonarSource/sonarqube-cli/refs/heads/master/user-scripts/install.ps1 | iex
Once sonarqube-cli is installed, run the guided setup skill:
/sonarqube:configuring-sonarqube
This will:
- Verify
sonarqube-cliis available - Authenticate with SonarQube Cloud or a self-hosted SonarQube Server via
sonar auth login(opens browser — token stored in your system keychain, never pasted in chat) - Install the secrets scanning binary
- Run
sonar integrate claudeto register secrets hooks with Claude Code
/sonarqube:configuring-sonarqube
/sonarqube:list-projects # all accessible projects
/sonarqube:list-projects my-team # search by name or key
/sonarqube:list-issues # issues in the current project
/sonarqube:list-issues my-project --severity CRITICAL
/sonarqube:fix-issue java:S1481 src/main/java/MyClass.java
/sonarqube:fix-issue python:S2077 src/auth/login.py:34
Run /sonarqube:configuring-sonarqube — it handles everything interactively.
For reference, the connection scenarios and corresponding sonar auth login commands are:
| Scenario | Command |
|---|---|
| SonarQube Cloud — EU (default) | sonar auth login -o <org-key> |
| SonarQube Cloud — US | sonar auth login -o <org-key> -s https://sonarqube.us |
| SonarQube Server | sonar auth login -s <server-url> |
Credentials are stored in your system keychain. You can verify the current auth status with:
sonar auth statusCreate a sonar-project.properties file in your project root to set a project key for analysis:
sonar.projectKey=my-project
sonar.projectName=My Project
sonar.projectVersion=1.0
sonar.sources=src
sonar.sourceEncoding=UTF-8claude --plugin-dir .