Skip to content

1.3.0

Latest

Choose a tag to compare

@fain182 fain182 released this 31 Jul 08:17

It's all about the baseline

The baseline no longer breaks when you touch your code

A recorded violation used to be identified by its line number, so reformatting a file or adding an import above it reopened violations you had already accepted. Matching is now based on the class and on what the violation reports, so moving code around doesn't resurrect it, and two violations of the same rule in the same class stay distinct. The because() reason is ignored when matching, so rewording an explanation no longer invalidates the baseline. Existing baselines keep working and need no regeneration.

The whole baseline lifecycle is now covered

You create it with a dedicated generate-baseline command instead of an option bolted onto check. Every check run tells you how many recorded violations look fixed, so you find out that your baseline has gone stale while you are already looking at the output. And you clear them out with the new prune-baseline, which only ever shrinks the file: it removes what you have fixed and never records anything new, so paying down debt can't quietly accept more of it.

💡 3 violations in the baseline look fixed — run `phparkitect prune-baseline` to remove it

Checks are faster

Files are now parsed at most once per run, so configs where several rules cover the same code no longer pay for the same parsing over and over.

Breaking changes

check --generate-baseline is now the generate-baseline command. The old option is kept as a failing stub that points to the new command, so an outdated CI invocation fails loudly instead of silently doing nothing. See UPGRADE.md for the details.

--ignore-baseline-linenumbers / ignoreBaselineLinenumbers() is deprecated: baseline matching already tolerates moved violations, so the option has no effect and prints a notice. It will be removed in the next major version.

What's Changed

  • Ignore the because() reason when matching baseline violations by @fain182 in #637
  • Add message to report when baseline violations look fixed by @fain182 in #638
  • Cover violation file with tests by @AlessandroMinoccheri in #631
  • docs: add guide for writing custom rules by @fain182 in #635
  • ci: switch dependabot versioning-strategy to widen by @fain182 in #652
  • Extract CheckHandler application service from Check command by @fain182 in #654
  • Extract CommonOptions, composed by analysis-running commands by @fain182 in #655
  • Promote --generate-baseline to a first-class generate-baseline command by @fain182 in #656
  • ci: pin third-party GitHub Actions to commit SHAs by @fain182 in #658
  • build: manage psalm and box via composer in tools/ instead of committed phars by @fain182 in #659
  • build: upgrade psalm to 6.16, fix newly reported issues by @fain182 in #660
  • Add prune-baseline command with shrink-only semantics by @fain182 in #657
  • Document breaking change: check --generate-baselinegenerate-baseline command by @fain182 in #663
  • Remove final from all classes and enforce it with an architectural rule by @fain182 in #664
  • refactor: pair violations with baseline entries in one place by @fain182 in #665
  • feat: match baseline violations without asking the user how by @fain182 in #666
  • Cache parse results so a repeated class set is parsed only once by @fain182 in #667

Full Changelog: 1.2.0...1.3