LexCredo.Check.Warning.NamedOtpBuiltins (LexCredo v0.4.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

Give DynamicSupervisor and Registry child specs a name: option.

A name lets callers interact with the process through the standard APIs without passing its PID around. This check only examines literal child specs, so dynamically constructed options are left alone.

# BAD
{DynamicSupervisor, strategy: :one_for_one}
{Registry, keys: :unique}

# GOOD
{DynamicSupervisor, strategy: :one_for_one, name: MyApp.DynamicSupervisor}
{Registry, keys: :unique, name: MyApp.Registry}

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.