Closed njwest closed 7 months ago
def pool_name(name) do
String.to_existing_atom("hammer_backend_#{name}_pool")
end
@epinault is there a reason why this needs to be to_existing_atom/1
? I can throw up a quick PR similar to #87 that just changes this to to_atom/1
but I don't wanna do that if there is an ideological resistance to to_atom/1
I think it s to avoid some risk of Atom during configuration but we can make it to_atom for now if you open an MR
https://hexdocs.pm/credo/Credo.Check.Warning.UnsafeToAtom.html
I think it s to avoid some risk of Atom during configuration but we can make it to_atom for now if you open an MR
https://hexdocs.pm/credo/Credo.Check.Warning.UnsafeToAtom.html
@epinault a fix for this has been added to PR #87
Edit: Re: the UnsafeToAtom
check, String.to_atom/1
can be dangerous if it is getting called a lot, e.g. if you have a user input that creates atoms on the backend; this is not a concern with configuration, which is set by us devs and isn't exposed to users.
IMHO we have a use case in Hammer where to_atom
should be used, as to_existing_atom
doesn't work in this implementation anymore.
Also, the credo check itself is tagged :controversial
, likely because some folks think to_atom
is always bad when it is actually fine if used responsibly :P
from the credo link:
+1 also need this, can't deploy new project without it. 🙏🏼
Hello, I am have released a new version 6.2.1. I am unfortunately traveling for another few days and have limited access so hopefully that will unblock you
Thank you @epinault !!! 🙏 that solved it for me
Describe the bug When calling Hammer functions with a single backend, NOT a list of backends, the call fails with:
** Provide the following details
Expected behavior I expect
Hammer.check_rate/4
to not result in an errorActual behavior See above