sonar_auto_setup
Automatically setup a SonarQube project with language detection and configuration.
Description
Creates a SonarQube project configured for your codebase without running a full scan. Useful when you want to configure the project first and scan later.
Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
force | boolean | No | false | Force recreation of existing configuration |
template | string | No | balanced | Quality gate template: strict, balanced, permissive |
Quality Gate Templates
| Template | New Bugs | New Vulns | Coverage | Duplication |
|---|---|---|---|---|
strict | 0 | 0 | 80%+ | 3% max |
balanced | 0 | 0 | 60%+ | 5% max |
permissive | 0 | 5 critical max | - | 10% max |
Usage
Basic Setup
Set up this project for SonarQube analysis
Tool call:
{}
Setup with Strict Quality Gate
Set up this project with strict quality requirements
Tool call:
{
"template": "strict"
}
Force Reconfiguration
Reset the SonarQube configuration for this project
Tool call:
{
"force": true,
"template": "balanced"
}
Response Format
PROJECT SETUP COMPLETE
━━━━━━━━━━━━━━━━━━━━━━
Project: my-awesome-app
Key: my-awesome-app-a1b2c3d4
DETECTED:
Languages: TypeScript, JavaScript
Framework: React
Build Tool: Vite
Package Manager: npm
QUALITY GATE: balanced
- New bugs: 0
- New vulnerabilities: 0
- New blocker issues: 0
- New critical issues: 0
- New coverage: ≥60%
- New duplication: <5%
CONFIGURATION SAVED:
File: bobthefixer.env
Added to .gitignore: ✓
NEXT STEPS:
1. Run sonar_scan_project to analyze your code
2. Review issues with sonar_get_issue_details
Examples
Example 1: New TypeScript Project
Prompt:
Configure SonarQube for my new TypeScript project with strict standards
Tool Call:
{
"template": "strict"
}
Example 2: Legacy Project
Prompt:
Set up this legacy codebase with relaxed quality gates so we can improve gradually
Tool Call:
{
"template": "permissive"
}
Example 3: Reconfigure Project
Prompt:
The quality gate is too strict, reconfigure with balanced settings
Tool Call:
{
"force": true,
"template": "balanced"
}
What Gets Created
- SonarQube Project - New project on the server
- Authentication Token - Project-specific access token
- Quality Gate - Applied based on template
- Local Config -
bobthefixer.envfile - Gitignore Entry - Prevents committing secrets
When to Use
| Scenario | Use This Tool? |
|---|---|
| First time setup | ✓ Yes |
| Change quality gate | ✓ Yes (with force) |
| Run analysis | ✗ Use sonar_scan_project |
| Just scan existing | ✗ Use sonar_scan_project |
Common Issues
"Project already exists"
Cause: Project was previously configured.
Solution: Use force: true to reconfigure.
"Failed to create project"
Cause: Insufficient permissions on SonarQube server.
Solution: Verify token has "Create Projects" permission.
Related Tools
sonar_scan_project- Scan after setupsonar_project_discovery- Preview detectionsonar_config_manager- Manage configuration