View Source Styler.Style.ModuleDirectives (Styler v1.2.1)

Styles up module directives!

This Style will expand multi-aliases/requires/imports/use and sort the directive within its groups (except uses, which cannot be sorted) It also adds a blank line after each directive group.

Credo rules

Rewrites for the following Credo rules:

  • Credo.Check.Consistency.MultiAliasImportRequireUse (force expansion)
  • Credo.Check.Readability.AliasOrder (we sort __MODULE__, which credo doesn't)
  • Credo.Check.Readability.ModuleDoc (adds @moduledoc false if missing. includes *.exs files)
  • Credo.Check.Readability.MultiAlias
  • Credo.Check.Readability.StrictModuleLayout (see section below for details)
  • Credo.Check.Readability.UnnecessaryAliasExpansion
  • Credo.Check.Design.AliasUsage

Strict Layout

Modules directives are sorted into the following order:

  • @shortdoc
  • @moduledoc
  • @behaviour
  • use
  • import
  • alias
  • require
  • everything else (unchanged)

Summary

Functions

Callback implementation for Styler.Style.run/2.

Functions

Callback implementation for Styler.Style.run/2.