credo v1.3.0 Release Notes
Release Date: 2020-03-09 // about 4 years ago-
- 0๏ธโฃ Enable
Credo.Check.Readability.UnnecessaryAliasExpansion
check by default - ๐ Fix bugs when removing heredocs and charlists from sources
- ๐ Fix false positive on TrailingWhiteSpace
โ Add
ignore: [:fun1, :fun2]
param to allUnusedOperation*
checks; to ignore unusedEnum.reduce/3
operations, use{Credo.Check.Warning.UnusedEnumOperation, [ignore: [:reduce]]},
๐ New switch to re-enable disabled checks
๐ Use
--enable-disabled-checks [pattern]
to re-enable checks that were disabled in the config using{CheckModule, false}
. This comes in handy when using checks on a case-by-case basisAs with other check-related switches,
pattern
is a comma-delimted list of patterns:$ mix credo info --enable-disabled-checks Credo.Check.Readability.Specs,Credo.Check.Refactor.DoubleBooleanNegation
Of course, we can have the same effect by choosing the pattern less explicitly:
$ mix credo info --enable-disabled-checks specs,double
๐ New API for custom checks
๐ > This deprecates the mandatory use of
@explanation
and@default_params
module attributes for checks.0๏ธโฃ Before
v1.3
you had to define module attributes named@explanation
and@default_params
before callinguse Credo.Check
.0๏ธโฃ Now you can pass
:explanations
(plural) and:param_defaults
options directly touse Credo.Check
.defmodule MyCheck do use Credo.Check, category: :warning, base_priority: :high, param_defaults: [param1: 42, param2: "offline"], explanations: [ check: "...", params: [ param1: "Your favorite number", param2: "Online/Offline mode" ] ] def run(%SourceFile{} = source_file, params) do # end end
Please note that these options are also just a convenience to implement the functions specified by the
Credo.Check
behaviour. You can alternatively implement the respective functions yourself:defmodule MyCheck do use Credo.Check def category, do: :warning def base_priority, do: :high def explanations do [ check: "...", params: [ param1: "Your favorite number", param2: "Online/Offline mode" ] ] end def param_defaults, do: [param1: 42, param2: "offline"] def run(%SourceFile{} = source_file, params) do # end end
๐ New checks
Credo.Check.Readability.StrictModuleLayout
Credo.Check.Readability.WithCustomTaggedTuple
- โ
Credo.Check.Warning.LeakyEnvironment
- โ
Credo.Check.Warning.UnsafeExec
- 0๏ธโฃ Enable