elixir-pre-commit icon indicating copy to clipboard operation
elixir-pre-commit copied to clipboard

Re-compile when config changes

Open finnhodgkin opened this issue 8 years ago • 2 comments

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.

finnhodgkin avatar Oct 13 '17 10:10 finnhodgkin

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.

finnhodgkin avatar Oct 15 '17 12:10 finnhodgkin

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

finnhodgkin avatar Dec 08 '17 12:12 finnhodgkin