zf

zenflows testing
git clone https://s.sonu.ch/~srfsh/zf.git
Log | Files | Refs | Submodules | README | LICENSE

callback_missing.ex (1058B)


      1 defmodule Dialyxir.Warnings.CallbackMissing do
      2   @moduledoc """
      3   Module implements a behaviour, but does not have all of its
      4   callbacks. This is also a compiler warning.
      5 
      6   ## Example
      7 
      8       defmodule ExampleBehaviour do
      9         @callback ok() :: :ok
     10         @callback missing() :: :ok
     11       end
     12 
     13       defmodule Example do
     14         @behaviour ExampleBehaviour
     15 
     16         def ok() do
     17           :ok
     18         end
     19       end
     20   """
     21 
     22   @behaviour Dialyxir.Warning
     23 
     24   @impl Dialyxir.Warning
     25   @spec warning() :: :callback_missing
     26   def warning(), do: :callback_missing
     27 
     28   @impl Dialyxir.Warning
     29   @spec format_short([String.t()]) :: String.t()
     30   def format_short(args), do: format_long(args)
     31 
     32   @impl Dialyxir.Warning
     33   @spec format_long([String.t()]) :: String.t()
     34   def format_long([behaviour, function, arity]) do
     35     pretty_behaviour = Erlex.pretty_print(behaviour)
     36 
     37     "Undefined callback function #{function}/#{arity} (behaviour #{pretty_behaviour})."
     38   end
     39 
     40   @impl Dialyxir.Warning
     41   @spec explain() :: String.t()
     42   def explain() do
     43     @moduledoc
     44   end
     45 end