# `CredoHotUpgrades.Check.ClosureInOptions`
[🔗](https://github.com/deployex/credo_hot_upgrades/blob/main/lib/credo_hot_upgrades/check/closure_in_options.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

An anonymous function, or a capture of a local function, is tied to the
version of the module that built it. Once that module is replaced the
value is dead, and calling it raises `BadFunctionError`.

The same rule reaches past state, ETS and messages into anything a
library keeps and calls back into later. A child specification is kept
by its supervisor and used again at every restart:
`{Task, fn -> warm_cache() end}` fails on the restart after the module
that built the `fn` is replaced. A connection pool keeps `configure:`
and `after_connect:` the same way, a `Telemetry.Metrics` reporter keeps
`measurement:`, `tag_values:`, `keep:` and `drop:`, and `:ssl` keeps
`sni_fun:` and `verify_fun:`.

Pass `{MyApp.Cache, :warm, []}` or a capture of an exported function
wherever a library asks for one of these, not an inline `fn`.

## 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*
