Every class of werkcrappit below a Mutation-CRAP of 10, the ratchet at 9 (0.16.4) #33

Merged
mi merged 1 commits from mihoe/below-ten into main 2026-10-03 19:10:41 +02:00
Owner

Related Links

  • PR#32, which left six methods at 10 or above

The Problem

After PR#32 six methods of werkcrappit-pit still had a Mutation-CRAP of 10 or more, so their classes were red and a gate at 10, as in hsadmin-ng, would fail:
Json.write 11, MarkdownReport.finished 10.9, Json.string 10.4, Gate.judge and JsonReader.escaped 10.3, Levelization.levelize 10.
Two of them were too complex to go below 10 even with every mutant killed; the others had surviving mutants.

Non-Goals

  • New behaviour: only tests and splits; the reports are byte for byte the same.

The Solution

Splits along the steps of the domain, not only to cut lines:

  • Levelization.levelize follows ccsh's levelization in three named steps: a SiblingGraph lifts the dependencies onto the children of a folder, breakCycles breaks its cycles, and layers assigns the levels.
  • Json.write lays out the structures, objects and arrays; a scalar is written in one piece, and a number has its own rules, as JSON knows neither NaN nor infinity.
  • MarkdownReport.finished writes the report's sections, one method each: header, summary, scored methods, methods without score, exclusion rules.
  • Gate.judge only needs to know whether any method was scored, not how many: a counter became a flag.

Tests for the mutants that survived: control characters against the space in Json.string, the exact errors of JsonReader at an early end, an unterminated escape and a short \u escape, the scope lines of the Markdown report, NaN and exact numbers in Json.write, and a gate without a note when every method is scored.

The ratchet goes to maxMutationCrap = 9, the highest value now; colorRedFrom is dropped, so red starts at 90 % of the limit, 8.1, still before the build fails.
Version 0.16.4.

Attachments

Local PIT runs of werkcrappit-pit

PR#32 This PR
Highest Mutation-CRAP 11.0 9.0
Methods at 10 or more 6 0
Classes at 9 or more 6 of 45 3 of 45 (exactly 9: complexity 9, every mutant killed)
Mutants killed 88 % 89 %

🤖 Generated with Claude Code

## Related Links - [PR#32](2026-10-03-PR%2332-split-complex-methods.md), which left six methods at 10 or above ## The Problem After PR#32 six methods of werkcrappit-pit still had a Mutation-CRAP of 10 or more, so their classes were red and a gate at 10, as in hsadmin-ng, would fail: `Json.write` 11, `MarkdownReport.finished` 10.9, `Json.string` 10.4, `Gate.judge` and `JsonReader.escaped` 10.3, `Levelization.levelize` 10. Two of them were too complex to go below 10 even with every mutant killed; the others had surviving mutants. ## Non-Goals - New behaviour: only tests and splits; the reports are byte for byte the same. ## The Solution Splits along the steps of the domain, not only to cut lines: - `Levelization.levelize` follows ccsh's levelization in three named steps: a `SiblingGraph` lifts the dependencies onto the children of a folder, `breakCycles` breaks its cycles, and `layers` assigns the levels. - `Json.write` lays out the structures, objects and arrays; a `scalar` is written in one piece, and a `number` has its own rules, as JSON knows neither NaN nor infinity. - `MarkdownReport.finished` writes the report's sections, one method each: header, summary, scored methods, methods without score, exclusion rules. - `Gate.judge` only needs to know whether any method was scored, not how many: a counter became a flag. Tests for the mutants that survived: control characters against the space in `Json.string`, the exact errors of `JsonReader` at an early end, an unterminated escape and a short `\u` escape, the scope lines of the Markdown report, NaN and exact numbers in `Json.write`, and a gate without a note when every method is scored. The ratchet goes to `maxMutationCrap = 9`, the highest value now; `colorRedFrom` is dropped, so red starts at 90 % of the limit, 8.1, still before the build fails. Version 0.16.4. ## Attachments ### Local PIT runs of werkcrappit-pit | | PR#32 | This PR | |---|---|---| | Highest Mutation-CRAP | 11.0 | 9.0 | | Methods at 10 or more | 6 | 0 | | Classes at 9 or more | 6 of 45 | 3 of 45 (exactly 9: complexity 9, every mutant killed) | | Mutants killed | 88 % | 89 % | 🤖 Generated with [Claude Code](https://claude.com/claude-code)
mi added 1 commit 2026-10-03 19:03:56 +02:00
mi merged commit 566537cd9a into main 2026-10-03 19:10:41 +02:00
mi deleted branch mihoe/below-ten 2026-10-03 19:10:41 +02:00
Sign in to join this conversation.
No Reviewers
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: mi/werkcrappit#33