1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
// Copyright 2025 Umberto Gotti <umberto.gotti@umbertogotti.dev>
// Licensed under the MIT License
// SPDX-License-Identifier: MIT
use crateOffence;
use crateSourceFile;
// One rule, one file, one implementation. A rule sees a single source file and
// answers with what is wrong with it -- it does not walk, does not print, and
// does not know which other rules exist.
//
// That is what keeps the set open: adding a rule is a new file implementing this
// trait plus one line in the registry, and the rule is testable on a string of
// source without a workspace behind it.
//
// Nothing declared here has a body, and that is the point. Every rule answers
// all four questions in its own file, including the answers that are "nothing".
//
// Defaults used to spare a rule from saying so, and what they cost was the
// ability to read a rule and know what it does. A file with no `check` meant
// either "this rule's subject is the tree" or "this rule has not been finished",
// and the two were the same absence. `is_configured` was worse: it made every
// new rule configured without anybody choosing it, so a rule that could not
// possibly run would still join the set and report nothing wrong -- the silent
// pass this tool exists to catch, in the tool itself.
//
// The other half of "a trait declares" -- that every implementor implements
// every method -- costs no code here. With no body to fall back on, `rustc`
// rejects an incomplete impl outright.