# `CredoHotUpgrades.Check.SupervisorInitSideEffects`
[🔗](https://github.com/deployex/credo_hot_upgrades/blob/main/lib/credo_hot_upgrades/check/supervisor_init_side_effects.ex#L1)

## Basics

> #### This check is disabled by default. {: .neutral}
>
> [Learn how to enable it](`e:credo:config_file.html#checks`) via `.credo.exs`.

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

## Explanation

The appup instruction a hot upgrade uses to update a supervisor,
`{update, Module, supervisor}`, loads the new supervisor module and
re-reads `init/1` to get its new child specifications. Re-reading means
running it, on the live supervisor process, the same call that ran when
the node booted: `supervisor:code_change/3` in OTP calls
`Module:init(Args)` directly.

A side effect sitting in a supervisor's `init/1`, an `ets:new/2` with a
name already taken, a second `:telemetry.attach`, an
`Application.put_env/3`, runs again and fails or duplicates work on that
second call, even though nothing about the supervisor's own behaviour
needed it to. Keep a supervisor's `init/1` free of side effects, the
same discipline `Application.start/2` already asks for: a hot upgrade
can call this one a second time on a node that never restarted.

## Check-Specific Parameters

*There are no specific parameters for this check.*

## General Parameters

Like with all checks, [general params](`e:credo:check_params.html`) can be applied.

Parameters can be configured via the [`.credo.exs` config file](`e:credo:config_file.html`).

---

*Consult [api-reference.md](api-reference.md) for complete listing*
