Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Warnings for functions without type specs?

I want all of my exported functions to have type -specs, to ensure that there is at least basic documentation of the interface. Can I make the compiler or Dialyzer emit warnings for functions without type specifications?

like image 666
legoscia Avatar asked Aug 23 '12 13:08

legoscia


1 Answers

There is an undocumented compiler (not Dialyzer) option called warn_missing_spec that does this. On the command line, pass +warn_missing_spec to erlc:

erlc -o ebin +warn_missing_spec foo.erl

If you use Rebar, add warn_missing_spec to erl_opts:

{erl_opts, [warn_missing_spec]}.
like image 119
legoscia Avatar answered Sep 21 '22 13:09

legoscia