Skip to main content

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

ParameterTypeRequiredDefaultDescription
forcebooleanNofalseForce recreation of existing configuration
templatestringNobalancedQuality gate template: strict, balanced, permissive

Quality Gate Templates

TemplateNew BugsNew VulnsCoverageDuplication
strict0080%+3% max
balanced0060%+5% max
permissive05 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

  1. SonarQube Project - New project on the server
  2. Authentication Token - Project-specific access token
  3. Quality Gate - Applied based on template
  4. Local Config - bobthefixer.env file
  5. Gitignore Entry - Prevents committing secrets

When to Use

ScenarioUse 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.