~/bend-docscommunity

src/rules/style/wrap.bend fails

raw source on the hub · import 0xde9bb08f7de298b03207fb5797ede9a5/src/rules/style/wrap.bend as Wrap

rule wrap: how a def header breaks. A one-line header wider than 120 must break; the width is the header through its :, counted the way space counts a line (a string literal is two characters), a comment counting none. A header breaks when a newline token of its own sits in it: a line break inside a string literal is the string's. A one-line header that fits stays one line however many parameters it has. A header that breaks puts ( at the end of the first line and one parameter on each following line, then ) and the return type on a line of their own after the last parameter. Several parameters on a line, a parameter left on the ( line, a parameter split across lines, a ) on the last parameter's line (bb: U32) -> U32:), a ) with no -> right after it on its line (the return type on a line of its own, ) then -> U32:; a def that fills a law has no return type, and ): is its end), or a parameter list with no parameter in it (def none( then ) -> U32:, which fits on one line), is a finding. A comment after the header's : is not part of the header: def u(aa: U32) -> U32: # note is a one-line header.

7 imports
import Base
import ../../src.bend as Src
import ../../finding.bend as F
import ../../syntax/lex.bend as Lex
import ../../syntax/outline.bend as Outline
import ../../lazy/lazy.bend as Lazy
import ./space.bend as Space