~/bend-docscommunity

src/lint.bend relies on unsafe/foreign

raw source on the hub · import bolt@1.23.0.0/src/lint.bend as Lint

src/lint: the interpreter for bolt itself. It starts from a World holding the paths it was given and the working directory (src/lint/world.bend), then loops: it asks the planner (src/lint/plan.bend) what is still open, answers each question by IO, a directory listed through src/walk/ and a file read through src/lsp/files/ (a path src/walk/ calls a directory is answered as one, not read), and adds the answers to the World, until nothing is left to ask. Then it prints the planner's lines and exits with its status. It decides nothing: which files are linted, which bolt.bend grades each finding, and what is printed are the planner's. That it answers and prints faithfully is trusted, not proved: it is kept small enough to review line by line, as is every interpreter here (src/check.bend, src/lsp/server.bend).

7 imports
import Base
import ./lint/world.bend as W
import ./lint/plan.bend as Plan
import ./lsp/files/disk.bend as Disk
import ./walk/disk.bend as WalkDisk
import ./status.bend as Status
import ./lazy/lazy.bend as Lazy

Definitions

def read.answer source · line 22 · raw

@mm:Maybe<&2, String> -> 0x1617abc30c012397a51f2088f60b6621/src/lint/world.Answer

a file's text as an answer

def text.answer source · line 30 · raw

@dir:Bool -> @path:String -> IO(0x1617abc30c012397a51f2088f60b6621/src/lint/world.Answer)

a path's text as an answer: a directory has none, and a file is read

def answer source · line 40 · raw

@ask:0x1617abc30c012397a51f2088f60b6621/src/lint/world.Ask -> IO(0x1617abc30c012397a51f2088f60b6621/src/lint/world.Answer)

one question, answered

def answer.all source · line 52 · raw

@asks:List<&2, 0x1617abc30c012397a51f2088f60b6621/src/lint/world.Ask> -> IO(List<&2, 0x1617abc30c012397a51f2088f60b6621/src/lint/world.Reply>)

every question, answered, in order

def more source · line 63 · raw

@world:0x1617abc30c012397a51f2088f60b6621/src/lint/world.World -> @rs:List<&2, 0x1617abc30c012397a51f2088f60b6621/src/lint/world.Reply> -> 0x1617abc30c012397a51f2088f60b6621/src/lint/world.World

the World with more answers in it

def exec source · line 78 · raw

@pl:0x1617abc30c012397a51f2088f60b6621/src/lint/plan.Plan -> IO(Unit)

a plan, carried out: its lines printed, then its exit status

def loop.step source · line 86 · raw

@asks:List<&2, 0x1617abc30c012397a51f2088f60b6621/src/lint/world.Ask> -> @+world:0x1617abc30c012397a51f2088f60b6621/src/lint/world.World -> @go:(@_:0x1617abc30c012397a51f2088f60b6621/src/lint/world.World -> IO(Unit)) -> IO(Unit)

the planner's questions answered and the loop gone round again, or, when there are none, its plan carried out

def loop source · line 98 · raw

@fuel:Nat -> @+world:0x1617abc30c012397a51f2088f60b6621/src/lint/world.World -> IO(Unit)

the loop, under fuel: the walk's bound, plus a round for the texts and one to plan. Every round adds at least one answer, since the planner never asks what the World answers already.

def run.from source · line 107 · raw

@paths:List<&2, String> -> @+cwd:String -> IO(Unit)

the lint from a working directory; none that can be named is fatal, as no relative path could be resolved against it

def run source · line 112 · raw

@paths:List<&2, String> -> IO(Unit)

the linter, over the files given, or the tree below