A PHP tool that identifies files needing refactoring by analyzing commit frequency and cyclomatic complexity.
churn-php is a command-line tool that helps PHP developers identify which files in their codebase are the best candidates for refactoring. It does this by analyzing each PHP file's commit history and cyclomatic complexity to generate a prioritization score. The tool outputs a ranked table so developers can focus refactoring efforts where they'll have the most impact.
PHP developers and teams maintaining legacy or evolving codebases who want to systematically improve code quality through refactoring.
Developers choose churn-php because it provides objective, data-driven insights about refactoring priorities, saving time over manual inspection. Its configurable scoring and extensible hooks make it adaptable to different project workflows and quality standards.
Discover files in need of refactoring.
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Analyzes file commit frequency within a configurable timeframe to identify frequently changed code, helping prioritize refactoring where changes are common, as shown in the customizable 'commitsSince' setting.
Calculates cyclomatic complexity to pinpoint overly intricate logic, with results displayed in a sortable table that ranks files by a combined score for easy decision-making.
Supports YAML configuration for thresholds, ignored files, and parallel processing, allowing customization to fit different project needs and workflows, as detailed in the sample churn.yml.
Allows custom logic injection via event hooks before/after analysis stages, enabling developers to integrate bespoke workflows or additional metrics, as outlined in the hooks configuration section.
Relies solely on commits and cyclomatic complexity, ignoring other refactoring indicators like code duplication or test coverage, which limits comprehensive code quality assessment.
Requires a version control system with commit history; projects using unsupported VCS or with sparse history may yield inaccurate or less useful results, as it defaults to Git.
Only identifies refactoring candidates without providing automated fixes or suggestions, leaving the actual refactoring work entirely to developers, which may slow down improvement efforts.