Credo.Check.Warning.ApplicationConfigInModuleAttribute (Credo v1.6.1) View Source

This check has a base priority of high and works with any version of Elixir.

Explanation

Module attributes are evaluated at compile time and not at run time. As a result, certain configuration read calls made in your module attributes may work as expected during local development, but may break once in a deployed context.

This check analyzes all of the module attributes present within a module, and validates that there are no unsafe calls.

These unsafe calls include:

As of Elixir 1.10 you can leverage Application.compile_env/3 and Application.compile_env!/2 if you wish to set configuration at compile time using module attributes.

Check-Specific Parameters

There are no specific parameters for this check.

General Parameters

Like with all checks, general params can be applied.

Parameters can be configured via the .credo.exs config file.