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

Name modules for what they are, not for being a collection of leftovers.

Bad

defmodule MyApp.Billing.Helpers do
end

Good

defmodule MyApp.Billing.InvoiceFormatter do
end

Only the last segment is compared with banned_names. This is a heuristic; use allowed_modules for intentional names.

Check-Specific Parameters

Use the following parameters to configure this check:

:banned_names

Generic last segments to report.

This parameter defaults to ["Common", "Helper", "Helpers", "Misc", "Stuff", "Util", "Utilities", "Utils"].

:allowed_modules

Full module 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.