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
The ++ operator copies the entire left-hand list. A one-off
concatenation is O(n) — same as Enum.reverse/1 — and perfectly fine.
Inside a loop, however, the cost compounds: n iterations × O(n) copy = O(n²).
Use [item | acc] to prepend (O(1) per iteration) and call
Enum.reverse/1 once at the end when order matters.
This check only flags ++ inside loops (reduce, fold, for/reduce,
recursive functions). One-off concatenations are not flagged.
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.