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

Private functions should not have @spec declarations. Specs are for public API documentation and type checking, not internal implementation details.

Examples

Bad:

@spec lookup_cached_entries(list()) :: {:hit, content()} | :miss
defp lookup_cached_entries(ets_match_spec) do
  # ...
end

Good:

defp lookup_cached_entries(ets_match_spec) do
  # ...
end

Only public functions (def) should have @spec declarations.

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.