lib/linter/directives/spec.bend open laws/TODOs
raw source on the hub · import bend-lint-rules@0.3.8.0/lib/linter/directives/spec.bend as Spec
Directives: the # bend-lint: comments that disable or expect findings.
2 imports
import Base import bend-lint-api@0.3.8.0/linter/api/spec.bend as Lint
Laws
law Action provedin layout/directive_order.bendsource · line 15 · raw
Data
What a directive does: disable findings, or expect them.
law Scope provedin layout/directive_order.bendsource · line 19 · raw
Data
How far a directive reaches: the whole file, from a begin to its end, the next line with code, or its own line.
law Linted provedin layout/directive_order.bendsource · line 40 · raw
Data
A linted file.
law Linted.of provedin layout/directive_order.bendsource · line 45 · raw
@path:String -> @text:String -> @known:List<&2, String> -> @ran:List<&2, String> -> Linted
The file at path, whose text is text, linted: known holds the ids of the rules there are, and ran those of
the rules that ran on it. A rule turned off did not run, so its directives are never unused.
law Scan.of provedin layout/directive_order.bendsource · line 53 · raw
@text:String -> Scanned
The comments of text, and which of its lines hold code.
law Action.show provedin layout/directive_order.bendsource · line 58 · raw
@a:Action -> String
How a is written in a directive.
law Scope.show provedin layout/directive_order.bendsource · line 63 · raw
@s:Scope -> String
How s is written in a directive, after the dash.
law Draft.read provedin layout/directive_order.bendsource · line 68 · raw
@+body:String -> Maybe<&2, Maybe<&2, Draft>>
What a comment's text says, if it says bend-lint:: a directive's draft, if it is one.
law has_mark provedin layout/directive_order.bendsource · line 73 · raw
@text:String -> @found:Bool -> Bool
Whether text has a directive's mark, "bend-lint:". Only a 'b' starts a comparison, so it is one pass.
law apply provedin layout/directive_order.bendsource · line 79 · raw
@+linted:Linted -> @founds:List<&2, 0x534e77ab9e7d8d3c817c84cab8139f38/linter/api/spec.Found> -> Suppressed
The findings founds of the file linted, after its directives; a file with none keeps them all.
Types
type Comment source · line 7 · raw
Data
A comment: where it is (code points), its line (from 0), whether code comes before it on its line, and its text after the #.
Comment@beg:U32 -> @end:U32 -> @line:U32 -> @trailing:Bool -> @body:String -> Comment
type Scanned source · line 11 · raw
Data
A text's comments, in order, and, for each of its lines, whether it holds code.
Scanned@comments:List<&2, Comment> -> @lines:List<&2, Bool> -> Scanned
type Keyword source · line 23 · raw
Data
A directive's word: what it does, and how far (disable-next).
Keyword@action:Action -> @scope:Scope -> Keyword
type Target source · line 27 · raw
Data
What a directive names: a rule, and the severity it pins, as written.
Target@rule:String -> @pinned:Maybe<&2, String> -> Target
type Draft source · line 31 · raw
Data
A directive as written, before its severity and rule are checked: its reasons are the texts after each --.
Draft@keyword:Keyword -> @target:Target -> @reasons:List<&2, String> -> Draft
type Suppressed source · line 36 · raw
Data
A file's findings after its directives: those that stay, then the findings about its directives, and those a directive covers.
Suppressed@kept:List<&2, 0x534e77ab9e7d8d3c817c84cab8139f38/linter/api/spec.Found> -> @suppressed:List<&2, 0x534e77ab9e7d8d3c817c84cab8139f38/linter/api/spec.Found> -> Suppressed