zf

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

contract_diff.ex (1047B)


      1 defmodule Dialyxir.Warnings.ContractDiff do
      2   @behaviour Dialyxir.Warning
      3 
      4   @impl Dialyxir.Warning
      5   @spec warning() :: :contract_diff
      6   def warning(), do: :contract_diff
      7 
      8   @impl Dialyxir.Warning
      9   @spec format_short([String.t()]) :: String.t()
     10   def format_short([_module, function | _]) do
     11     "Type specification is not equal to the success typing for #{function}."
     12   end
     13 
     14   @impl Dialyxir.Warning
     15   @spec format_long([String.t()]) :: String.t()
     16   def format_long([module, function, arity, contract, signature]) do
     17     pretty_module = Erlex.pretty_print(module)
     18     pretty_contract = Erlex.pretty_print_contract(contract)
     19     pretty_signature = Erlex.pretty_print_contract(signature)
     20 
     21     """
     22     Type specification is not equal to the success typing.
     23 
     24     Function:
     25     #{pretty_module}.#{function}/#{arity}
     26 
     27     Type specification:
     28     #{pretty_contract}
     29 
     30     Success typing:
     31     #{pretty_signature}
     32     """
     33   end
     34 
     35   @impl Dialyxir.Warning
     36   @spec explain() :: String.t()
     37   def explain() do
     38     Dialyxir.Warning.default_explain()
     39   end
     40 end