src/lint.bend relies on unsafe/foreign
raw source on the hub · import bolt@1.20.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 BOLT-TRUST-9.
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 21 · raw
@mm:Maybe<&2, String> -> 0x6da2affe27298531acb4879fbe88e96d/src/lint/world.Answer
a file's text as an answer
def text.answer source · line 29 · raw
@dir:Bool -> @path:String -> IO(0x6da2affe27298531acb4879fbe88e96d/src/lint/world.Answer)
a path's text as an answer: a directory has none, and a file is read
def answer source · line 39 · raw
@ask:0x6da2affe27298531acb4879fbe88e96d/src/lint/world.Ask -> IO(0x6da2affe27298531acb4879fbe88e96d/src/lint/world.Answer)
one question, answered
def answer.all source · line 51 · raw
@asks:List<&2, 0x6da2affe27298531acb4879fbe88e96d/src/lint/world.Ask> -> IO(List<&2, 0x6da2affe27298531acb4879fbe88e96d/src/lint/world.Reply>)
every question, answered, in order
def more source · line 62 · raw
@world:0x6da2affe27298531acb4879fbe88e96d/src/lint/world.World -> @rs:List<&2, 0x6da2affe27298531acb4879fbe88e96d/src/lint/world.Reply> -> 0x6da2affe27298531acb4879fbe88e96d/src/lint/world.World
the World with more answers in it
def print_all source · line 67 · raw
@lines:List<&2, String> -> IO(Unit)
each line printed
def exec source · line 77 · raw
@pl:0x6da2affe27298531acb4879fbe88e96d/src/lint/plan.Plan -> IO(Unit)
a plan, carried out: its lines printed, then its exit status
def loop.step source · line 85 · raw
@asks:List<&2, 0x6da2affe27298531acb4879fbe88e96d/src/lint/world.Ask> -> @+world:0x6da2affe27298531acb4879fbe88e96d/src/lint/world.World -> @go:(@_:0x6da2affe27298531acb4879fbe88e96d/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 97 · raw
@fuel:Nat -> @+world:0x6da2affe27298531acb4879fbe88e96d/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 106 · 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 111 · raw
@paths:List<&2, String> -> IO(Unit)
the linter, over the files given, or the tree below