phoenix icon indicating copy to clipboard operation
phoenix copied to clipboard

Route with undefined module/function does not generate warning when compiled

Open lkarthee opened this issue 2 years ago • 3 comments

Environment

  • Elixir version (elixir -v): 1.13
  • Phoenix version (mix deps): "~> 1.6.4"
  • Operating system: Mac OS 12.0.1

Expected behavior

  scope "/", HelloLiveWeb do
    pipe_through :browser

    get "/", PageController, :index # <-- module and function is defined
    get "/pages/:id", PageController, :undefined_func # <-- function is not defined
    get "/tests/:id", SomeUndefinedController, :id # <-- module is not defined
    live "/demo", Demo # <-- module is defined
    live "/hello_demo", UndefinedDemoLive # <-- module is not defined 
  end

Routes with undefinded module or function should generate warnings - 3 warnings expected when routes are compiled.

  • function HelloLiveWeb.PageController. undefined_func/2 is undefined
  • module SomeUndefinedController is not available or undefined
  • module UndefinedDemoLive is not available or undefined

Actual behavior

Only one warning is generated :

 warning: HelloLiveWeb.SomeUndefinedController/1 is undefined (module HelloLiveWeb.SomeUndefinedController is not available or is yet to be defined)
  lib/hello_live_web/router.ex:22: HelloLiveWeb.Router.__checks__/0

Undefined functions in plain controllers and undefined live controllers don't generate any warnings.

lkarthee avatar Jan 22 '22 03:01 lkarthee