-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Avoid piping into anonymous functions #2117
Conversation
1c0d981
to
db44278
Compare
lib/dotcom/cache/key_generator.ex
Outdated
@@ -24,7 +24,7 @@ defmodule Dotcom.Cache.KeyGenerator do | |||
mod | |||
|> Kernel.to_string() | |||
|> String.split(".") | |||
|> (fn [_ | tail] -> tail end).() | |||
|> Kernel.then(fn [_ | tail] -> tail end) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I feel like using then
doesn't actually help what this credo check is for. The goal of the check is to improve readability and this doesn't make it better, just changes it. I think moving these to named functions would improve readability. This example replacing it with Kernel.tl
would solve this problem
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This makes sense, I was looking for a function named tail and couldn't find one.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use function names instead of Kernel.then
Anonymous functions make sense when they are doing something very basic that isn't particularly reusable. |
https://app.asana.com/0/555089885850811/1207647461641385/f