~/bend-docscommunity

layout/case.bend fails

raw source on the hub · import bend-lint-rules@0.1.0.0/layout/case.bend as Case

layout/case: a name whose case does not follow the kind of what it names. Fix: renames the declaration, with its uses. Heuristics: the kind comes from the syntax and the written types, not from the checker:

| Kind | Case | Examples | | ------------------------------------------------- | ----------------- | ---------------------------- | | type, constructor, import alias | PascalCase | Maybe, Some{}, M | | def whose written return type ends in a sort | PascalCase | IO, Pair, Set() | | parameter or field whose written type ends in one | PascalCase | -A: Type, F: U32 -> Type | | law, other def, parameter or field | snake_case | add_comm, from_list, n | | variable, lambda, forall, def without a return | either | Big, small | | namespace segment | its parent's case | IO.print, Set.from_list |

A sort is Type, Data or Kind(..); a type ends in one when it is one, or a function type whose result does. A binder written bare (<a>, (x)) is a quantity, so snake_case. PascalCase is a capital, then letters and digits: IO, OP and U32 pass. snake_case has no capital. A dotted name is checked by its last segment; the segments before it name its parent, checked where the parent is declared. import Base, and a def that fills a law of another file, are skipped: their names are not this file's to choose.

4 imports
import Base
import bend-lint-api@0.1.0.0/linter/lint.bend as Lint
import bend-lint-api@0.1.0.0/shared/lists.bend as Lists
import bend-lint-api@0.1.0.0/shared/strings.bend as Strings