f721951a

Created Cancelled

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

Draw a rule's golden against the code it points at

RuleSpec had a format of its own: one tab-separated line per finding, holding
the rule id, the span, the scope key and the message. It pinned the right
things and none of them could be read. Checking that HsNoCustomEq underlines
the whole of an instance rather than its first line meant resolving 8:1-9:36
against the resource by hand, and nobody was going to, so a span covering half
of what it named would have gone in unnoticed. The empty-instance case is the
one that made this obvious: 5:1-5:19 says nothing, and `instance Eq Colour`
with a line under it says all of it.

So the goldens are now the same rendering a person gets at the end of a run,
which is what ReportSpec already goldens and for the same reason: the
rendering is the product for anyone not reading the source, so it is reviewed
like one. It brings the rule text, the note and the suppression hint with it,
which is three more things per rule that a reader of the diff can be wrong
about out loud.

What is no longer in a rule golden is the scope key. It is what a suppression
is matched on, so this does lose something, and what is left in its place is
the hint, which names the line a suppression has to go above. Whether that is
enough is the open question here: the alternative is a scope line above the
drawing, which puts two formats back in one file.

Every rule golden is reset by this, so most of the diff is the format rather
than any rule's behaviour changing. No finding moved: the suite passes on the
same spans and messages it passed on before.
GitHub