Skip to content

Feat/modernize code metrics#9

Merged
ralflang merged 7 commits intoFRAMEWORK_6_0from
feat/modernize-code-metrics
Feb 27, 2026
Merged

Feat/modernize code metrics#9
ralflang merged 7 commits intoFRAMEWORK_6_0from
feat/modernize-code-metrics

Conversation

@ralflang
Copy link
Member

Modernize code metrics

  • phploc is no longer in the default qc pipeline for the qc command but still can be called by horde-components qc loc
  • phpmetrics is used in the default qc pipeline and can also be called separately as horde-components qc metrics

Deprecates unmaintained PHPLOC task and introduces modern PHPMetrics
as replacement for code metrics analysis.

Changes:
- PHPLOC (loc) task now opt-in only (removed from default pipeline)
- New Metrics task using PHPMetrics (opt-in, not in default yet)
- Comprehensive metrics: MI score, complexity, coupling, cohesion
- HTML reports + JSON output for CI
- Updated documentation

BREAKING CHANGE: LOC task removed from default QC pipeline.
Use 'horde-components qc loc' to run explicitly (deprecated).
Prefer 'horde-components qc metrics' for modern analysis.
Promotes PHPMetrics to default QC pipeline, replacing deprecated PHPLOC.
The metrics task now runs automatically with 'horde-components qc'.

Default pipeline order:
1. gitignore - VCS configuration
2. lint - syntax validation
3. phpcsfixer - code style
4. unit - test suite
5. phpstan - static analysis
6. metrics - code quality metrics (NEW)

PHPLOC (loc) remains available for explicit use but is deprecated.
Adds separators before and after deactivated task warnings to match
the visual formatting of active tasks. Improves readability of QC
pipeline output when optional dependencies are missing.
Extends binary detection to check global Composer installations:
- ~/.composer/vendor/bin/phpmetrics (legacy)
- ~/.config/composer/vendor/bin/phpmetrics (XDG standard)
- %APPDATA%/Composer/vendor/bin/phpmetrics (Windows)

Supports tools installed with: composer global require phpmetrics/phpmetrics
…ibility

Makes QC Tasks compatible with the SystemCall trait by implementing
the pretend() method. This allows QC tasks to respect the --pretend
flag like Release tasks do.

Benefits:
- QC tasks can now use SystemCall trait methods (system, exec, etc.)
- --pretend mode works for QC operations
- Consistent behavior between QC and Release tasks

Fixes fatal error: Call to undefined method pretend() when running
the metrics task.
PHPMetrics v2.x has issues with multiple directory arguments, resulting
in incomplete analysis. Changed to analyze only the primary source
directory (src/ or lib/) to ensure all classes are properly scanned.

Before: 9 classes analyzed (broken)
After: 179 classes analyzed (correct)

The task now properly analyzes all subdirectories within src/ including
Runner/, Helper/, Module/, Component/, etc.
@ralflang ralflang merged commit 5d792ab into FRAMEWORK_6_0 Feb 27, 2026
1 check failed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant