Skip to main content

W0040 - Undocumented function

Weak Warning

    -module(main).
-export([main/0]).

main() -> ok.
%% ^^^^ 💡 weak: The funcion is exported, but not documented.

Explanation

The function main/0 is exported, but contains no documentation.

Documentation can be added using the -doc attribute, using the Markdown format:

    -module(main).
-export([main/0]).

-doc """
This is the documentation for the `main` function.
""".
main() -> ok.

It is recommended to add documentation to all exported functions, so that it becomes available during auto-completion, hover, and other IDE features.

For functions that are not exported, but for which documentation is not desired, it is possible to mark the function as -doc hidden. to silent the linter.

To disable the linter for all files belonging to a module, you can mark the entire module as -moduledoc hidden..

It is also possible to add metadata to the documentation. For more information, see the official Erlang documentation.