diff --git a/app/.credo.exs b/app/.credo.exs index 0a5f34a..88f64e3 100644 --- a/app/.credo.exs +++ b/app/.credo.exs @@ -41,6 +41,11 @@ # If you create your own checks, you must specify the source files for # them here, so they can be loaded by Credo before running the analysis. # + # This is the ONLY load path for lib_dev/ checks: the directory is kept out + # of elixirc_paths in mix.exs on purpose, so the module is not also loaded + # from a compiled .beam (that double load produced + # "warning: redefining module Firehose.Checks.NoConnShadowing"). + # requires: ["lib_dev/firehose/checks/"], # # If you want to enforce a style guide and need a more traditional linting diff --git a/app/mix.exs b/app/mix.exs index f4eb3a0..c1bdc1a 100644 --- a/app/mix.exs +++ b/app/mix.exs @@ -33,8 +33,15 @@ defmodule Firehose.MixProject do end # Specifies which paths to compile per environment. - defp elixirc_paths(:test), do: ["lib", "lib_dev", "test/support"] - defp elixirc_paths(:dev), do: ["lib", "lib_dev"] + # + # `lib_dev/` is deliberately NOT compiled in any environment: it holds + # credo-only checks (Firehose.Checks.NoConnShadowing), and credo loads them + # itself from source via `requires:` in .credo.exs. Compiling that path as + # well gave every run two load paths for the same module, which surfaces as + # "warning: redefining module Firehose.Checks.NoConnShadowing" on a warm + # `_build/dev`. Keep the single source load: if you add code under lib_dev/ + # that is NOT a credo check, give it its own compiled path instead. + defp elixirc_paths(:test), do: ["lib", "test/support"] defp elixirc_paths(_), do: ["lib"] # Specifies your project dependencies.