OptimumCredo.Check.Readability.SpecWithImpl (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

A function annotated with @impl implements a callback, whose spec is already defined by the behaviour. Remove the @spec.

Bad

@impl Phoenix.LiveView
@spec mount(map(), map(), Socket.t()) :: {:ok, Socket.t()}
def mount(params, session, socket), do: {:ok, socket}

Good

@impl Phoenix.LiveView
def mount(params, session, socket), do: {:ok, socket}

@impl false is not treated as a callback. Specs are matched by function name.

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.