cpjk/canary

Weird application warnings and sometimes compile issues

marcinkoziej opened this issue · 0 comments

Hi!
Using Elixir 1.14.5 and OTP 25.2.2

I get these warning when canary is compiled as dependency to my project:

warning: Canada.Can.can?/3 defined in application :canada is used by the current application but the current application does not depend on :canada. To fix this, you must do one of:

  1. If :canada is part of Erlang/Elixir, you must include it under :extra_applications inside "def application" in your mix.exs

  2. If :canada is a dependency, make sure it is listed under "def deps" in your mix.exs

  3. In case you don't want to add a requirement to :canada, you may optionally skip this warning by adding [xref: [exclude: [Canada.Can]]] to your "def project" in mix.exs

  lib/canary/plugs.ex:213: Canary.Plugs.do_authorize_resource/2

warning: Ecto.Query.from/1 defined in application :ecto is used by the current application but the current application does not depend on :ecto. To fix this, you must do one of:

  1. If :ecto is part of Erlang/Elixir, you must include it under :extra_applications inside "def application" in your mix.exs

  2. If :ecto is a dependency, make sure it is listed under "def deps" in your mix.exs

  3. In case you don't want to add a requirement to :ecto, you may optionally skip this warning by adding [xref: [exclude: [Ecto.Query]]] to your "def project" in mix.exs

Invalid call found at 2 locations:
  lib/canary/plugs.ex:319: Canary.Plugs.fetch_all/2
  lib/canary/plugs.ex:324: Canary.Plugs.fetch_all/2

Indeed canary mix.exs does not list :ecto or :canada:

  def application do
    [applications: [:logger]]
  end

The documentation says that ecto and canada should be inferred from deps, where they are listed.
The side-effect of this warning is that sometimes canary will fail to compile – and one needs to remove _build dir to force another attempt, and it usually works.

Any ideas what's the best way here?