Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我希望我所有的导出函数都具有 type -specs,以确保至少有接口的基本文档。我可以让编译器或 Dialyzer 为没有类型规范的函数发出警告吗?
-spec
有一个未记录的编译器(不是 Dialyzer)选项warn_missing_spec可以执行此操作。在命令行上,传递+warn_missing_spec给erlc:
warn_missing_spec
+warn_missing_spec
erlc
erlc -o ebin +warn_missing_spec foo.erl
如果您使用钢筋,请添加warn_missing_spec到erl_opts:
erl_opts
{erl_opts, [warn_missing_spec]}.