elixir-pre-commit
elixir-pre-commit copied to clipboard
Re-compile when config changes
We need to work out how to re-compile the pre_commit task when the config changes.
Example:
A user sets up pre_commit for a project with just test in the config.
The next day, the user adds credo --strict to the config, but the pre_commit doesn't update :cry:
Currently the only way to force an update is to delete the build folder and recompile.
A temporary fix for this is to include a section in the docs advising people to run mix clean --deps after changing pre_commit configuration.
I think the envy module reloads module configs so maybe we could take a look there at some point.
Update with potential fix
@doc """
Reloads `config/config.exs`. This function can be used to reload configuration
that relies on environment variables set by Envy.
This workaround is necessary since config files don't have
access to dependencies.
"""
def reload_config do
Mix.Config.read!("config/config.exs") |> Mix.Config.persist
end