Skip to content

Commit a0968e7

Browse files
authored
Add erlfmt (#10)
(I was forced to upgrade to a more recent OTP version).
1 parent e6dbc2a commit a0968e7

File tree

6 files changed

+39
-14
lines changed

6 files changed

+39
-14
lines changed

.gitignore

+5-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
_build
2-
rebar3
3-
deps
41
*.dump
5-
log
62
sys.config
3+
4+
# rebar 3
5+
rebar3
6+
.rebar3
7+
/_build

.tool-versions

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
erlang 22.0
1+
erlang 27.1.1

Makefile

+15-7
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,29 @@
11
REBAR:=$(shell which rebar3 || echo ./rebar3)
22
REBAR_URL:="https://s3.amazonaws.com/rebar3/rebar3"
33

4-
all: clean build
4+
all: build
55

66
$(REBAR):
77
wget $(REBAR_URL) && chmod +x rebar3
88

9+
.PHONY: build
910
build: $(REBAR)
10-
$(REBAR) get-deps
11-
$(REBAR) compile
11+
@$(REBAR) compile
1212

13+
.PHONY: clean
1314
clean: $(REBAR)
1415
rm -Rf deps
15-
$(REBAR) clean
16+
@$(REBAR) clean
1617

17-
test: $(REBAR)
18-
$(REBAR) test
18+
.PHONY: test
19+
test: $(REBAR) all
20+
@$(REBAR) test
21+
@$(REBAR) fmt --check
1922

23+
.PHONY: fresh
2024
fresh:
21-
rm -Rf _build
25+
rm -rf _build
26+
27+
.PHONY: format
28+
format: build
29+
@$(REBAR) fmt

README.md

+8
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,14 @@ For example, simply add
5959
```
6060
to your lager handler config.
6161

62+
## Formatting
63+
64+
To format the codebase:
65+
66+
```shell
67+
make format
68+
```
69+
6270
## Thanks
6371

6472
Thank you to Ken Pratt: his library https://github.com/kenpratt/erlbrake provided a lot of code for this library.

rebar.config

+4
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,7 @@
88
jsx
99
]}.
1010

11+
{erlfmt, [
12+
write,
13+
{print_width, 140}
14+
]}.

rebar.lock

+6-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
1-
{"1.1.0",
1+
{"1.2.0",
22
[{<<"goldrush">>,{pkg,<<"goldrush">>,<<"0.1.9">>},1},
33
{<<"jsx">>,{pkg,<<"jsx">>,<<"2.10.0">>},0},
44
{<<"lager">>,{pkg,<<"lager">>,<<"3.8.0">>},0}]}.
55
[
66
{pkg_hash,[
77
{<<"goldrush">>, <<"F06E5D5F1277DA5C413E84D5A2924174182FB108DABB39D5EC548B27424CD106">>},
88
{<<"jsx">>, <<"77760560D6AC2B8C51FD4C980E9E19B784016AA70BE354CE746472C33BEB0B1C">>},
9-
{<<"lager">>, <<"3402B9A7E473680CA179FC2F1D827CAB88DD37DD1E6113090C6F45EF05228A1C">>}]}
9+
{<<"lager">>, <<"3402B9A7E473680CA179FC2F1D827CAB88DD37DD1E6113090C6F45EF05228A1C">>}]},
10+
{pkg_hash_ext,[
11+
{<<"goldrush">>, <<"99CB4128CFFCB3227581E5D4D803D5413FA643F4EB96523F77D9E6937D994CEB">>},
12+
{<<"jsx">>, <<"9A83E3704807298016968DB506F9FAD0F027DE37546EB838B3AE1064C3A0AD62">>},
13+
{<<"lager">>, <<"F6CB541B688EAB60730D8D286EB77256A5A9AD06EAC10D43BEAF55D07E68BBB6">>}]}
1014
].

0 commit comments

Comments
 (0)