sonar_project_discovery
Analyze a directory to discover project type, languages, frameworks, and recommend configuration.
Description
Automatically detects project characteristics including programming languages, frameworks, build systems, and testing tools. Provides tailored SonarQube configuration recommendations based on discovered features.
Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
path | string | No | Current directory | Directory to analyze |
deep | boolean | No | false | Include dependency scanning |
Usage
Basic Discovery
What kind of project is this?
Tool call:
{}
Deep Analysis
Analyze this project deeply including dependencies
Tool call:
{
"deep": true
}
Specific Directory
Analyze the backend folder
Tool call:
{
"path": "/Users/dev/myproject/backend",
"deep": true
}
Response Format
PROJECT DISCOVERY REPORT
━━━━━━━━━━━━━━━━━━━━━━━━
📁 Path: /Users/dev/my-awesome-app
📊 Analysis Type: Deep
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
🔤 LANGUAGES DETECTED:
Primary:
├── TypeScript (68%)
├── JavaScript (22%)
└── CSS (10%)
Configuration:
├── JSON
├── YAML
└── Markdown
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
🏗️ PROJECT TYPE: Web Application (Frontend)
Framework: React 18.2.0
Build Tool: Vite 5.0.0
Package Manager: npm
Additional:
├── TypeScript 5.3.0
├── ESLint 8.55.0
├── Prettier 3.1.0
└── Jest 29.7.0
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
🧪 TESTING:
Framework: Jest
Coverage: Istanbul
Report Path: coverage/lcov.info (detected)
Test Files:
├── **/*.test.ts
├── **/*.test.tsx
└── **/*.spec.ts
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
📂 STRUCTURE:
src/ → Source code (TypeScript/React)
tests/ → Test files
public/ → Static assets
dist/ → Build output (excluded)
node_modules/ → Dependencies (excluded)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
⚙️ RECOMMENDED CONFIGURATION:
Quality Gate: balanced
Sources: src
Tests: tests,**/*.test.ts,**/*.test.tsx
Exclusions: node_modules/**,dist/**,coverage/**
Coverage Report: coverage/lcov.info
Additional Properties:
├── sonar.typescript.tsconfigPath=tsconfig.json
└── sonar.javascript.lcov.reportPaths=coverage/lcov.info
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
📋 NEXT STEPS:
1. Run: sonar_auto_setup (recommended)
Uses detected configuration automatically
2. Or run: sonar_scan_project with autoSetup: true
Sets up and scans in one step
3. For custom config: sonar_generate_config
Create sonar-project.properties manually
Deep Analysis Features
When deep: true:
| Feature | Description |
|---|---|
| Dependency scan | Analyzes package.json, requirements.txt, etc. |
| Framework version | Exact versions detected |
| Security check | Known vulnerable dependencies |
| Config files | All config files analyzed |
| Git info | Branch, remote, ignore patterns |
Detection Capabilities
Languages
| Language | Detection Method |
|---|---|
| TypeScript | tsconfig.json, .ts files |
| JavaScript | package.json, .js files |
| Python | requirements.txt, setup.py, .py files |
| Java | pom.xml, build.gradle, .java files |
| Go | go.mod, .go files |
| Rust | Cargo.toml, .rs files |
| C# | .csproj, .cs files |
Frameworks
| Framework | Detection |
|---|---|
| React | react in package.json |
| Vue | vue in package.json |
| Angular | @angular/core in package.json |
| Next.js | next in package.json |
| Express | express in package.json |
| Django | django in requirements.txt |
| Spring | spring-boot in pom.xml |
Build Tools
| Tool | Detection |
|---|---|
| npm | package-lock.json |
| yarn | yarn.lock |
| pnpm | pnpm-lock.yaml |
| Maven | pom.xml |
| Gradle | build.gradle |
| pip | requirements.txt |
Examples
Example 1: New Project Setup
Prompt:
I just cloned this repo, what kind of project is it?
Tool Call:
{
"deep": true
}
Example 2: Monorepo Analysis
Prompt:
Analyze the packages/api folder
Tool Call:
{
"path": "/Users/dev/monorepo/packages/api",
"deep": true
}
Example 3: Quick Check
Prompt:
What languages are used here?
Tool Call:
{}
Best Practices
- Run before first scan - Understand project structure
- Use deep for full picture - Especially for new projects
- Review recommendations - May need adjustment
- Re-run after changes - When adding frameworks/tools
Common Issues
"No project detected"
Cause: Directory has no recognizable project files.
Solution: Ensure you're in the correct directory.
"Incomplete detection"
Cause: Unusual project structure.
Solution: Use deep analysis or configure manually.
Related Tools
sonar_auto_setup- Apply recommendationssonar_generate_config- Manual configurationsonar_scan_project- Start scanning