Skip to content

Add quality gates: Rector and minimum coverage - #49

Merged
neto737 merged 1 commit into
mainfrom
feat/3.0-quality-gates
Oct 30, 2026
Merged

neto737 merged 1 commit into
mainfrom
feat/3.0-quality-gates

Conversation

@neto737

@neto737 neto737 commented Oct 30, 2026

Copy link
Copy Markdown
Owner

Adds two quality gates to CI: a Rector dry run, and a minimum line coverage of 100%.

Rector

  • Config: rector.php covers src and tests. The rule sets are:
    • the PHP sets, which follow composer.json's ^8.3
    • dead code, code quality and type declarations
    • the PHPUnit attribute set
  • Where it runs:
    • in CI, as a step of the Coding standard job, since that job is already a required check on main
    • in composer check, through the new composer rector script; composer rector:fix applies the changes
  • Changes already applied (18 files, no behaviour change):
    • typed class constants (public const string VERSION)
    • final readonly class for classes whose properties were all readonly: BitGo, Paginator and the resource classes
    • return types on arrow functions
    • one in_array() in Path::check()
    • @param tags that repeated the signature with no description were removed
  • Skipped rules:
    • LocallyCalledStaticMethodToNonStaticRector, because the pure helpers in Http and RetryPolicy stay static on purpose
    • RecastingRemovalRector in RetryPolicy. The (int) in backoffMs() matters: 2 ** n becomes a float once it overflows, and random_int() needs an int.

Coverage

  • CI gate: a Check coverage step in the PHPUnit (PHP 8.4, highest) job reads coverage.xml and fails below MIN_COVERAGE (100). That job is already required, so the gate blocks a merge with no ruleset change.
  • Codecov: codecov.yml sets the project and patch targets to 100%, so the Codecov checks agree with CI. They aren't required checks; the CI step is what blocks a merge.

Checked

  • Rector: a dry run on a file with an untyped constant exits 2. Applying Rector and then PHP-CS-Fixer leaves nothing for either to change.
  • Coverage: the coverage step passes at 297/297 lines and fails, with an ::error:: annotation, when coverage is low.
  • composer check: passes, with 182 tests and coverage at 100%.

Also

  • CONTRIBUTING.md covers Rector and the coverage minimum.
  • .gitattributes keeps rector.php and codecov.yml out of dist archives.
  • No CHANGELOG entry: the change is tooling only, and nothing in the public API changes.

…ck, and CI fails when line coverage drops below 100%, with matching Codecov targets.
@codecov

codecov Bot commented Oct 30, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (7761f26) to head (3d4a958).

Additional details and impacted files
@@             Coverage Diff             @@
##                main       #49   +/-   ##
===========================================
  Coverage     100.00%   100.00%           
+ Complexity       161       159    -2     
===========================================
  Files             16        16           
  Lines            370       370           
===========================================
  Hits             370       370           

☔ 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.

@neto737
neto737 merged commit 4b4af4a into main Oct 30, 2026
13 checks passed
@neto737
neto737 deleted the feat/3.0-quality-gates branch October 30, 2026 07:12
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