~/bend-docscommunity

src/fmt/plan.bend checks

raw source on the hub · import bolt@1.56.0.0/src/fmt/plan.bend as Plan

src/fmt/plan: what bolt fmt does, decided from a World of answers (src/lint/world.bend). Pure: it reads no file and writes none. The files are the ones bolt would lint, the files named or every .bend file under the working directory (src/lint/plan.bend's inputs; a bolt.bend is not among them), and the World is filled by the same questions the lint asks. For each file the World read, formatting (src/fmt.bend) either leaves its text as it is or gives another; a file that changes is an edit, its path and its new text. bolt fmt plans every edit and prints formatted <path> for each; bolt fmt --check plans none, prints would format <path> for each, and exits 1 when there is one. A path the World could not read is cannot read <path> and exit 1 either way. With nothing to say the one line is clean.

4 imports
import Base
import ../fmt.bend as Fmt
import ../lint/world.bend as W
import ../lint/plan.bend as Lint

Types

type Edit source · line 19 · raw

Data

a file to write: its path and its new text

type Plan source · line 23 · raw

Data

what the run does: the files to write, the lines to print, the exit status

Definitions

def edit source · line 27 · raw

@same:Bool -> @path:String -> @text:String -> @more:List<&2, Edit> -> List<&2, Edit>

a file's edit when formatting changes its text, before the rest

def edits.one source · line 35 · raw

@path:String -> @mm:Maybe<&2, String> -> @more:List<&2, Edit> -> List<&2, Edit>

one file's edit, if formatting changes it; a path with no text has none

def edits source · line 44 · raw

@gs:List<&2, 0x9442a37d1ea1cd8e94edbbcf49ca618b/src/lint/plan.Got> -> List<&2, Edit>

every file formatting changes, in order, each with its new text

def unread source · line 52 · raw

@gs:List<&2, 0x9442a37d1ea1cd8e94edbbcf49ca618b/src/lint/plan.Got> -> List<&2, String>

the paths the World could not read, in order

def said source · line 62 · raw

@+word:String -> @ps:List<&2, String> -> List<&2, String>

a line for each path, the word before it

def paths source · line 70 · raw

@es:List<&2, Edit> -> List<&2, String>

the paths of the edits, in order

def word source · line 78 · raw

@check:Bool -> String

what is said of the files that change

def lines.or source · line 86 · raw

@ls:List<&2, String> -> List<&2, String>

the lines, or clean when there are none

def some source · line 94 · raw

@-A:Data -> @xs:List<&2, A> -> U32

1 when the list holds anything

def exit source · line 103 · raw

@check:Bool -> @+es:List<&2, Edit> -> @bad:List<&2, String> -> U32

the exit status: 1 when a path could not be read, and, when only checking, when a file would change

def written source · line 111 · raw

@check:Bool -> @es:List<&2, Edit> -> List<&2, Edit>

the edits a run writes: none when it only checks

def plan.at source · line 119 · raw

@+check:Bool -> @+gs:List<&2, 0x9442a37d1ea1cd8e94edbbcf49ca618b/src/lint/plan.Got> -> Plan

the plan over the files the World answered for

def plan source · line 127 · raw

@check:Bool -> @+world:0x9442a37d1ea1cd8e94edbbcf49ca618b/src/lint/world.World -> Plan

what bolt fmt does in a World: check says whether it only checks