-
Notifications
You must be signed in to change notification settings - Fork 434
Open
Description
(Thank you for this super-neat tool!;)
Please add a check (off by default, low priority) that would generate a warning on capture operator.
Reasoning:
Some teams might prefer explicit anonymous functions for ease of "at a glance" readability.
While the capture operator allows for shorter code, it adds cognitive overhead (and possibility of mis-reading) for the person quickly reading the code.
Code Examples:
- the "capture operator" version
current_execution.values
|> Enum.map(& &1.node_name)(this code would be flagged by Credo.Check.Readability.NoCaptureOperator)
- the "anonymous function" version
current_execution.values
|> Enum.map(fn value -> value.node_name end)Option 2 is obviously more verbose and not as clever, but it is also more explicit, and easier to correctly understand at a glance by developers even relatively new to Elixir, which is important for some teams.
jmalovera10 and NickNeck
Metadata
Metadata
Assignees
Labels
No labels