~/bend-docscommunity

src/rules.bend checks

raw source on the hub · import 0x582b4b0fdf3dafdeecc8c3bfddc5e4db/src/rules.bend as Rules

src/rules: every rule, and its group. A rule is a module under rules/<group>/ with check(src) -> List<Finding>, run over each file read once (src/src.bend); a project rule has check(ds) -> List<Finding> and sees every file at once, as the digests of rules/digest.bend. The directory names the group, and codes.bend says it again for the config. Adding one is adding it here and a row in codes.bend. One rule is not listed here, noqa (rules/style/noqa.bend): it reads the other rules' graded findings, so the planner runs it after them (lint/plan.bend). The groups are what a bolt.bend switches at once: correctness (what will fail or blow up), suspicious (what is probably a slip), style, laws, and pedantic (advice that is noisy on idiomatic code: off unless a project asks for it).

35 imports
import Base
import ./finding.bend as F
import ./codes.bend as Codes
import ./src.bend as Src
import ./rules/digest.bend as Digest
import ./config.bend as Config
import ./rules/style/doc.bend as Doc
import ./rules/suspicious/unused.bend as Unused
import ./rules/correctness/hole.bend as Hole
import ./rules/style/space.bend as Space
import ./rules/style/wrap.bend as Wrap
import ./rules/style/param.bend as Param
import ./rules/correctness/pick.bend as Pick
import ./rules/laws/law.bend as Law
import ./rules/suspicious/strict.bend as Strict
import ./rules/suspicious/eager.bend as Eager
import ./rules/pedantic/tail.bend as Tail
import ./rules/suspicious/concat.bend as Concat
import ./rules/suspicious/index.bend as Index
import ./rules/suspicious/table.bend as Table
import ./rules/suspicious/hoist.bend as Hoist
import ./rules/suspicious/ring.bend as Ring
import ./rules/suspicious/rewalk.bend as Rewalk
import ./rules/suspicious/unit.bend as Unit
import ./rules/correctness/put.bend as Put
import ./rules/correctness/escape.bend as Escape
import ./rules/correctness/strings.bend as Strings
import ./rules/correctness/chars.bend as Chars
import ./rules/correctness/twice.bend as Twice
import ./rules/correctness/arms.bend as Arms
import ./rules/correctness/foreign.bend as Foreign
import ./rules/suspicious/fuel.bend as Fuel
import ./rules/laws/closed.bend as Closed
import ./rules/laws/trace.bend as Trace
import ./rules/laws/unsafe.bend as Unsafe

Definitions

def on.path source · line 50 · raw

@ss:0x582b4b0fdf3dafdeecc8c3bfddc5e4db/src/src.Src -> String

the file a Src was read from

def on.at source · line 56 · raw

@+path:String -> @fs:List<&2, 0x582b4b0fdf3dafdeecc8c3bfddc5e4db/src/finding.Finding> -> List<&2, 0x582b4b0fdf3dafdeecc8c3bfddc5e4db/src/finding.Finding>

findings put at a path: a per-file rule reports on its own file, so this keeps what each rule gave and makes it hold by construction

def on.rules source · line 64 · raw

@+ss:0x582b4b0fdf3dafdeecc8c3bfddc5e4db/src/src.Src -> List<&2, 0x582b4b0fdf3dafdeecc8c3bfddc5e4db/src/finding.Finding>

every rule's findings on a file read once, as each rule gives them

def on source · line 94 · raw

@+ss:0x582b4b0fdf3dafdeecc8c3bfddc5e4db/src/src.Src -> List<&2, 0x582b4b0fdf3dafdeecc8c3bfddc5e4db/src/finding.Finding>

every rule's findings on a file read once, each at that file

def all source · line 98 · raw

@+path:String -> @+text:String -> List<&2, 0x582b4b0fdf3dafdeecc8c3bfddc5e4db/src/finding.Finding>

every rule's findings on a file

def project source · line 104 · raw

@srcs:List<&2, 0x582b4b0fdf3dafdeecc8c3bfddc5e4db/src/src.Src> -> @whole:Bool -> @spec:Maybe<&2, String> -> List<&2, 0x582b4b0fdf3dafdeecc8c3bfddc5e4db/src/finding.Finding>

every project rule's findings on the files and SPEC.md's text (None when there is none): each file is read down to its digest once (rules/digest.bend), and the rules run over those

def group source · line 109 · raw

@+rule:String -> String

the group a rule is in; an unknown slug grades with correctness

def graded source · line 115 · raw

@+cfg:0x582b4b0fdf3dafdeecc8c3bfddc5e4db/src/config.Config -> @fs:List<&2, 0x582b4b0fdf3dafdeecc8c3bfddc5e4db/src/finding.Finding> -> List<&2, 0x582b4b0fdf3dafdeecc8c3bfddc5e4db/src/finding.Graded>

the findings at the levels a config gives their rules; the ones set off are dropped