Repository navigation
feat: add baseline loading, generation and deltas - #14
Merged
Merged
Conversation
Adds --baseline/-b and --generate-baseline/-g to analyse. A baseline is auto-detected from .jcca/baseline when none is given. Both the 2.0 format and a JSON report (legacy) are accepted, all validation errors are collected, and a changed metric configuration produces a warning. Deltas of weights, score, Halstead, cyclomatic and understandability are shown in the console tables and the JSON report. Includes a corrected schemas/baseline.json that every generated baseline is validated against.
…eltas Validation no longer returns partial results, which removes unobservable return paths. The previous-metrics delta calculation is replaced by applyBaseline everywhere. Deltas of non-finite values no longer throw. Adds tests for the remaining unkilled and uncovered mutants.
…den numbers Generated baselines use UTC for the file name and createdAt, are created without replacing an existing file and get a -N suffix on a collision. Auto-detect parses the timestamp strictly, ignores other names and non-regular files, and orders by timestamp then suffix. A class that became or stopped being duplicate is matched by its name when that identifies exactly one baseline class. Non-finite numbers are rejected when reading and shown as N/A in the console. The format error names the file.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
analyse --baseline/-b <file>loads and applies a baseline. Without it, the newest.jcca/baseline/baseline-*.json(by the timestamp in the name, then mtime) is auto-detected and announced with a warning.analyse --generate-baseline/-gwrites.jcca/baseline/baseline-YYYY-MM-DD_HH-mm-ss.json(format 2.0, atomic write, injectable clock) after the existing baseline was applied.Invalid baseline file format: ...message. Missing and malformed files have their own messages. A config-hash mismatch is a warning.Δ +x(red) orΔ -x(green) in grouped and single tables. The JSON report also carries the non-weight deltas.domain(PIT-covered); the file handling and matching by the JSON report's class key (<class>@<file>for classes in several files) live next to the reports. The atomic write ofReportWriteris extracted to a sharedAtomicFileWriter.schemas/baseline.json(draft-07) for the 2.0 and legacy formats. A test validates every generated baseline and a JSON report against it (json-schema-validator, test scope).Test plan
./mvnw -B verify: 610 tests, JaCoCo 97.2% line / 95.4% branch, PIT 834 of 844 mutations killed-g, modify sources, run with auto-detect shows deltas (grouped and single table golden files), apply-then-generate order, hash mismatch, legacy report as baseline, reports with deltasjava -jar target/cognitive-analysis.jar