Skip to content

CI: run phpcbf autofix so contributors don't get blocked on whitespace nits #188

@lezama

Description

@lezama

Problem

Right now PHPCS warnings on indentation / array-arrow alignment / whitespace fire on PRs and have to be fixed by hand. Examples we've hit recently:

  • WordPress.Arrays.MultipleStatementAlignment.DoubleArrowNotAligned (multi-line array arrows)
  • Tab-vs-space inconsistencies from editors with different defaults
  • Indentation regressions inside top-level code blocks

These are 100% mechanical and PHPCBF (the phpcs autofixer) resolves them deterministically. Asking external contributors to chase them down is friction we don't want — especially as the substrate is trying to attract OSS adopters.

Proposal

Easiest path, in priority order:

  1. composer run lint:fix script"lint:fix": "phpcbf --standard=phpcs.xml --extensions=php src/ tests/". Documented in CONTRIBUTING.md so contributors can run it locally before push.
  2. CI suggestion job — On PR, run phpcbf and post the resulting diff as a review comment with a one-click "apply suggestion" so contributors can accept without leaving the PR.
  3. Auto-commit on internal branches — For PRs from collaborators with write access, optionally auto-commit the phpcbf diff back to the branch.

Acceptance

  • composer run lint:fix autofixes sniff-fixable issues locally
  • CONTRIBUTING.md mentions it under "Before pushing"
  • (Optional) CI posts suggestion diff on PRs

Why

Sniff-fixable whitespace warnings should never be a contributor's problem — they're a tooling problem. The substance of a substrate review is interface design, not tab indentation.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions