OptimumCredo.Check.Warning.UnsafeAtomConversion (OptimumCredo v0.5.0)
View SourceBasics
This check is disabled by default.
Learn how to enable it via .credo.exs.
This check has a base priority of low and works with any version of Elixir.
Explanation
Do not create atoms from runtime data.
Bad
sort_by = String.to_atom(params["sort_by"])Good
sort_by = String.to_existing_atom(params["sort_by"])Suppress deliberate uses with a trailing # sobelow_skip ["DOS.StringToAtom"] comment.
Check-Specific Parameters
Use the following parameters to configure this check:
:allow_in_paths
Extra directory fragments that are not checked.
This parameter defaults to [].
General Parameters
Like with all checks, general params can be applied.
Parameters can be configured via the .credo.exs config file.