-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #48 from anton-k/contribute-guide
adds contribution guide
- Loading branch information
Showing
3 changed files
with
62 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
# How to contribute | ||
|
||
If you are interested in contribution to library that's great. | ||
We have a list of upcoming features in the [list of Issues](https://github.com/anton-k/mig/issues). | ||
|
||
Also there is a CI which checks for: | ||
|
||
* build and test of all libraries with stack | ||
* build and test of all examples in the dir `examples` with stack | ||
* fourmolu formatting | ||
|
||
## how to automate formatter check | ||
|
||
To check for formatting I recommend to use this pre-commit hook: | ||
|
||
```bash | ||
#!/bin/bash | ||
|
||
if command -v fourmolu &> /dev/null | ||
then | ||
files=$(git diff --staged --name-only -- '*.hs') | ||
for file in $files | ||
do | ||
fourmolu -i $file | ||
git add $file | ||
done | ||
else | ||
echo "fourmolu cannot be found" | ||
echo "install fourmolu via cabal install" | ||
fi | ||
|
||
if command -v cabal-fmt &> /dev/null | ||
then | ||
files=$(git diff --staged --diff-filter=ACMR --name-only -- '*.cabal') | ||
for file in $files | ||
do | ||
cabal-fmt --inplace --no-tabular $file | ||
git add $file | ||
done | ||
else | ||
echo "cabal-fmt cannot be found" | ||
fi | ||
``` | ||
|
||
Save this as file `.git/hooks/pre-commit` in your repo. | ||
and make it executable: | ||
|
||
```sh | ||
chmod +x .git/hooks/pre-commit | ||
``` | ||
|
||
The script requires two executables which both can be installed from hackage: | ||
|
||
* `fourmolu` | ||
* `cabal-fmt` | ||
|
||
After that all files that you modify will be formatted properly. | ||
Formatting settings are in the file `fourmolu.yaml`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters