1#[derive(Clone, Copy, Debug, PartialEq, Eq)]
6pub enum LintCode {
7 GridRowsPerBar,
8 MissingComment,
9 MalformedComment,
10 MultilineComment,
11 LongCommentBlock,
12 LongExpressionBody,
13 LiteralSampleRate,
14 Arity,
15 KeyIsNotAPitch,
16}
17
18impl LintCode {
19 pub const ALL: &'static [LintCode] = &[
20 LintCode::GridRowsPerBar,
21 LintCode::MissingComment,
22 LintCode::MalformedComment,
23 LintCode::MultilineComment,
24 LintCode::LongCommentBlock,
25 LintCode::LongExpressionBody,
26 LintCode::LiteralSampleRate,
27 LintCode::Arity,
28 LintCode::KeyIsNotAPitch,
29 ];
30
31 pub fn code_str(self) -> &'static str {
32 match self {
33 LintCode::GridRowsPerBar => "grid-rows-per-bar",
34 LintCode::MissingComment => "missing-comment",
35 LintCode::MalformedComment => "malformed-comment",
36 LintCode::MultilineComment => "multiline-comment",
37 LintCode::LongCommentBlock => "long-comment-block",
38 LintCode::LongExpressionBody => "long-expression-body",
39 LintCode::LiteralSampleRate => "literal-sample-rate",
40 LintCode::Arity => "arity",
41 LintCode::KeyIsNotAPitch => "key-is-not-a-pitch",
42 }
43 }
44
45 pub fn help(self) -> &'static str {
47 match self {
48 LintCode::GridRowsPerBar => {
49 "make the row count a whole multiple of the filename's bar span, or restate the span"
50 }
51 LintCode::MissingComment | LintCode::MalformedComment => {
52 "give the node one `;`-comment line: `; Models: ... | Neglects: ... | IO: ... -> ... \
53 | Tags: ...`"
54 }
55 LintCode::MultilineComment => "fold the `;`-comment onto one line",
56 LintCode::LongCommentBlock => {
57 "move the prose out of the node and keep the one `;`-comment line"
58 }
59 LintCode::LongExpressionBody => "split the expression across nodes and `@ref` them",
60 LintCode::LiteralSampleRate => {
61 "write the sample period as `sp` and let the render choose its rate"
62 }
63 LintCode::Arity => "give the call what its builtin reads, as `sva-cli builtins` lists",
64 LintCode::KeyIsNotAPitch => {
65 "hold one note name or a number of hertz in `variables/key`"
66 }
67 }
68 }
69}