diff --git a/.circleci/config.yml b/.circleci/config.yml index 0857ec024..e8b4779c5 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -109,10 +109,10 @@ jobs: test/io-tests.sh - run: name: run linter - command: git ls-files | grep '\.l\?hs$' | xargs stack exec -- hlint -X QuasiQuotes -X NoPatternSynonyms "$@" + command: make lint - run: name: run styler - command: git ls-files | grep '\.l\?hs$' | xargs stack exec -- stylish-haskell -i && git diff-index --exit-code HEAD -- '*.hs' '*.lhs' + command: make style build-test-9.6: docker: diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index 8bf344c3e..ae945792f 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -42,14 +42,13 @@ your contributions. * All contributions must pass the tests before being merged. When you create a pull request your code will automatically be tested. -* All code must also pass [hlint](http://community.haskell.org/~ndm/hlint/) - with no warnings. This helps enforce a uniform style for all - committers. Continuous integration will check this as well on every - pull request. +* All code must also pass [hlint](http://community.haskell.org/~ndm/hlint/) and [stylish-haskell](https://github.com/jaspervdj/stylish-haskell) + with no warnings. This helps enforce a uniform style for all committers. Continuous integration will check this as well on every + pull request. There's a useful Makefile that helps with checking this locally. You can run `make commit-check` to do this manually but + we recommend adding it to `.git/hooks/pre-commit` to automatically check this before doing a commit. * For help building the Haskell code on your computer check out the [building from -source](https://postgrest.com/en/stable/install.html#build-from-source) -wiki page. + source](https://postgrest.com/en/stable/install.html#build-from-source) docs section. ### Running Tests diff --git a/Makefile b/Makefile index 13c32a0ed..e2474c824 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,6 @@ -.PHONY: check clean lint style test test-watch coverage circleci circleci-prof-test check-dburi prompt-clean prompt-long-process +.PHONY: commit-check check clean lint style test test-watch coverage circleci circleci-prof-test check-dburi prompt-clean prompt-long-process + +commit-check: lint style check: lint style test @@ -9,8 +11,7 @@ lint: git ls-files | grep '\.l\?hs$$' | xargs stack exec -- hlint -X QuasiQuotes -X NoPatternSynonyms "$$@" style: - git ls-files | grep '\.l\?hs$$' | xargs stack exec -- stylish-haskell -i - + git ls-files | grep '\.l\?hs$$' | xargs stack exec -- stylish-haskell -i && git diff-index --exit-code HEAD -- '*.hs' '*.lhs' test: check-dburi stack test @@ -22,14 +23,12 @@ coverage: check-dburi clean stack build --coverage stack test --coverage - circleci: prompt-long-process circleci local execute --job build-test-9.4 circleci-prof-test: prompt-long-process circleci local execute --job build-prof-test - check-dburi: test -n "$(POSTGREST_TEST_CONNECTION)" # Requires POSTGREST_TEST_CONNECTION environmental variable