apache / couchdb-erlfdb

Erlang API for FoundationDB
https://www.foundationdb.org
Apache License 2.0
28 stars 20 forks source link

Format code using erlfmt #33

Closed kocolosk closed 2 years ago

kocolosk commented 2 years ago

This PR adds erlfmt as a plugin so you can execute rebar3 fmt and then applies the results of rebar3 fmt -w. I put an %% erlfmt-ignore over a couple of functions where I felt that the hand-crafted style was much better (e.g. places where we had dozens of function clauses, and the extra line between each clause significantly improved readability).

I checked that erlfmt did not change the actual compiled output by manually running the following command for every source file. After temporarily adjusting ?NOT_LOADED in erlfdb_nif to omit the ?LINE info I got agreement across the board in src/:

compile:file("old_src/erlfdb.erl", [deterministic, binary, no_line_info]) =:= compile:file("src/erlfdb.erl", [deterministic, binary, no_line_info]).