Skip to content

Commit

Permalink
Merge pull request #48 from anton-k/contribute-guide
Browse files Browse the repository at this point in the history
adds contribution guide
  • Loading branch information
anton-k authored Oct 21, 2023
2 parents 38f9186 + 6c29d86 commit 1c7ac5a
Show file tree
Hide file tree
Showing 3 changed files with 62 additions and 2 deletions.
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,6 @@ So I wanted to create something in the middle. Something composable and simple
at the same time.
The name `mig` (pronounced as meeg) is a russian word for "instant moment".

* For quick start guide see [tutorial](https://anton-k.github.io/mig/)
* For summary of the main functions see [docs](https://anton-k.github.io/mig/08-reference.html)
* Quick start guide: [tutorial](https://anton-k.github.io/mig/)
* Summary of the main functions: [refs](https://anton-k.github.io/mig/09-reference.html)
* How to contribute: [guide](https://anton-k.github.io/mig/10-how-to-contribute.html)
58 changes: 58 additions & 0 deletions docs/src/10-how-to-contribute.md
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`.
1 change: 1 addition & 0 deletions docs/src/SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@
- [HTML example: blog site](./07-blog-post-example.md)
- [Clients](./08-client.md)
- [Reference](./09-reference.md)
- [How to contribute](./10-how-to-contribute.md)

0 comments on commit 1c7ac5a

Please sign in to comment.