Basics
This check is disabled by default.
Learn how to enable it via .credo.exs.
This check has a base priority of normal and works with any version of Elixir.
Explanation
Prefer Shorthand map syntax for atom-key and string-key maps.
%{foo: foo, bar: :baz}
%{"foo" => foo, "bar" => :baz}should be written as:
m(foo, bar: :baz)
sm(foo, bar: :baz)Structs (%Mod{}) and maps inside quote blocks are ignored —
Shorthand macros cannot appear in quoted AST (use st/2 for structs).
Enable in .credo.exs:
{Shorthand.Check.Refactor.ShortenMaps, []}Pair with Shorthand.Quokka.ShortenMaps to auto-rewrite on mix format.
Check-Specific Parameters
There are no specific parameters for this check.
General Parameters
Like with all checks, general params can be applied.
Parameters can be configured via the .credo.exs config file.