OptimumCredo.Check.Readability.UnusedTypes (OptimumCredo v0.5.0)

View Source

Basics

This check is disabled by default.

Learn how to enable it via .credo.exs.

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

Explanation

Type definitions should be removed if they're not used anywhere in the module.

Examples

Bad:

@type short_id :: String.t()  # Never used
@type conn :: Plug.Conn.t()

@spec index(conn()) :: conn()
def index(conn, _params) do
  # ...
end

Good:

@type conn :: Plug.Conn.t()

@spec index(conn()) :: conn()
def index(conn, _params) do
  # ...
end

Check-Specific Parameters

Use the following parameters to configure this check:

:ignored_types

Type names that are never reported, because other modules are expected to reference them.

This parameter defaults to [:t].

General Parameters

Like with all checks, general params can be applied.

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