OptimumCredo.Check.Warning.ExternalCallInMigration (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 call external services from migrations.
Bad
def up do
Req.post!("https://api.example.com/sync", json: %{})
endGood
Put the one-off call in a script under priv/ and keep the migration to schema and
in-database changes.
Check-Specific Parameters
Use the following parameters to configure this check:
:external_modules
Module names or name prefixes treated as external services.
This parameter defaults to ["HTTPoison", "Req", "Tesla", "Finch", "Mint", "ExAws", "Stripe", "Swoosh", ":httpc", ":hackney"].
:ignore_files
Path suffixes or regexes for migrations to skip.
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.