E1840: declaration has no documentation

View source

Every open declaration of a package is public, and strict mode (--strict, ADR-0041) requires it to have a """ block docstring.

Every open declaration of a package is public, and strict mode (--strict, ADR-0041) requires it to have a """ block docstring. The check covers the open verbs, external verbs, structs and their fields, packs and their fields, serialization contracts, enums and their variants, roles and their methods, performances and their methods, and the facade exports open name;. Every private verb needs a docstring as well: a verb or external verb without open, and the methods of a private perform block. The other private declarations (structs, fields, enums) need none. A docstring that is empty or holds only blanks counts as missing. The message names the declaration, as in verb answer: missing or empty block docstring for a public verb and verb helper: private verb has no block docstring; strict mode documents every verb for a private one, and the error points at the declaration.

actus check, actus build and actus test check every production source file of the package, not only the file that holds main and whether or not another file imports it, and print the findings of each file before the run fails. A production file that does not lex or parse is reported in strict mode with its lexical or parse error, even when nothing imports it, instead of being skipped. Without --strict the documentation is not checked.

Example

actus
open verb answer() -> Int {
    return 42;
}

verb main() {
}

A private verb is checked in the same way. The example documents its public verb and leaves the private helper without a docstring:

actus
"""Return the constant answer 42 as an integer value."""
open verb answer() -> Int {
    return helper();
}

verb helper() -> Int {
    return 42;
}

"""Entry point of the example; it does nothing and returns no value."""
verb main() {
}

Fix

Write a """ block docstring directly above the declaration, for a private verb as well as for a public one. It states what the declaration is for and, where they apply, its ownership roles, its return value and its error variants. Strict mode does not check that content yet.

actus
"""Return the constant answer 42 as an integer value."""
open verb answer() -> Int {
    return 42;
}

"""Entry point of the example; it does nothing and returns no value."""
verb main() {
}

Run actus explain E1840 in your terminal to read this entry offline. Browse Strict & toolchain or all error codes.