From 917af7ec7daf985249c8edf19ed2e175e6a485d8 Mon Sep 17 00:00:00 2001 From: Andrea Leopardi Date: Mon, 21 Oct 2024 12:53:15 +0200 Subject: [PATCH] Add "make format" and check formatting in CI (#41) --- CONTRIBUTING.md | 8 +++++++- Makefile | 5 +++++ rebar.config | 3 ++- 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 8bf3345..625dc3e 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -27,13 +27,19 @@ Compile the project and [run the test suite](#testing) to check everything works make all ``` - ## Testing ```shell make test ``` +## Formatting + +To format the codebase: + +```shell +make format +``` ## Releasing diff --git a/Makefile b/Makefile index c537955..17f8bc5 100644 --- a/Makefile +++ b/Makefile @@ -47,4 +47,9 @@ gh-pages: $(REBAR) test doc .PHONY: test test: $(REBAR) all @$(REBAR) eunit + @$(REBAR) fmt --check @$(REBAR) dialyzer + +.PHONY: format +format: build + @$(REBAR) fmt diff --git a/rebar.config b/rebar.config index 0e6e7e9..b74e041 100644 --- a/rebar.config +++ b/rebar.config @@ -31,5 +31,6 @@ {erlfmt, [ write, - {print_width, 140} + {print_width, 140}, + {exclude_files, ["include/DNS-ASN1.hrl", "src/DNS-ASN1.erl"]} ]}.