cb6047ea

By: Tom Sydney Kerckhove <syd@cs-syd.eu>

hopinion: check a repository against one rule

A tool that reads a repository's Haskell and reports what a rule has to say
about it, and a Nix layer that runs it as one check.

One rule ships: HsNoCustomShowRead, from haskell-style.md. It is here so that
the machinery is exercised by something real rather than by a demonstration.

The shape it is built on:

A rule says there is something to fix or there is not. There is no third
answer, because a checker whose silence can mean "I could not tell" is a
checker whose silence means nothing. A module that did not parse is a failure
of the run rather than a module with nothing wrong in it, and a module whose
source is a preprocessor's input is counted as unread.

A rule is a value in a registry rather than an instance of a class: no generic
code is polymorphic in a check type, so a record of functions is the right
encoding. Adding a rule is a module and a line in a list.

Producing a report always succeeds and only judging one fails, so a check that
found something still leaves the report where a person can read it.

Nothing here is built for a rule that does not exist yet. There is one level,
no fact store, no cross-process split and no reading of compiler output,
because one module-level rule needs none of them. The build enforces that:
-Wunused-packages, -Wunused-top-binds and weeder all run as errors, so
machinery that stops being used stops compiling.

What comes next, each with the rule that pays for it: suppressions and comment
attachment with the first comment rule, the fact store with the first package
rule, and the artifacts and the cross-process split with the first project
rule.

Suite timing

Time to Start Worker time Duration Time to finish Idle
Config 9s 0s 0s 10s 9s
Eval 11s 10s 10s 21s 0s
Build 20s 0s 0s 20s 0s
Suite 9s 11s 11s 21s 10s

Timeline

0s10s20s