src/lint.bend relies on unsafe/foreign
raw source on the hub · import bolt@1.57.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
@m:Maybe<&2, String> -> 0xf70fc6a217b89edfba89174d2aa39455/src/lint/world.Answer
a file's text as an answer
def text.answer source · line 30 · raw
@dir:Bool -> @path:String -> IO(0xf70fc6a217b89edfba89174d2aa39455/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:0xf70fc6a217b89edfba89174d2aa39455/src/lint/world.Ask -> IO(0xf70fc6a217b89edfba89174d2aa39455/src/lint/world.Answer)
one question, answered
def answer.all source · line 52 · raw
@asks:List<&2, 0xf70fc6a217b89edfba89174d2aa39455/src/lint/world.Ask> -> IO(List<&2, 0xf70fc6a217b89edfba89174d2aa39455/src/lint/world.Reply>)
every question, answered, in order
def more source · line 63 · raw
@world:0xf70fc6a217b89edfba89174d2aa39455/src/lint/world.World -> @rs:List<&2, 0xf70fc6a217b89edfba89174d2aa39455/src/lint/world.Reply> -> 0xf70fc6a217b89edfba89174d2aa39455/src/lint/world.World
the World with more answers in it
def print_all source · line 68 · raw
@lines:List<&2, String> -> IO(Unit)
each line printed
def exec source · line 78 · raw
@pl:0xf70fc6a217b89edfba89174d2aa39455/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, 0xf70fc6a217b89edfba89174d2aa39455/src/lint/world.Ask> -> @+world:0xf70fc6a217b89edfba89174d2aa39455/src/lint/world.World -> @go:(@_:0xf70fc6a217b89edfba89174d2aa39455/src/lint/world.World -> IO(0xf70fc6a217b89edfba89174d2aa39455/src/lint/world.World)) -> IO(0xf70fc6a217b89edfba89174d2aa39455/src/lint/world.World)
the planner's questions answered and the loop gone round again, or, when there are none, the World as it stands: every answer the run needs
def loop source · line 98 · raw
@fuel:Nat -> @+world:0xf70fc6a217b89edfba89174d2aa39455/src/lint/world.World -> IO(0xf70fc6a217b89edfba89174d2aa39455/src/lint/world.World)
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 fill.from source · line 107 · raw
@paths:List<&2, String> -> @+cwd:String -> IO(0xf70fc6a217b89edfba89174d2aa39455/src/lint/world.World)
the World filled from a working directory; none that can be named is fatal, as no relative path could be resolved against it
def fill source · line 114 · raw
@paths:List<&2, String> -> IO(0xf70fc6a217b89edfba89174d2aa39455/src/lint/world.World)
the World of a run over the files given, or the tree below, with every
answer the planner asks for: what the lint plans from, and bolt fmt
(src/fmt/run.bend)
def run source · line 120 · raw
@paths:List<&2, String> -> IO(Unit)
the linter, over the files given, or the tree below