Skip to content

Commit

Permalink
readme: add cabal-fmt to pre-commit hook
Browse files Browse the repository at this point in the history
  • Loading branch information
qaristote authored Dec 13, 2022
1 parent dc3351a commit b106397
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ different projects.

### Code formatting

We format our code using [ormolu](https://github.com/tweag/ormolu) (more specifically the version from [NixOS/nixpkgs](https://github.com/NixOS/nixpkgs)'s master branch). It is thus recommended to add the following script as your `.git/hooks/pre-commit`:
We format our code using [ormolu](https://github.com/tweag/ormolu) (more specifically the version from [NixOS/nixpkgs](https://github.com/NixOS/nixpkgs)'s master branch). The `.cabal` files are formatted using [`cabal-fmt`](https://github.com/phadej/cabal-fmt). It is thus recommended to add the following script as your `.git/hooks/pre-commit`:
```
#!/usr/bin/env bash
set -e
Expand All @@ -60,4 +60,5 @@ do
ormolu --command ormolu --mode inplace "$(pwd)/$sourceFilePath"
git add $sourceFilePath
done;
cabal-fmt --inplace $(find . -name '*.cabal')
```

0 comments on commit b106397

Please sign in to comment.