Files
claude-code d441b059af
werkator build succeeded after 03:23
werkator/publish build succeeded after 00:21
Example reports with every state of a method (0.26.10) (#65)
Co-authored-by: claude-code <claude-code@javagil.de>
2026-10-11 18:02:48 +02:00

70 lines
2.6 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Mutation-CRAP
Experimental metric `mutation-crap` version 1, status policy `timeouts-killed-v1`: `C² × (1 − MS)³ + C` with C the JaCoCo complexity and MS the share of killed mutants, as the policy counts them.
No threshold is proven; a score is no proof of correctness.
- Analysis: `:pitest`
- Tools: werkcrappit 0.26.10, PIT 1.30.0, JaCoCo 0.8.15
- Scope: 3 classes selected by PIT, all read
## Summary
| State | Methods |
| --- | ---: |
| SCORED | 2 |
| NO_MUTATION_RESULTS | 1 |
| NO_ELIGIBLE_MUTANTS | 1 |
| INCONCLUSIVE | 1 |
| COMPLEXITY_UNAVAILABLE | 1 |
| EXCLUDED | 1 |
## Scored Methods
Highest score first.
| Mutation-CRAP | Complexity | Mutation score | Killed / eligible | Method |
| ---: | ---: | ---: | ---: | --- |
| 22.5 | 10 | 0.50 | 5 / 10 | `demo.Classifier.classify(I)Ljava/lang/String;` |
| 1 | 1 | 1.00 | 1 / 1 | `demo.Classifier.normalize(I)I` |
## Methods Without Score
These are not rated well or badly; they have no score, for the reasons given.
| State | Method | Complexity | Mutants | Reasons |
| --- | --- | ---: | --- | --- |
| NO_ELIGIBLE_MUTANTS | `demo.Classifier.compare(II)I` | 2 | NON_VIABLE 2 | `no-eligible-mutants` |
| NO_MUTATION_RESULTS | `demo.Classifier.describe()Ljava/lang/String;` | 2 | none | `no-mutation-results` |
| INCONCLUSIVE | `demo.Classifier.retry(I)I` | 3 | KILLED 2, RUN_ERROR 1 | `inconclusive-status:RUN_ERROR` |
| EXCLUDED | `demo.Grade.values()[Ldemo/Grade;` | — | none | `jacoco-filtered:other` |
| COMPLEXITY_UNAVAILABLE | `demo.Legacy.run()V` | — | SURVIVED 1 | `complexity-unavailable`, `method-not-in-inventory` |
## Cohesion and Coupling
LCOM4 counts groups of methods that neither call each other nor share a field; above 1, a class could be split.
Ce counts the other classes of the analysed code a class depends on, Ca those depending on it.
| LCOM4 | Class | Method groups |
| ---: | --- | --- |
| 2 | `demo.Classifier` | classify, normalize, retry · compare, describe |
| Ce | Ca | Class |
| ---: | ---: | --- |
| 1 | 0 | `demo.Classifier` |
| 0 | 1 | `demo.Grade` |
## Change Risk
Mutation-CRAP over the whole class, its scored methods summed, times (1 + (LCOM4 - 1) / 2) times (1 + Ce / 20).
A class with an unclear method or without a scored one has no change risk.
| Change risk | Complexity | Mutation score | Killed / eligible | LCOM4 | Ce | Class |
| ---: | ---: | ---: | ---: | ---: | ---: | --- |
## Exclusion Rules
- PIT `excludedMethods`: none
- werkcrappit `excludeClasses`: none
- werkcrappit `excludeMethods`: none
- Methods JaCoCo filters as compiler-generated are excluded with the reason `jacoco-filtered:…`.