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

Call local functions directly instead of through __MODULE__.

Bad

def run(x), do: __MODULE__.helper(x)
def helper(x), do: x

Good

def run(x), do: helper(x)
def helper(x), do: x

Functions defined by use or macros are unknown. Use allow_self_prefix_for for deliberate self-calls.

Check-Specific Parameters

Use the following parameters to configure this check:

:allow_self_prefix_for

Function names that may keep the __MODULE__. prefix.

This parameter defaults to [].

General Parameters

Like with all checks, general params can be applied.

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