1
1
mirror of https://github.com/google/ormolu.git synced 2024-09-11 08:05:24 +03:00

Assert that Ormolu is formatted with current version of Ormolu

This commit is contained in:
mrkkrp 2019-08-27 17:41:12 +02:00 committed by Mark Karpov
parent 368b2da09b
commit c386de89bd
4 changed files with 21 additions and 0 deletions

View File

@ -29,6 +29,11 @@ jobs:
- run:
name: Build the package (includes running the tests)
command: nix-build --keep-going
- run:
name: Check formatting
command: |
./format.sh
git diff --exit-code --color=always
- run:
name: Generate Haddocks
command: nix-build --attr ormolu.doc

View File

@ -55,5 +55,10 @@ User settings -> Account integrations -> Refresh permissions
in Circle CI app.
## Formatting
Use `format.sh` script to format Ormolu with current version of Ormolu. If
Ormolu is not formatted like this, the CI will fail.
[issues]: https://github.com/tweag/ormolu/issues
[bugs]: https://github.com/tweag/ormolu/issues?q=is%3Aissue+is%3Aopen+label%3Abug

View File

@ -41,6 +41,7 @@ let
}) haskellPackages;
in {
ormolu = haskellPackages.ormolu;
locales = pkgs.glibcLocales;
ormoluShell = haskellPackages.shellFor {
packages = ps: [ ps.ormolu ];
buildInputs = [ haskellPackages.cabal-install haskellPackages.ghcid ];

10
format.sh Executable file
View File

@ -0,0 +1,10 @@
#!/usr/bin/env bash
#
# Format Ormolu using current version of Ormolu.
set -e
export LANG="en_US.UTF-8"
nix run -f default.nix ormolu locales -c ormolu --mode inplace $(find src -type f \( -name "*.hs" -o -name "*.hs-boot" \))
nix run -f default.nix ormolu locales -c ormolu --mode inplace $(find tests -type f -name "*.hs")