bend-lint-rules Releases (5): 0.2.2.0 0xa8e971a3ca0e87fbac9a0efbc1306f8d invalid https://jend.leeeet.dev/files.txt?path=bend-lint-rules@0.2.2.0 expected a package named bend-lint-api@0.2.2.0 on https://hub.bend-lang.com At https://jend.leeeet.dev/read.txt?path=bend-lint-rules@0.2.2.0/language/decreasing_call.bend&start_line=11, https://jend.leeeet.dev/read.txt?path=bend-lint-rules@0.2.2.0/language/forward_reference.bend&start_line=9, https://jend.leeeet.dev/read.txt?path=bend-lint-rules@0.2.2.0/language/reused_binder.bend&start_line=11, https://jend.leeeet.dev/read.txt?path=bend-lint-rules@0.2.2.0/language/unneeded_plus.bend&start_line=9, https://jend.leeeet.dev/read.txt?path=bend-lint-rules@0.2.2.0/layout/canon_import_path.bend&start_line=7, https://jend.leeeet.dev/read.txt?path=bend-lint-rules@0.2.2.0/layout/case.bend&start_line=21, https://jend.leeeet.dev/read.txt?path=bend-lint-rules@0.2.2.0/layout/format.bend&start_line=16, https://jend.leeeet.dev/read.txt?path=bend-lint-rules@0.2.2.0/layout/imports.bend&start_line=8, https://jend.leeeet.dev/read.txt?path=bend-lint-rules@0.2.2.0/lib/linter/directives.bend&start_line=2, https://jend.leeeet.dev/read.txt?path=bend-lint-rules@0.2.2.0/lib/text/main.bend&start_line=4, https://jend.leeeet.dev/read.txt?path=bend-lint-rules@0.2.2.0/no_unused/imports.bend&start_line=6, https://jend.leeeet.dev/read.txt?path=bend-lint-rules@0.2.2.0/performance/append_in_loop.bend&start_line=9, https://jend.leeeet.dev/read.txt?path=bend-lint-rules@0.2.2.0/performance/bang_after_fork.bend&start_line=15, https://jend.leeeet.dev/read.txt?path=bend-lint-rules@0.2.2.0/performance/dead_accumulator.bend&start_line=13, https://jend.leeeet.dev/read.txt?path=bend-lint-rules@0.2.2.0/performance/deep_call_in_fork.bend&start_line=14, https://jend.leeeet.dev/read.txt?path=bend-lint-rules@0.2.2.0/performance/drop_in_bang.bend&start_line=10, https://jend.leeeet.dev/read.txt?path=bend-lint-rules@0.2.2.0/performance/eager_branch.bend&start_line=17, https://jend.leeeet.dev/read.txt?path=bend-lint-rules@0.2.2.0/performance/gpu_fit.bend&start_line=22, https://jend.leeeet.dev/read.txt?path=bend-lint-rules@0.2.2.0/performance/list_index_loop.bend&start_line=12, https://jend.leeeet.dev/read.txt?path=bend-lint-rules@0.2.2.0/performance/loop_invariant_call.bend&start_line=11, https://jend.leeeet.dev/read.txt?path=bend-lint-rules@0.2.2.0/performance/missed_fork.bend&start_line=16, https://jend.leeeet.dev/read.txt?path=bend-lint-rules@0.2.2.0/performance/repeated_call.bend&start_line=17, https://jend.leeeet.dev/read.txt?path=bend-lint-rules@0.2.2.0/performance/template_value_field.bend&start_line=15, https://jend.leeeet.dev/read.txt?path=bend-lint-rules@0.2.2.0/performance/unused_result.bend&start_line=11. Files that do not load: language/decreasing_call.bend, language/forward_reference.bend, language/reused_binder.bend, language/unneeded_plus.bend, layout/canon_import_path.bend and 21 more. 0.2.1.0 0xe3a0709d4d0e98d88d93b335b279fce6 invalid https://jend.leeeet.dev/files.txt?path=bend-lint-rules@0.2.1.0 expected a package named bend-lint-api@0.2.1.0 on https://hub.bend-lang.com At https://jend.leeeet.dev/read.txt?path=bend-lint-rules@0.2.1.0/language/decreasing_call.bend&start_line=11, https://jend.leeeet.dev/read.txt?path=bend-lint-rules@0.2.1.0/language/forward_reference.bend&start_line=9, https://jend.leeeet.dev/read.txt?path=bend-lint-rules@0.2.1.0/language/reused_binder.bend&start_line=11, https://jend.leeeet.dev/read.txt?path=bend-lint-rules@0.2.1.0/language/unneeded_plus.bend&start_line=9, https://jend.leeeet.dev/read.txt?path=bend-lint-rules@0.2.1.0/layout/canon_import_path.bend&start_line=7, https://jend.leeeet.dev/read.txt?path=bend-lint-rules@0.2.1.0/layout/case.bend&start_line=21, https://jend.leeeet.dev/read.txt?path=bend-lint-rules@0.2.1.0/layout/format.bend&start_line=16, https://jend.leeeet.dev/read.txt?path=bend-lint-rules@0.2.1.0/layout/imports.bend&start_line=8, https://jend.leeeet.dev/read.txt?path=bend-lint-rules@0.2.1.0/lib/linter/directives.bend&start_line=2, https://jend.leeeet.dev/read.txt?path=bend-lint-rules@0.2.1.0/lib/text/main.bend&start_line=4, https://jend.leeeet.dev/read.txt?path=bend-lint-rules@0.2.1.0/no_unused/imports.bend&start_line=6, https://jend.leeeet.dev/read.txt?path=bend-lint-rules@0.2.1.0/performance/append_in_loop.bend&start_line=9, https://jend.leeeet.dev/read.txt?path=bend-lint-rules@0.2.1.0/performance/bang_after_fork.bend&start_line=15, https://jend.leeeet.dev/read.txt?path=bend-lint-rules@0.2.1.0/performance/dead_accumulator.bend&start_line=13, https://jend.leeeet.dev/read.txt?path=bend-lint-rules@0.2.1.0/performance/deep_call_in_fork.bend&start_line=14, https://jend.leeeet.dev/read.txt?path=bend-lint-rules@0.2.1.0/performance/drop_in_bang.bend&start_line=10, https://jend.leeeet.dev/read.txt?path=bend-lint-rules@0.2.1.0/performance/eager_branch.bend&start_line=17, https://jend.leeeet.dev/read.txt?path=bend-lint-rules@0.2.1.0/performance/gpu_fit.bend&start_line=22, https://jend.leeeet.dev/read.txt?path=bend-lint-rules@0.2.1.0/performance/list_index_loop.bend&start_line=12, https://jend.leeeet.dev/read.txt?path=bend-lint-rules@0.2.1.0/performance/loop_invariant_call.bend&start_line=11, https://jend.leeeet.dev/read.txt?path=bend-lint-rules@0.2.1.0/performance/missed_fork.bend&start_line=16, https://jend.leeeet.dev/read.txt?path=bend-lint-rules@0.2.1.0/performance/repeated_call.bend&start_line=17, https://jend.leeeet.dev/read.txt?path=bend-lint-rules@0.2.1.0/performance/template_value_field.bend&start_line=15, https://jend.leeeet.dev/read.txt?path=bend-lint-rules@0.2.1.0/performance/unused_result.bend&start_line=11. Files that do not load: language/decreasing_call.bend, language/forward_reference.bend, language/reused_binder.bend, language/unneeded_plus.bend, layout/canon_import_path.bend and 21 more. 0.2.0.0 0x29a8624e9659aaa2c25b485f2135a43a indexed https://jend.leeeet.dev/files.txt?path=bend-lint-rules@0.2.0.0 0.1.1.0 0xea59fa0bb59ac9b4259dbd0992004d9e unindexed https://jend.leeeet.dev/files.txt?path=bend-lint-rules@0.1.1.0 0.1.0.0 0x5f2737ee4ecbd87b3f07a0b779aafea9 unindexed https://jend.leeeet.dev/files.txt?path=bend-lint-rules@0.1.0.0 Definitions (801, 1 to 100 shown): DecreasingCall.Param (https://jend.leeeet.dev/definition.txt?path=bend-lint-rules@0.2.0.0/language/decreasing_call.bend&name=Param) # A parameter: its binder, whether it is erased (it does not count), and its name. type Param is Data: Param{binder: U32, erased: Bool, name: String} DecreasingCall.Smaller (https://jend.leeeet.dev/definition.txt?path=bend-lint-rules@0.2.0.0/language/decreasing_call.bend&name=Smaller) # A binder known smaller than the parameter or field `root`: a field a match took apart from it. type Smaller is Data: Smaller{root: U32, field: U32} DecreasingCall.Verdict (https://jend.leeeet.dev/definition.txt?path=bend-lint-rules@0.2.0.0/language/decreasing_call.bend&name=Verdict) # What the arguments of a call say: it decreases; it does not, at the argument numbered `at` (from 0) # for the parameter `param`, or with every argument unchanged; or the rule cannot tell. type Verdict is Data: Decreases{} Fails{at: Nat, param: String} Unchanged{} Unknown{} DecreasingCall.Loop (https://jend.leeeet.dev/definition.txt?path=bend-lint-rules@0.2.0.0/language/decreasing_call.bend&name=Loop) # What judging a definition's calls of itself reads: its parameters, the binders its lets bind (an argument that is one # stands for its value, which the rule does not follow), and the file's text. type Loop is Data: Loop{params: List<&2, Param>, lets: List<&2, U32>, text: String} DecreasingCall.Param.is_erased (https://jend.leeeet.dev/definition.txt?path=bend-lint-rules@0.2.0.0/language/decreasing_call.bend&name=Param.is_erased) # Functions # ========= def Param.is_erased(bare: Bool, quantity: Lint.Quantity) -> Bool: DecreasingCall.Param.all (https://jend.leeeet.dev/definition.txt?path=bend-lint-rules@0.2.0.0/language/decreasing_call.bend&name=Param.all) def Param.all(nodes: List<&2, Lint.Node>, out: List<&2, Param>) -> List<&2, Param>: DecreasingCall.roots (https://jend.leeeet.dev/definition.txt?path=bend-lint-rules@0.2.0.0/language/decreasing_call.bend&name=roots) # The roots that `binder` is smaller than, with `binder` itself. def roots(smaller: List<&2, Smaller>, +binder: U32, out: List<&2, U32>) -> List<&2, U32>: DecreasingCall.pairs.of (https://jend.leeeet.dev/definition.txt?path=bend-lint-rules@0.2.0.0/language/decreasing_call.bend&name=pairs.of) def pairs.of(+r: U32, fs: List<&2, U32>, out: List<&2, Smaller>) -> List<&2, Smaller>: DecreasingCall.pairs (https://jend.leeeet.dev/definition.txt?path=bend-lint-rules@0.2.0.0/language/decreasing_call.bend&name=pairs) def pairs(rs: List<&2, U32>, +fs: List<&2, U32>, out: List<&2, Smaller>) -> List<&2, Smaller>: DecreasingCall.taken (https://jend.leeeet.dev/definition.txt?path=bend-lint-rules@0.2.0.0/language/decreasing_call.bend&name=taken) # What a case's patterns take apart: each pattern, a constructor, makes its variables smaller than its # scrutinee, and than all that scrutinee is smaller than. def taken( scrutinees: List<&2, Lint.Node>, patterns: List<&2, Lint.Node>, +smaller: List<&2, Smaller> ) -> List<&2, Smaller>: DecreasingCall.known.at (https://jend.leeeet.dev/definition.txt?path=bend-lint-rules@0.2.0.0/language/decreasing_call.bend&name=known.at) # What a case below `parent` takes apart, if `node` is one and `parent` its match. def known.at( parent: Maybe<&2, Lint.Node>, node: Lint.Node, smaller: List<&2, Smaller> ) -> List<&2, Smaller>: DecreasingCall.known (https://jend.leeeet.dev/definition.txt?path=bend-lint-rules@0.2.0.0/language/decreasing_call.bend&name=known) # What the cases above a call (`chain`, outermost first; `parent` is the node above the first) take apart. def known( chain: List<&2, Lint.Above>, parent: Maybe<&2, Lint.Node>, smaller: List<&2, Smaller> ) -> List<&2, Smaller>: DecreasingCall.is_smaller (https://jend.leeeet.dev/definition.txt?path=bend-lint-rules@0.2.0.0/language/decreasing_call.bend&name=is_smaller) def is_smaller(smaller: List<&2, Smaller>, hit: Bool, +root: U32, +field: U32) -> Bool: DecreasingCall.step (https://jend.leeeet.dev/definition.txt?path=bend-lint-rules@0.2.0.0/language/decreasing_call.bend&name=step) # What one argument, a variable, says: none to read on (it is the parameter, unchanged), else the # verdict: it decreases (a field a match took apart), the rule cannot tell (a let's name), or it fails. def step(same: Bool, smaller: Bool, local: Bool, at: Nat, param: String) -> Maybe<&2, Verdict>: DecreasingCall.verdict (https://jend.leeeet.dev/definition.txt?path=bend-lint-rules@0.2.0.0/language/decreasing_call.bend&name=verdict) # The verdict on a call's arguments against the parameters, from the one numbered `at`. def verdict( params: List<&2, Param>, args: List<&2, Lint.Node>, told: Maybe<&2, Verdict>, +smaller: List<&2, Smaller>, +lets: List<&2, U32>, +at: Nat ) -> Verdict: DecreasingCall.ordinal (https://jend.leeeet.dev/definition.txt?path=bend-lint-rules@0.2.0.0/language/decreasing_call.bend&name=ordinal) def ordinal(n: Nat) -> String: DecreasingCall.message (https://jend.leeeet.dev/definition.txt?path=bend-lint-rules@0.2.0.0/language/decreasing_call.bend&name=message) def message(verdict: Verdict, loop: String, source: String, args: List<&2, Lint.Node>) -> String: DecreasingCall.finding (https://jend.leeeet.dev/definition.txt?path=bend-lint-rules@0.2.0.0/language/decreasing_call.bend&name=finding) def finding( verdict: Verdict, span: Maybe<&2, Lint.Span>, loop: String, source: String, args: List<&2, Lint.Node> ) -> List<&2, Lint.Finding>: DecreasingCall.call (https://jend.leeeet.dev/definition.txt?path=bend-lint-rules@0.2.0.0/language/decreasing_call.bend&name=call) # The findings about a call of its definition to itself, below `path`. def call(+loop: Loop, path: List<&2, Lint.Above>, node: Lint.Node) -> List<&2, Lint.Finding>: DecreasingCall.calls (https://jend.leeeet.dev/definition.txt?path=bend-lint-rules@0.2.0.0/language/decreasing_call.bend&name=calls) # The same, if `node` is a live call of its definition to itself (`recursive`). def calls( recursive: Bool, loop: Loop, path: List<&2, Lint.Above>, node: Lint.Node ) -> List<&2, Lint.Finding>: DecreasingCall.visit (https://jend.leeeet.dev/definition.txt?path=bend-lint-rules@0.2.0.0/language/decreasing_call.bend&name=visit) def visit(+loop: Loop, +path: List<&2, Lint.Above>, +node: Lint.Node) -> List<&2, Lint.Finding>: DecreasingCall.let (https://jend.leeeet.dev/definition.txt?path=bend-lint-rules@0.2.0.0/language/decreasing_call.bend&name=let) # The binders the lets of a definition bind, below `path`. def let(+u: Unit, +path: List<&2, Lint.Above>, +node: Lint.Node) -> List<&2, U32>: DecreasingCall.defs (https://jend.leeeet.dev/definition.txt?path=bend-lint-rules@0.2.0.0/language/decreasing_call.bend&name=defs) # The findings in each definition among `nodes`, onto `out`. An @unsafe definition (`def f?`) may call itself freely. def defs( nodes: List<&2, Lint.Node>, +text: String, out: List<&2, Lint.Finding> ) -> List<&2, Lint.Finding>: DecreasingCall.run (https://jend.leeeet.dev/definition.txt?path=bend-lint-rules@0.2.0.0/language/decreasing_call.bend&name=run) def run(+here: Lint.Here) -> Lint.Ask(List<&2, Lint.Finding>): DecreasingCall.rule (https://jend.leeeet.dev/definition.txt?path=bend-lint-rules@0.2.0.0/language/decreasing_call.bend&name=rule) def rule() -> Lint.Rule: ForwardReference.Place (https://jend.leeeet.dev/definition.txt?path=bend-lint-rules@0.2.0.0/language/forward_reference.bend&name=Place) # A definition of the file: where it is among the file's nodes, and its name as written. type Place is Data: Place{at: U32, name: String} ForwardReference.User (https://jend.leeeet.dev/definition.txt?path=bend-lint-rules@0.2.0.0/language/forward_reference.bend&name=User) # What judging the uses in one definition reads: where each definition of the file is, by the name the check gives it; # and where the definition is, with its name. type User is Data: User{places: Map<&2, Maybe<&2, Place>>, at: U32, name: String} ForwardReference.message (https://jend.leeeet.dev/definition.txt?path=bend-lint-rules@0.2.0.0/language/forward_reference.bend&name=message) # Functions # ========= def message(+used: String, +user: String) -> String: ForwardReference.places (https://jend.leeeet.dev/definition.txt?path=bend-lint-rules@0.2.0.0/language/forward_reference.bend&name=places) # Where each definition among `nodes`, the file's, is, from `at`, onto `out`. def places( nodes: List<&2, Lint.Node>, +at: U32, out: Map<&2, Maybe<&2, Place>> ) -> Map<&2, Maybe<&2, Place>>: ForwardReference.below (https://jend.leeeet.dev/definition.txt?path=bend-lint-rules@0.2.0.0/language/forward_reference.bend&name=below) # The finding about a use of `used` from `user`, if `used` is below it. Whether the use is live is asked only then: # `&&` computes both sides. def below( hit: Bool, path: List<&2, Lint.Above>, used: String, user: String, span: Maybe<&2, Lint.Span> ) -> List<&2, Lint.Finding>: ForwardReference.judged (https://jend.leeeet.dev/definition.txt?path=bend-lint-rules@0.2.0.0/language/forward_reference.bend&name=judged) def judged( path: List<&2, Lint.Above>, place: Maybe<&2, Place>, user: User, span: Maybe<&2, Lint.Span> ) -> List<&2, Lint.Finding>: ForwardReference.User.places (https://jend.leeeet.dev/definition.txt?path=bend-lint-rules@0.2.0.0/language/forward_reference.bend&name=User.places) def User.places(user: User) -> Map<&2, Maybe<&2, Place>>: ForwardReference.use (https://jend.leeeet.dev/definition.txt?path=bend-lint-rules@0.2.0.0/language/forward_reference.bend&name=use) def use(+user: User, +path: List<&2, Lint.Above>, +node: Lint.Node) -> List<&2, Lint.Finding>: ForwardReference.users (https://jend.leeeet.dev/definition.txt?path=bend-lint-rules@0.2.0.0/language/forward_reference.bend&name=users) # The findings in the definitions among `nodes`, from `at`, onto `out`. An @unsafe definition may use any. def users( nodes: List<&2, Lint.Node>, +places: Map<&2, Maybe<&2, Place>>, +at: U32, out: List<&2, Lint.Finding> ) -> List<&2, Lint.Finding>: ForwardReference.run (https://jend.leeeet.dev/definition.txt?path=bend-lint-rules@0.2.0.0/language/forward_reference.bend&name=run) def run(+here: Lint.Here) -> Lint.Ask(List<&2, Lint.Finding>): ForwardReference.rule (https://jend.leeeet.dev/definition.txt?path=bend-lint-rules@0.2.0.0/language/forward_reference.bend&name=rule) def rule() -> Lint.Rule: ReusedBinder.Once (https://jend.leeeet.dev/definition.txt?path=bend-lint-rules@0.2.0.0/language/reused_binder.bend&name=Once) # A binder that can be used once: its number, and its name. type Once is Data: Once{binder: U32, name: String} ReusedBinder.Seen (https://jend.leeeet.dev/definition.txt?path=bend-lint-rules@0.2.0.0/language/reused_binder.bend&name=Seen) # The live uses of one binder among some nodes: the first, and the first that an earlier one on its path precedes, if # any. Two uses are on one path unless a match parts them: its cases, and its scrutinees, are each a path of their own. type Seen is Data: Seen{first: Maybe<&2, Lint.Span>, second: Maybe<&2, Lint.Span>} ReusedBinder.message (https://jend.leeeet.dev/definition.txt?path=bend-lint-rules@0.2.0.0/language/reused_binder.bend&name=message) # Functions # ========= def message(+name: String) -> String: ReusedBinder.Once.of (https://jend.leeeet.dev/definition.txt?path=bend-lint-rules@0.2.0.0/language/reused_binder.bend&name=Once.of) # The binders a definition declares that can be used once, as their syntax says for sure: a parameter written without # `+` (unless one is `bare`: its quantity is its law's), and a let's name written without `+`. A pattern's field is left # out: its quantity also comes from its scrutinee's type (a field of a `List<&2, A>` is reusable), which the rule cannot # see. def Once.of(+bare: Bool, +path: List<&2, Lint.Above>, +node: Lint.Node) -> List<&2, Once>: ReusedBinder.scrutinee (https://jend.leeeet.dev/definition.txt?path=bend-lint-rules@0.2.0.0/language/reused_binder.bend&name=scrutinee) # The binders a match takes apart: the variables right under it, its scrutinees. In a case, they stand for the matched # constructor. def scrutinee(+u: Unit, +path: List<&2, Lint.Above>, +node: Lint.Node) -> List<&2, U32>: ReusedBinder.is_live_inside (https://jend.leeeet.dev/definition.txt?path=bend-lint-rules@0.2.0.0/language/reused_binder.bend&name=is_live_inside) # Whether the nodes under `node`, which is live if `live`, are: a body is; a type is not (an equality, a function or # pair type, a type's arguments). An annotation's type is not either: see `scan`. def is_live_inside(+node: Lint.Node, live: Bool) -> Bool: ReusedBinder.is_match (https://jend.leeeet.dev/definition.txt?path=bend-lint-rules@0.2.0.0/language/reused_binder.bend&name=is_match) def is_match(syntax: Lint.Syntax) -> Bool: ReusedBinder.is_annotation (https://jend.leeeet.dev/definition.txt?path=bend-lint-rules@0.2.0.0/language/reused_binder.bend&name=is_annotation) def is_annotation(syntax: Lint.Syntax) -> Bool: ReusedBinder.Seen.of (https://jend.leeeet.dev/definition.txt?path=bend-lint-rules@0.2.0.0/language/reused_binder.bend&name=Seen.of) # What a node's uses of `b` are: its own, if it is a live use, else `under`'s, those under it. def Seen.of(+node: Lint.Node, b: U32, live: Bool, under: Seen) -> Seen: ReusedBinder.Seen.then (https://jend.leeeet.dev/definition.txt?path=bend-lint-rules@0.2.0.0/language/reused_binder.bend&name=Seen.then) # The uses of `seen`, then those of `next`, the nodes after them: on one path, or, if `apart`, on paths of their own. def Seen.then(apart: Bool, seen: Seen, next: Seen) -> Seen: ReusedBinder.scan (https://jend.leeeet.dev/definition.txt?path=bend-lint-rules@0.2.0.0/language/reused_binder.bend&name=scan) # The live uses of `b` among `nodes`, the nodes under one, after `seen`: `live` says whether they are live, `apart` # whether each is a path of its own (a match's), and `typed` whether only the first is live (an annotation's: the # second is a type); `at` counts the nodes. def scan( nodes: List<&2, Lint.Node>, +b: U32, +live: Bool, +apart: Bool, +typed: Bool, +at: U32, seen: Seen ) -> Seen: ReusedBinder.finding (https://jend.leeeet.dev/definition.txt?path=bend-lint-rules@0.2.0.0/language/reused_binder.bend&name=finding) def finding(second: Seen, name: String) -> List<&2, Lint.Finding>: ReusedBinder.judged (https://jend.leeeet.dev/definition.txt?path=bend-lint-rules@0.2.0.0/language/reused_binder.bend&name=judged) # The finding about a binder of `owner` used twice on one path, unless a match takes it apart (`matched`). def judged(matched: Bool, owner: Lint.Node, b: U32, name: String) -> List<&2, Lint.Finding>: ReusedBinder.judge (https://jend.leeeet.dev/definition.txt?path=bend-lint-rules@0.2.0.0/language/reused_binder.bend&name=judge) # The finding about each of `onces`, binders of `owner`, used twice on one path, onto `out`; a binder a match takes # apart (`matched`) is skipped. def judge( +owner: Lint.Node, onces: List<&2, Once>, +matched: List<&2, U32>, out: List<&2, Lint.Finding> ) -> List<&2, Lint.Finding>: ReusedBinder.defs (https://jend.leeeet.dev/definition.txt?path=bend-lint-rules@0.2.0.0/language/reused_binder.bend&name=defs) def defs(nodes: List<&2, Lint.Node>, out: List<&2, Lint.Finding>) -> List<&2, Lint.Finding>: ReusedBinder.run (https://jend.leeeet.dev/definition.txt?path=bend-lint-rules@0.2.0.0/language/reused_binder.bend&name=run) def run(+here: Lint.Here) -> Lint.Ask(List<&2, Lint.Finding>): ReusedBinder.rule (https://jend.leeeet.dev/definition.txt?path=bend-lint-rules@0.2.0.0/language/reused_binder.bend&name=rule) def rule() -> Lint.Rule: UnneededPlus.Owner (https://jend.leeeet.dev/definition.txt?path=bend-lint-rules@0.2.0.0/language/unneeded_plus.bend&name=Owner) # What judging the binders of one definition reads: the definitions of the file used as values (named, not called), as # the check names them; the definition, as the check names it; and its binders that a match or a let takes apart. type Owner is Data: Owner{values: List<&2, String>, target: String, matched: List<&2, U32>} UnneededPlus.value.visit (https://jend.leeeet.dev/definition.txt?path=bend-lint-rules@0.2.0.0/language/unneeded_plus.bend&name=value.visit) # The definition a reference below `path` names, if it is used as a value: not as the function of an application. def value.visit(+u: Unit, +path: List<&2, Lint.Above>, +node: Lint.Node) -> List<&2, String>: UnneededPlus.is_constructed (https://jend.leeeet.dev/definition.txt?path=bend-lint-rules@0.2.0.0/language/unneeded_plus.bend&name=is_constructed) def is_constructed(nodes: List<&2, Lint.Node>) -> Bool: UnneededPlus.matched.visit (https://jend.leeeet.dev/definition.txt?path=bend-lint-rules@0.2.0.0/language/unneeded_plus.bend&name=matched.visit) # The binder a variable below `path` uses, if it is taken apart there: it is a match's scrutinee, or the value of a let # with a constructor pattern (`Vert{x, y} = v`). def matched.visit(+u: Unit, +path: List<&2, Lint.Above>, +node: Lint.Node) -> List<&2, U32>: UnneededPlus.is_once (https://jend.leeeet.dev/definition.txt?path=bend-lint-rules@0.2.0.0/language/unneeded_plus.bend&name=is_once) # Whether a binder used `used` times needs no `+`: none or one use. def is_once(used: Maybe<&2, Lint.Quantity>) -> Bool: UnneededPlus.plus (https://jend.leeeet.dev/definition.txt?path=bend-lint-rules@0.2.0.0/language/unneeded_plus.bend&name=plus) # The binder a node of this kind declares with `+`, if it does. def plus(syntax: Lint.Syntax) -> Maybe<&2, U32>: UnneededPlus.is_parameter (https://jend.leeeet.dev/definition.txt?path=bend-lint-rules@0.2.0.0/language/unneeded_plus.bend&name=is_parameter) def is_parameter(syntax: Lint.Syntax) -> Bool: UnneededPlus.message (https://jend.leeeet.dev/definition.txt?path=bend-lint-rules@0.2.0.0/language/unneeded_plus.bend&name=message) def message(+name: String) -> String: UnneededPlus.is_needless (https://jend.leeeet.dev/definition.txt?path=bend-lint-rules@0.2.0.0/language/unneeded_plus.bend&name=is_needless) # Whether a `+` binder its body uses at most once (`once`) needs no `+`: not if a match takes it apart, nor if it is a # parameter of a definition used as a value: the type it must have can ask for the `+`. def is_needless(once: Bool, parameter: Bool, owner: Owner, b: U32) -> Bool: UnneededPlus.judged (https://jend.leeeet.dev/definition.txt?path=bend-lint-rules@0.2.0.0/language/unneeded_plus.bend&name=judged) # The findings about a `+` binder (`binder`, if the node declares one) that its facts say its body uses at most once. def judged( binder: Maybe<&2, U32>, +parameter: Bool, +owner: Owner, +span: Maybe<&2, Lint.Span>, +name: String, facts: List<&2, Lint.Fact>, out: List<&2, Lint.Finding> ) -> List<&2, Lint.Finding>: UnneededPlus.visit (https://jend.leeeet.dev/definition.txt?path=bend-lint-rules@0.2.0.0/language/unneeded_plus.bend&name=visit) def visit(+owner: Owner, +path: List<&2, Lint.Above>, +node: Lint.Node) -> List<&2, Lint.Finding>: UnneededPlus.defs (https://jend.leeeet.dev/definition.txt?path=bend-lint-rules@0.2.0.0/language/unneeded_plus.bend&name=defs) def defs( nodes: List<&2, Lint.Node>, +values: List<&2, String>, out: List<&2, Lint.Finding> ) -> List<&2, Lint.Finding>: UnneededPlus.run (https://jend.leeeet.dev/definition.txt?path=bend-lint-rules@0.2.0.0/language/unneeded_plus.bend&name=run) def run(+here: Lint.Here) -> Lint.Ask(List<&2, Lint.Finding>): UnneededPlus.rule (https://jend.leeeet.dev/definition.txt?path=bend-lint-rules@0.2.0.0/language/unneeded_plus.bend&name=rule) def rule() -> Lint.Rule: CanonImportPath.segments.step (https://jend.leeeet.dev/definition.txt?path=bend-lint-rules@0.2.0.0/layout/canon_import_path.bend&name=segments.step) # Paths # ===== def segments.step(p: String, acc: List<&2, String>) -> List<&2, String>: CanonImportPath.segments.go (https://jend.leeeet.dev/definition.txt?path=bend-lint-rules@0.2.0.0/layout/canon_import_path.bend&name=segments.go) # A path's segments, last first: "" and "." dropped, ".." applied. def segments.go(parts: List<&2, String>, acc: List<&2, String>) -> List<&2, String>: CanonImportPath.segments (https://jend.leeeet.dev/definition.txt?path=bend-lint-rules@0.2.0.0/layout/canon_import_path.bend&name=segments) def segments(path: String) -> List<&2, String>: CanonImportPath.ups (https://jend.leeeet.dev/definition.txt?path=bend-lint-rules@0.2.0.0/layout/canon_import_path.bend&name=ups) # Each segment of `from` as "..", then `to`. def ups(from: List<&2, String>, to: List<&2, String>) -> List<&2, String>: CanonImportPath.is_same_head (https://jend.leeeet.dev/definition.txt?path=bend-lint-rules@0.2.0.0/layout/canon_import_path.bend&name=is_same_head) # Whether both lists start with the same segment. def is_same_head(from: List<&2, String>, to: List<&2, String>) -> Bool: CanonImportPath.relative.go (https://jend.leeeet.dev/definition.txt?path=bend-lint-rules@0.2.0.0/layout/canon_import_path.bend&name=relative.go) def relative.go(from: List<&2, String>, to: List<&2, String>, same: Bool) -> List<&2, String>: CanonImportPath.relative (https://jend.leeeet.dev/definition.txt?path=bend-lint-rules@0.2.0.0/layout/canon_import_path.bend&name=relative) # The segments that lead from the folder `from` to `to`. def relative(+from: List<&2, String>, +to: List<&2, String>) -> List<&2, String>: CanonImportPath.canon (https://jend.leeeet.dev/definition.txt?path=bend-lint-rules@0.2.0.0/layout/canon_import_path.bend&name=canon) # The segments as a path that starts with ./ or ../. def canon(+parts: List<&2, String>) -> String: CanonImportPath.is_hub (https://jend.leeeet.dev/definition.txt?path=bend-lint-rules@0.2.0.0/layout/canon_import_path.bend&name=is_hub) # Hub imports name a package, not a path. def is_hub(+path: String) -> Bool: CanonImportPath.verdict (https://jend.leeeet.dev/definition.txt?path=bend-lint-rules@0.2.0.0/layout/canon_import_path.bend&name=verdict) def verdict(fine: Bool, +want: String, +span: Lint.Span) -> List<&2, Lint.Finding>: CanonImportPath.judge (https://jend.leeeet.dev/definition.txt?path=bend-lint-rules@0.2.0.0/layout/canon_import_path.bend&name=judge) # A written path, against the one from `file` to `loads`, the file its import loads. def judge(file: String, +written: String, loads: String, span: Lint.Span) -> List<&2, Lint.Finding>: CanonImportPath.paths (https://jend.leeeet.dev/definition.txt?path=bend-lint-rules@0.2.0.0/layout/canon_import_path.bend&name=paths) # The findings on the paths of `nodes`' imports, onto `out`. A file's imports come first, so the first node of another # kind ends them; `import Base` writes no path. def paths( nodes: List<&2, Lint.Node>, +file: String, out: List<&2, Lint.Finding> ) -> List<&2, Lint.Finding>: CanonImportPath.run (https://jend.leeeet.dev/definition.txt?path=bend-lint-rules@0.2.0.0/layout/canon_import_path.bend&name=run) def run(+here: Lint.Here) -> Lint.Ask(List<&2, Lint.Finding>): CanonImportPath.rule (https://jend.leeeet.dev/definition.txt?path=bend-lint-rules@0.2.0.0/layout/canon_import_path.bend&name=rule) def rule() -> Lint.Rule: Case.Case (https://jend.leeeet.dev/definition.txt?path=bend-lint-rules@0.2.0.0/layout/case.bend&name=Case) # Types # ===== type Case is Data: Pascal{} Snake{} Either{} Case.has_no_underscore (https://jend.leeeet.dev/definition.txt?path=bend-lint-rules@0.2.0.0/layout/case.bend&name=has_no_underscore) # Case # ==== def has_no_underscore(s: String) -> Bool: Case.has_no_capital (https://jend.leeeet.dev/definition.txt?path=bend-lint-rules@0.2.0.0/layout/case.bend&name=has_no_capital) def has_no_capital(s: String, ok: Bool) -> Bool: Case.is_pascal.rest (https://jend.leeeet.dev/definition.txt?path=bend-lint-rules@0.2.0.0/layout/case.bend&name=is_pascal.rest) def is_pascal.rest(upper: Bool, rest: String) -> Bool: Case.is_pascal (https://jend.leeeet.dev/definition.txt?path=bend-lint-rules@0.2.0.0/layout/case.bend&name=is_pascal) def is_pascal(s: String) -> Bool: Case.is_snake.of (https://jend.leeeet.dev/definition.txt?path=bend-lint-rules@0.2.0.0/layout/case.bend&name=is_snake.of) def is_snake.of(empty: Bool, s: String) -> Bool: Case.is_snake (https://jend.leeeet.dev/definition.txt?path=bend-lint-rules@0.2.0.0/layout/case.bend&name=is_snake) def is_snake(+s: String) -> Bool: Case.fits (https://jend.leeeet.dev/definition.txt?path=bend-lint-rules@0.2.0.0/layout/case.bend&name=fits) def fits(want: Case, +s: String) -> Bool: Case.has_small_head (https://jend.leeeet.dev/definition.txt?path=bend-lint-rules@0.2.0.0/layout/case.bend&name=has_small_head) def has_small_head(s: String) -> Bool: Case.has_capital_head (https://jend.leeeet.dev/definition.txt?path=bend-lint-rules@0.2.0.0/layout/case.bend&name=has_capital_head) def has_capital_head(s: String) -> Bool: Case.snake_cap (https://jend.leeeet.dev/definition.txt?path=bend-lint-rules@0.2.0.0/layout/case.bend&name=snake_cap) def snake_cap(cut: Bool, c: Char, acc: String) -> String: Case.snake (https://jend.leeeet.dev/definition.txt?path=bend-lint-rules@0.2.0.0/layout/case.bend&name=snake) # `s` in snake_case: a word starts at a capital after a small letter or digit, or at the last capital of a run before a # small letter. `capital`: whether `s` starts with a capital. `prev`: the character before is none or `_` (0), a small # letter or digit (1), or a capital (2). `acc`: the result so far, last character first. def snake(s: String, capital: Bool, +prev: U32, acc: String) -> String: Case.pascal (https://jend.leeeet.dev/definition.txt?path=bend-lint-rules@0.2.0.0/layout/case.bend&name=pascal) # `s` in PascalCase: `_` goes, and the character after it becomes a capital. def pascal(s: String, up: Bool, acc: String) -> String: Case.recased (https://jend.leeeet.dev/definition.txt?path=bend-lint-rules@0.2.0.0/layout/case.bend&name=recased) def recased(want: Case, +s: String) -> String: Case.ends (https://jend.leeeet.dev/definition.txt?path=bend-lint-rules@0.2.0.0/layout/case.bend&name=ends) # Whether the type the last of `nodes` writes ends in a sort: it is one, or a function type whose result does. def ends(nodes: List<&2, Lint.Node>) -> Bool: Case.typed (https://jend.leeeet.dev/definition.txt?path=bend-lint-rules@0.2.0.0/layout/case.bend&name=typed) # The case of a name whose written type is the last of `nodes`: none written, either. def typed(+nodes: List<&2, Lint.Node>) -> Case: Case.returns (https://jend.leeeet.dev/definition.txt?path=bend-lint-rules@0.2.0.0/layout/case.bend&name=returns) # The case of a def's name, by its written return type, among its nodes. def returns(nodes: List<&2, Lint.Node>) -> Case: Case.wanted (https://jend.leeeet.dev/definition.txt?path=bend-lint-rules@0.2.0.0/layout/case.bend&name=wanted) # The case a declaration's name takes, if the file chooses it. def wanted(+node: Lint.Node, namespace: String) -> Maybe<&2, Case>: Case.noun (https://jend.leeeet.dev/definition.txt?path=bend-lint-rules@0.2.0.0/layout/case.bend&name=noun) # A name of `syntax`, in a message. `sort`: whether it is a type. def noun(syntax: Lint.Syntax, sort: Bool) -> String: More: https://jend.leeeet.dev/packages/bend-lint-rules.txt?definitions_offset=100