Skip to content

quality: migrate PHPMD to 3.0.0 - #41

Merged
Alexandre-T merged 3 commits into
mainfrom
39-story-assess-phpmd-300-migration-impact-on-geoparser
Oct 12, 2026
Merged

Alexandre-T merged 3 commits into
mainfrom
39-story-assess-phpmd-300-migration-impact-on-geoparser

Conversation

@Alexandre-T

@Alexandre-T Alexandre-T commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

Pull Request

Related to #39. This PR implements the migration requested by the maintainer; it does not close the separate impact-assessment Story or claim its comparison/report criteria are complete.

Summary

Upgrade PHPMD from ^2.15 to ^3.0.0 using commit 37c99c88e5a47fcad0cf85254b82bab255c186b4 as the migration baseline. Replace the source and test XML configurations with YAML, and update Composer and GitHub Actions to the PHPMD 3 CLI:

phpmd analyze <directory> --ruleset <ruleset.yml> --format text

The library rules retain unused-code, code-size, naming, controversial and design checks. ShortVariable keeps minimum 3 and the x,y exceptions.

The test rules change as follows:

  • ExcessiveMethodLength uses maximum: 120 instead of the former minimum: 120.
  • TooManyPublicMethods is no longer excluded.
  • LongMethodName is excluded because test names describe individual cases.

Update repository instructions to reflect PSR-4 paths, removal of the Docker environment, protected branches, and the PHPMD 3 configuration. Run CI for pull requests and on the existing weekly schedule, retaining the Markdown/LICENSE exclusions for pull requests. The schedule is 0 17 * * 5 (Friday at 17:00 UTC).

Acceptance criteria

  • PHPMD dependency, rulesets, Composer scripts and CI commands use version 3 conventions.
  • Source and test analysis pass with the installed PHPMD 3.0.0.
  • CI runs for pull requests and on the restored weekly schedule.
  • The independent impact assessment in Story: Assess PHPMD 3.0.0 migration impact on GeoParser #39 remains open.

Validation

  • Relevant tests pass: 509 tests, 1,815 assertions, 100% line coverage.
  • Repository quality checks pass (PHP-CS-Fixer, PHPStan level 9, PHPMD source and tests).
  • Regression tests: not applicable; no parser behavior changes.
  • Workflow YAML parses successfully with pull_request and schedule triggers; the restored cron is 0 17 * * 5.
  • Validation ran locally on PHP 8.5.11 with PHPMD 3.0.0; the GitHub PHP matrix was not run locally.

Commands run

composer test
composer quality
quality/php-mess-detector/vendor/bin/phpmd --version
./quality/php-mess-detector/vendor/bin/phpmd analyze lib --ruleset quality/php-mess-detector/ruleset.yml --format text
./quality/php-mess-detector/vendor/bin/phpmd analyze tests --ruleset quality/php-mess-detector/test-ruleset.yml --format text
ruby -e 'require "yaml"; w=YAML.load_file(".github/workflows/ci.yml"); e=w.fetch("on",w[true]); abort unless e.keys==["schedule","pull_request"] && e["schedule"]==[{"cron"=>"0 17 * * 5"}]; puts "YAML valid; scheduler restored"'
git diff --check

Standards

  • No normative spatial behavior is affected.

Normative references

N/A

Architecture

  • No architectural boundary is affected.

Architecture decision

N/A

Compatibility

  • No supported public API is affected.
  • No breaking change is introduced to the library API.

Quality tooling now requires the PHPMD 3 CLI and YAML rulesets.

Documentation

  • Documentation was updated where required in AGENTS.md.

Developer handoff

Important implementation decisions

Commit 37c99c8 supplies the dependency and YAML migration. Amended follow-up commit c70c999 fixes CI commands that still referenced the deleted XML files and aligns the documented PHPMD requirement and weekly schedule. The original scheduler is preserved.

Compatibility considerations

Rule migration is not strictly behavior-preserving: the test naming exclusion and public-method check differ as described above. The codeclimate-ruleset.xml file is unchanged; it is not referenced by Composer quality scripts or this GitHub workflow.

Remaining risks or questions

PHPMD 2 versus 3 metrics, threshold-boundary behavior, performance comparisons, and the consolidated assessment requested by #39 are outside this implementation PR and remain to be documented.

Upgrade PHPMD configuration and rulesets for improved code quality checks
@Alexandre-T Alexandre-T linked an issue Oct 12, 2026 that may be closed by this pull request
10 tasks done
@codecov-commenter

codecov-commenter commented Oct 12, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (bee9903) to head (c70c999).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff             @@
##                main       #41   +/-   ##
===========================================
  Coverage     100.00%   100.00%           
  Complexity       149       149           
===========================================
  Files             10        10           
  Lines            303       303           
===========================================
  Hits             303       303           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@Alexandre-T
Alexandre-T force-pushed the 39-story-assess-phpmd-300-migration-impact-on-geoparser branch from c13a337 to c70c999 Compare October 12, 2026 13:56
@Alexandre-T
Alexandre-T merged commit 5f3f7b9 into main Oct 12, 2026
9 checks passed
@Alexandre-T
Alexandre-T deleted the 39-story-assess-phpmd-300-migration-impact-on-geoparser branch October 12, 2026 14:05
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.

Story: Assess PHPMD 3.0.0 migration impact on GeoParser

2 participants