2.4 KiB
PR#67: The Commands of Main.kt at a Mutation-CRAP of at Most 15
Version: patch
WARNING: This document describes only the change applied in this PR. It may already be outdated once the next PR is merged. Historic PR documentation is not maintained along with new PRs; treat it as a snapshot.
Related Links
- PR#64, after which a branch build fails on each method above 15 in the files it changes.
- PR#65, which changes
Main.ktand waits for this PR.
Problem
Main.kt holds the command line of werkregie-dashboard, nearly without tests.
Since PR#64, each change of it fails the branch build: 7 of its methods are above 15, main at 600.
PR#65 must change it, to read the required checks of a pull request.
Non-Goals
- No change of the commands, their options, outputs or exit codes.
- No other file above 15, e.g.
PullRequestWatch.kt; PR#65 changes that one.
Solution
A method without killed mutants stays at 15 only up to a complexity of 3; a well tested one up to 15. So the decisions move into tested functions, and what reads the terminal or the network decides nothing.
mainlooks up its command in a table and calls it; a wrong call is aUsageError, whichmainprints with exit code 2.Invocation, in a file of its own, reads the command line: mode,--config, the environment, options and arguments. The configuration is read only when a command needs it, as before only afterhelpandversion.- Tested functions out of the commands:
watchTarget: the pull request and the interval ofwatch-pr;relayForgottenandloopback: the answer offorget-relayby the server's status;credentialsandloggedIn: user, password and the answer ofmatrix login;zoneOf,firstStory,orNoneandmatrixOf: the journal's zone, the story of a Taiga ref, optional parts of the configuration.
pitestPartial mutationCrapCheck against main: 162 mutants, the highest Mutation-CRAP 12, e.g. main and forgetRelay.
Additional Changes
pitestPartialalso takes the Kotlin files that git does not track yet, e.g. a new file before its first commit; so far it took only the changed ones.doc/werkregie.werkbaum: the mutation tests of PR#64 are deployed.
Follow-up PRs
- PR#65:
watch-prreportsREADYonly when each required check passed.