Assert that Ormolu is formatted with current version of Ormolu
commitc386de89bd7b507d4dcdccfca2e9a65e99d9f87c
authormrkkrp <mark.karpov@tweag.io>
dateTue 27 Aug 2019, 17:41 (7 years ago)
parent368b2da
.circleci/config.yml+5
@@ -29,6 +29,11 @@ jobs:
2929 - run:
3030 name: Build the package (includes running the tests)
3131 command: nix-build --keep-going
32+ - run:
33+ name: Check formatting
34+ command: |
35+ ./format.sh
36+ git diff --exit-code --color=always
3237 - run:
3338 name: Generate Haddocks
3439 command: nix-build --attr ormolu.doc
CONTRIBUTING.md+5
@@ -55,5 +55,10 @@ User settings -> Account integrations -> Refresh permissions
5555
5656in Circle CI app.
5757
58+## Formatting
59+
60+Use `format.sh` script to format Ormolu with current version of Ormolu. If
61+Ormolu is not formatted like this, the CI will fail.
62+
5863[issues]: https://github.com/tweag/ormolu/issues
5964[bugs]: https://github.com/tweag/ormolu/issues?q=is%3Aissue+is%3Aopen+label%3Abug
default.nix+1
@@ -41,6 +41,7 @@ let
4141 }) haskellPackages;
4242in {
4343 ormolu = haskellPackages.ormolu;
44+ locales = pkgs.glibcLocales;
4445 ormoluShell = haskellPackages.shellFor {
4546 packages = ps: [ ps.ormolu ];
4647 buildInputs = [ haskellPackages.cabal-install haskellPackages.ghcid ];
format.shnew file+10
@@ -0,0 +1,10 @@
1+#!/usr/bin/env bash
2+#
3+# Format Ormolu using current version of Ormolu.
4+
5+set -e
6+
7+export LANG="en_US.UTF-8"
8+
9+nix run -f default.nix ormolu locales -c ormolu --mode inplace $(find src -type f \( -name "*.hs" -o -name "*.hs-boot" \))
10+nix run -f default.nix ormolu locales -c ormolu --mode inplace $(find tests -type f -name "*.hs")