View Source Credo.Check.Consistency.SpaceInParentheses (Credo v1.7.5)
Basics
This check is enabled by default.
Learn how to disable it via
.credo.exs
.
This check is tagged
:formatter
This means you can disable this check when also using Elixir's formatter.
This check has a base priority of high
and works with any version of Elixir.
Explanation
Don't use spaces after (
, [
, and {
or before }
, ]
, and )
. This is
the preferred way, although other styles are possible, as long as it is
applied consistently.
# preferred
Helper.format({1, true, 2}, :my_atom)
# also okay
Helper.format( { 1, true, 2 }, :my_atom )
While this is not necessarily a concern for the correctness of your code, you should use a consistent style throughout your codebase.
Check-Specific Parameters
Use the following parameters to configure this check:
:allow_empty_enums
Allows [], %{} and similar empty enum values to be used regardless of spacing throughout the codebase.
This parameter defaults to false
.
General Parameters
Like with all checks, general params can be applied.
Parameters can be configured via the .credo.exs
config file.