CredoHotUpgrades.Check.ApplicationStartSideEffects (CredoHotUpgrades v1.0.0)

Copy Markdown View Source

Basics

This check is disabled by default.

Learn how to enable it via .credo.exs.

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

Explanation

Application.start/2 runs once, when the application boots. A hot upgrade does not run it again, so a patch or a hot-upgraded release cannot change what it set up there: an ETS table, a :persistent_term value, a telemetry handler, a logger filter.

A release that adds a metric, a handler or a table entry is installed, and nothing exports or registers it until the node restarts. Do that setup in a supervised process instead, which starts fresh on every release that adds or changes it, or expose a function the new code can call explicitly to refresh it.

The same holds for setup done through a library or a function of the project, MyApp.Instrumentation.setup() or attach_handlers(), which this check cannot open. It reports every call in start/2 whose result is not used: a call made for what it does, not for what it returns. Logger and IO are left alone. Name other modules to leave alone with the allowed parameter, allowed: ["MyApp.Banner"].

Check-Specific Parameters

Use the following parameters to configure this check:

:allowed

Modules whose calls in start/2 are not reported.

This parameter defaults to [].

General Parameters

Like with all checks, general params can be applied.

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