zf

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

call_to_missing_function.ex (1082B)


      1 defmodule Dialyxir.Warnings.CallToMissingFunction do
      2   @moduledoc """
      3   Function calls a missing or private function. This may be caused by
      4   a typo or incorrect arity. This is also a compiler warning.
      5 
      6   ## Example
      7 
      8       defmodule Missing do
      9         def missing(:ok) do
     10           :ok
     11         end
     12 
     13         defp missing() do
     14           :ok
     15         end
     16       end
     17 
     18       defmodule Example do
     19         def error() do
     20           Missing.missing()
     21         end
     22       end
     23   """
     24 
     25   @behaviour Dialyxir.Warning
     26 
     27   @impl Dialyxir.Warning
     28   @spec warning() :: :call_to_missing
     29   def warning(), do: :call_to_missing
     30 
     31   @impl Dialyxir.Warning
     32   @spec format_short([String.t()]) :: String.t()
     33   def format_short(args), do: format_long(args)
     34 
     35   @impl Dialyxir.Warning
     36   @spec format_long([String.t()]) :: String.t()
     37   def format_long([module, function, arity]) do
     38     pretty_module = Erlex.pretty_print(module)
     39     "Call to missing or private function #{pretty_module}.#{function}/#{arity}."
     40   end
     41 
     42   @impl Dialyxir.Warning
     43   @spec explain() :: String.t()
     44   def explain() do
     45     @moduledoc
     46   end
     47 end