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

Keep literal lists in module attributes alphabetical.

Bad

@roles [:member, :admin, :guest]

Good

@roles [:admin, :guest, :member]

Use ignore_attributes for lists where order is semantic, such as @stages.

Check-Specific Parameters

Use the following parameters to configure this check:

:min_run

Minimum list length that is checked.

This parameter defaults to 3.

:ignore_attributes

Attributes whose order is meaningful.

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.