By koriym
Detect spaghetti code using PHPMD metrics. Measures CBO, CC, NPath to identify refactoring targets.
PHP Alert for Spaghetti Twisted Architecture
Order your code quality check - from Piccolo to Mamma Mia!
Detect spaghetti code using PHPMD metrics.
PASTA focuses on tangled, complex code - the kind that's hard to test, hard to change, and hard to understand. These issues aren't caught by type checkers like PHPStan or Psalm, yet they're often what kills project sustainability over time.
Unlike general code quality tools, it specifically targets metrics that indicate code entanglement: cyclomatic complexity, coupling, and structural bloat.
/plugin marketplace add koriym/pasta-lunch
/plugin install pasta-lunch@pasta-lunch
composer require --dev koriym/pasta-lunch
# Via composer script (default target: src)
composer pasta
composer pasta:html > report.html
# Direct execution
./vendor/bin/pasta
./vendor/bin/pasta --format=md > report.md
./vendor/bin/pasta --format=html > report.html
# Custom exclude patterns (default: *Module.php)
./vendor/bin/pasta src --exclude="*Module.php,*Test.php"
# No exclusions
./vendor/bin/pasta src --no-exclude
Add to your project's composer.json:
{
"scripts": {
"pasta": "bin/pasta src",
"pasta:html": "bin/pasta src --format=html"
}
}
Usage:
composer pasta
composer pasta:html > report.html
| Level | Meaning | |
|---|---|---|
| ๐ | Piccolo | Clean code |
| ๐๐ | Medio | Acceptable |
| ๐๐๐ | Grande | Refactoring required |
| ๐๐๐๐ | Mamma Mia! | Unmaintainable |
See Sample Report for an example HTML output.
| Metric | Piccolo | Medio | Grande | Mamma Mia! |
|---|---|---|---|---|
| CyclomaticComplexity (CC) | โค10 | 11-15 | 16-20 | 21+ |
| NPathComplexity | โค100 | 101-200 | 201-500 | 501+ |
| CouplingBetweenObjects (CBO) | โค10 | 11-15 | 16-20 | 21+ |
| ExcessiveClassComplexity (ECC) | โค50 | 51-80 | 81-120 | 121+ |
| ExcessiveMethodLength | โค50 | 51-100 | 101-150 | 151+ |
| ExcessiveParameterList | โค5 | 6-10 | 11-15 | 16+ |
| TooManyFields | โค10 | 11-15 | 16-20 | 21+ |
| TooManyPublicMethods | โค10 | 11-15 | 16-20 | 21+ |
See Issue Types for detailed documentation.
PASTA thresholds are designed around clean code ideals, not just "acceptable" levels. PHPMD defaults represent the point where "measures should be taken" - meaning code at those thresholds already needs attention.
| Metric | PHPMD Default | PASTA Piccolo | Rationale |
|---|---|---|---|
| NPath | 200 | โค100 | 200 paths exceeds human cognitive capacity |
| CBO | 13 | โค10 | Proper DI keeps coupling under 10 |
| MethodLength | 100 | โค50 | Modern standards favor 30-50 lines |
Own this plugin?
Verify ownership to unlock analytics, metadata editing, and a verified badge. GitHub access is read-only (username + org membership).
Sign in to claimOwn this plugin?
Verify ownership to unlock analytics, metadata editing, and a verified badge. GitHub access is read-only (username + org membership).
Sign in to claimBased on adoption, maintenance, documentation, and repository signals. Not a security audit or endorsement.
PHP debugging and analysis tools using Xdebug. Trace execution, step debug, profile performance, and analyze code coverage.
Claude Skills for SQL quality analysis and optimization. Includes performance checking, automated fixes, and parameter generation.
npx claudepluginhub koriym/pasta-lunch --plugin pasta-lunchLive codebase visualization and structural quality gate โ 14 health dimensions graded A-F, dependency analysis, and architecture governance via MCP
Claude Code Skill for Ruby code quality analysis with RubyCritic. Model-invoked - Claude autonomously analyzes code quality, identifies smells, and provides refactoring insights.
PHP Architecture Toolkit โ DDD, CQRS, Event Sourcing, Clean/Hexagonal Architecture, GoF Patterns, PSR, Docker, CI/CD
Dead code analysis, duplication detection, complexity hotspots, and auto-fix for JavaScript/TypeScript using fallow
Monitor code complexity and maintain code quality
Reduce cyclomatic complexity and simplify functions