bend-lint 0.2.2 → 0.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,82 @@
1
+ # Directives: the `# bend-lint:` comments that disable or expect findings.
2
+ import Base
3
+ import bend-lint-api@0.3.1.0/linter/api/spec.bend as Lint
4
+
5
+ # A comment: where it is (code points), its line (from 0), whether code comes before it on its line, and its text
6
+ # after the #.
7
+ type Comment is Data:
8
+ Comment{beg: U32, end: U32, line: U32, trailing: Bool, body: String}
9
+
10
+ # A text's comments, in order, and, for each of its lines, whether it holds code.
11
+ type Scanned is Data:
12
+ Scanned{comments: List<&2, Comment>, lines: List<&2, Bool>}
13
+
14
+ # What a directive does: disable findings, or expect them.
15
+ law Action:
16
+ Data
17
+
18
+ # How far a directive reaches: the whole file, from a begin to its end, the next line with code, or its own line.
19
+ law Scope:
20
+ Data
21
+
22
+ # A directive's word: what it does, and how far (`disable-next`).
23
+ type Keyword is Data:
24
+ Keyword{action: Action, scope: Scope}
25
+
26
+ # What a directive names: a rule, and the severity it pins, as written.
27
+ type Target is Data:
28
+ Target{rule: String, pinned: Maybe<&2, String>}
29
+
30
+ # A directive as written, before its severity and rule are checked: its reasons are the texts after each `--`.
31
+ type Draft is Data:
32
+ Draft{keyword: Keyword, target: Target, reasons: List<&2, String>}
33
+
34
+ # A file's findings after its directives: those that stay, then the findings about its directives, and those a
35
+ # directive covers.
36
+ type Suppressed is Data:
37
+ Suppressed{kept: List<&2, Lint.Found>, suppressed: List<&2, Lint.Found>}
38
+
39
+ # A linted file.
40
+ law Linted:
41
+ Data
42
+
43
+ # The file at `path`, whose text is `text`, linted: `known` holds the ids of the rules there are, and `ran` those of
44
+ # the rules that ran on it. A rule turned off did not run, so its directives are never unused.
45
+ law Linted.of:
46
+ for path: String
47
+ for text: String
48
+ for known: List<&2, String>
49
+ for ran: List<&2, String>
50
+ Linted
51
+
52
+ # The comments of `text`, and which of its lines hold code.
53
+ law Scan.of:
54
+ for text: String
55
+ Scanned
56
+
57
+ # How `a` is written in a directive.
58
+ law Action.show:
59
+ for a: Action
60
+ String
61
+
62
+ # How `s` is written in a directive, after the dash.
63
+ law Scope.show:
64
+ for s: Scope
65
+ String
66
+
67
+ # What a comment's text says, if it says bend-lint:: a directive's draft, if it is one.
68
+ law Draft.read:
69
+ for +body: String
70
+ Maybe<&2, Maybe<&2, Draft>>
71
+
72
+ # Whether `text` has a directive's mark, "bend-lint:". Only a 'b' starts a comparison, so it is one pass.
73
+ law has_mark:
74
+ for text: String
75
+ for found: Bool
76
+ Bool
77
+
78
+ # The findings `founds` of the file `linted`, after its directives; a file with none keeps them all.
79
+ law apply:
80
+ for +linted: Linted
81
+ for founds: List<&2, Lint.Found>
82
+ Suppressed