A high-performance static analysis tool that maps code dependencies, highlights complexity, and uncovers dead code across large projects. Designed to be language-agnostic, the engine can analyze code architecture and usage patterns in any language.
The initial release focuses on PHP support, with additional languages planned for the future.
- π Deep Code Analysis β Parses source files to extract structural elements (classes, functions, methods, properties)
- πΈοΈ Dependency Mapping β Builds comprehensive graphs showing code relationships
- π Complexity Metrics β Identifies areas of high complexity
- π― Usage Tracking β Finds where functions and classes are used across the project
- π» Dead Code Detection β Flags unused or orphaned code
- β‘ High Performance β Concurrent processing for fast analysis of large projects
git clone https://github.com/boone-studios/tukey.git
cd tukey
make installgo install github.com/boone-studios/tukey/cmd/tukey@latestDownload the latest release from the releases page.
# Basic analysis
tukey /path/to/your/php/project
# Verbose output with function usage report
tukey -v /path/to/your/php/project
# Export results to JSON
tukey -v --output analysis.json /path/to/your/php/project
# Exclude directories
tukey --exclude vendor --exclude tests /path/to/your/php/projectPerfect for analyzing inherited PHP codebases with little documentation:
tukey -v ./legacy-projectOutput shows:
- Most critical classes (highly depended upon)
- Dead code candidates (orphaned functions)
- Complex areas needing refactoring
- Helper function usage patterns
Find where specific functions like format_phone() are used:
π FUNCTION USAGE REPORT
======================================================================
π app/Lib/helpers.php
π function format_phone() (line 15) - 8 calls
π Called from 8 locations:
π app/Http/Controllers/UserController.php:
β line 45 in store()
β line 78 in update()Identify refactoring opportunities:
- God Classes - High complexity scores
- Tight Coupling - Classes with many dependencies
- Circular Dependencies - Problematic architectural patterns
π Graph Statistics:
β’ Total Nodes: 1,284
β’ Total Dependencies: 2,891
β’ Orphaned Elements: 23
π₯ Most Depended Upon Elements:
1. Database (helpers/Database.php) - 47 dependents
2. Utils (lib/Utils.php) - 34 dependents
π§ Most Complex Elements:
1. OrderController (Http/Controllers/OrderController.php) - Score: 89
2. UserService (Services/UserService.php) - Score: 67
{
"nodes": {
"class:App\\Models\\User:8": {
"id": "class:App\\Models\\User:8",
"name": "User",
"type": "class",
"file": "/app/Models/User.php",
"dependencies": {...},
"dependents": {...}
}
},
"totalNodes": 1284,
"totalEdges": 2891
}The tool follows clean architecture principles:
cmd/- Application entry pointsinternal/- Private application codepkg/- Public library codetestdata/- Test fixturesdocs/- Documentation
Create a configs/analyzer.yaml file:
exclude_dirs:
- vendor
- node_modules
- storage/cache
- .git
include_extensions:
- .php
- .phtml
max_concurrent_parsers: 10| Tool | Language Focus | Primary Purpose | Output Style | Complexity/Dependency Metrics | Multi-language | CI/CD Friendly | Footprint |
|---|---|---|---|---|---|---|---|
| Tukey | PHP first (pluggable for others) | Maps dependencies, complexity, and orphans | Console summary, JSON export | β Yes (graph, hotspots, orphans) | π Designed for it | β Simple JSON + CLI | β‘ Lightweight (single binary) |
| PHPStan | PHP | Type safety, strict type checking | CLI, IDE integration | β No | β No | β Yes | βοΈ Medium (lots of rules) |
| Psalm | PHP | Type checking + code correctness | CLI, IDE integration | β No | β No | β Yes | βοΈ Medium |
| PDepend | PHP | Code metrics, class dependencies | XML, charts, reports | β Yes (metrics & graphs) | β No | π Heavier (XML reports) | |
| phpmetrics | PHP | High-level project health reports | HTML dashboards | β Yes (wrapped from PDepend) | β No | π Heavier (GUI focus) | |
| SonarQube | Many (20+) | Enterprise-grade code quality + coverage | Web dashboards, DB backend | β Yes (lots, but buried) | β Yes | β Deep CI/CD | π’ Heavy (server required) |
| SourceTrail (archived) | C++, Java, Python | Interactive code exploration (graph viewer) | GUI (desktop) | β Yes (visual graph) | β Limited | β No | π» Desktop app only |
- Tukey is not a linter: it doesnβt enforce style or types. Instead, it draws the map of your system.
- Output is lightweight: JSON + console means you can plug it into CI pipelines or explore locally without dashboards.
- Language-agnostic design: while starting with PHP, the parser interface makes adding new languages straightforward.
- Zero infrastructure: unlike SonarQube, Tukey is just a single binary β no servers, no databases.
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
# Setup development environment
make deps
# Run tests
make test
# Run with coverage
make test-coverage
# Format code
make fmt
# Run linter
make vet
# Build for development
make dev ARGS="-v ./testdata/sample_project"This project is licensed under the MIT License - see the LICENSE file for details.
- Web dashboard for dependency visualization
- Integration with popular IDEs
- Laravel-specific analysis patterns
- Circular dependency detection
- Performance bottleneck identification
- Git integration for change impact analysis
- Inspired by the need to understand complex legacy PHP codebases
- Built with Go for performance and cross-platform compatibility