Summary
Add a full_analysis tool that runs all code quality checkers in a single invocation and provides a unified report. This is the primary entry point for comprehensive code analysis.
Parent Epic
Part of: #40 - Evolve into Python Code Quality MCP
Depends On
Behavior
Runs all available tools and aggregates results:
- Parse source once with Astroid
- Run each checker against the shared AST
- Aggregate issues into unified report
- Calculate overall code quality score
MCP Tool Interface
{
"name": "full_analysis",
"description": "Run all code quality checks and get a comprehensive report",
"inputSchema": {
"type": "object",
"properties": {
"file_path": {"type": "string"},
"source_code": {"type": "string"},
"checks": {
"type": "array",
"items": {
"type": "string",
"enum": ["performance", "pythonic", "security", "complexity", "dead_code", "type_coverage"]
},
"description": "Specific checks to run (default: all)"
},
"severity_threshold": {
"type": "string",
"enum": ["critical", "high", "medium", "low", "info"],
"default": "info"
}
}
}
}
Example Output
{
"file": "src/processor.py",
"quality_score": 72,
"grade": "C",
"summary": {
"total_issues": 12,
"critical": 1,
"high": 2,
"medium": 5,
"low": 4,
"by_tool": {
"performance": 2,
"pythonic": 4,
"security": 1,
"complexity": 3,
"dead_code": 2,
"type_coverage": 0
}
},
"issues": [
{
"tool": "security",
"category": "sql_injection",
"severity": "critical",
"message": "...",
"line": 45
},
// ... all issues from all tools
],
"metrics": {
"complexity": {
"average_cyclomatic": 8.5,
"max_cyclomatic": 25
},
"type_coverage": {
"overall_percent": 74.1
}
},
"recommendations": [
"Fix 1 critical security issue (SQL injection on line 45)",
"Reduce complexity in 'process_data' function (cyclomatic: 25)",
"Add type hints to 3 public functions"
]
}
Quality Score Calculation
Weighted scoring based on issue severity and count:
- Critical: -20 points each
- High: -10 points each
- Medium: -5 points each
- Low: -2 points each
- Info: -1 point each
Starting from 100, minimum 0.
Grade mapping:
- A: 90-100
- B: 80-89
- C: 70-79
- D: 60-69
- F: 0-59
Implementation
- Create
src/workshop_mcp/tools/full_analysis/
- Implement tool orchestration (run all checkers)
- Share parsed AST across checkers (efficiency)
- Aggregate and deduplicate issues
- Calculate quality score and grade
- Generate prioritized recommendations
- Register tool in MCP server
Acceptance Criteria
Summary
Add a
full_analysistool that runs all code quality checkers in a single invocation and provides a unified report. This is the primary entry point for comprehensive code analysis.Parent Epic
Part of: #40 - Evolve into Python Code Quality MCP
Depends On
Behavior
Runs all available tools and aggregates results:
MCP Tool Interface
{ "name": "full_analysis", "description": "Run all code quality checks and get a comprehensive report", "inputSchema": { "type": "object", "properties": { "file_path": {"type": "string"}, "source_code": {"type": "string"}, "checks": { "type": "array", "items": { "type": "string", "enum": ["performance", "pythonic", "security", "complexity", "dead_code", "type_coverage"] }, "description": "Specific checks to run (default: all)" }, "severity_threshold": { "type": "string", "enum": ["critical", "high", "medium", "low", "info"], "default": "info" } } } }Example Output
{ "file": "src/processor.py", "quality_score": 72, "grade": "C", "summary": { "total_issues": 12, "critical": 1, "high": 2, "medium": 5, "low": 4, "by_tool": { "performance": 2, "pythonic": 4, "security": 1, "complexity": 3, "dead_code": 2, "type_coverage": 0 } }, "issues": [ { "tool": "security", "category": "sql_injection", "severity": "critical", "message": "...", "line": 45 }, // ... all issues from all tools ], "metrics": { "complexity": { "average_cyclomatic": 8.5, "max_cyclomatic": 25 }, "type_coverage": { "overall_percent": 74.1 } }, "recommendations": [ "Fix 1 critical security issue (SQL injection on line 45)", "Reduce complexity in 'process_data' function (cyclomatic: 25)", "Add type hints to 3 public functions" ] }Quality Score Calculation
Weighted scoring based on issue severity and count:
Starting from 100, minimum 0.
Grade mapping:
Implementation
src/workshop_mcp/tools/full_analysis/Acceptance Criteria