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

Prefer complete words over abbreviations, using the business-domain term.

Bad

def send_msg(usr, cfg), do: deliver(usr, cfg)

Good

def send_message(user, config), do: deliver(user, config)

Names are split on _ and checked where they are introduced. The default list is short; configure banned_abbreviations for your domain.

Check-Specific Parameters

Use the following parameters to configure this check:

:banned_abbreviations

Abbreviations to report, optionally with a suggestion.

This parameter defaults to [acct: "account", btn: "button", cfg: "config", cust: "customer", idx: "index", mgr: "manager", msg: "message", pwd: "password", qty: "quantity", tmp: "temporary", usr: "user"].

:allowed_names

Complete names that are accepted.

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.