哪些代码格式化程序可用于 Erlang?
What code formatters are available for Erlang?
我的 Erlang 代码需要一个好的格式化程序。有哪些选择?我希望格式化程序挂接到我的 rebar3
构建系统,并作为 post-hook 添加到 git.
一个选项是 erl_tidy,它是一个 rebar 插件:
https://github.com/tsloughter/erl_tidy
默认情况下它不会覆盖现有文件。相反,module.erl
变为 module.erl.bak
,但 AFAIR 可以对其进行配置。
你可以看看steamroller,也是一个rebar3插件。 Steamroller 是一种固执己见的自动格式化程序,类似于内置的 Elixir 格式化程序。与 erl_tidy
和 emacs erlang-mode
.
非常不同
最近出现了一堆格式化程序……
在 NextRoll,我们创建了 rebar3 format。这是一个可配置的格式化程序,仍在大力开发中,但已经可以使用了。
还有steamroller,比较自以为是
还有人在研究其他尚未 public 的格式化程序。
查看 this thread in the Elixir forum and this PR in the OTP repo。
如果你想要的是erlang-mode style of formatting, you may take a look at fenollp/erlang-formatter,可以作为rebar3插件使用,也可以在Makefile中使用。
有关详细信息,请参阅该存储库的自述文件。
我的 Erlang 代码需要一个好的格式化程序。有哪些选择?我希望格式化程序挂接到我的 rebar3
构建系统,并作为 post-hook 添加到 git.
一个选项是 erl_tidy,它是一个 rebar 插件:
https://github.com/tsloughter/erl_tidy
默认情况下它不会覆盖现有文件。相反,module.erl
变为 module.erl.bak
,但 AFAIR 可以对其进行配置。
你可以看看steamroller,也是一个rebar3插件。 Steamroller 是一种固执己见的自动格式化程序,类似于内置的 Elixir 格式化程序。与 erl_tidy
和 emacs erlang-mode
.
最近出现了一堆格式化程序……
在 NextRoll,我们创建了 rebar3 format。这是一个可配置的格式化程序,仍在大力开发中,但已经可以使用了。
还有steamroller,比较自以为是
还有人在研究其他尚未 public 的格式化程序。
查看 this thread in the Elixir forum and this PR in the OTP repo。
如果你想要的是erlang-mode style of formatting, you may take a look at fenollp/erlang-formatter,可以作为rebar3插件使用,也可以在Makefile中使用。
有关详细信息,请参阅该存储库的自述文件。