diff --git a/README.md b/README.md index 0d66db6..097354a 100644 --- a/README.md +++ b/README.md @@ -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) diff --git a/docs/src/10-how-to-contribute.md b/docs/src/10-how-to-contribute.md new file mode 100644 index 0000000..bd737d5 --- /dev/null +++ b/docs/src/10-how-to-contribute.md @@ -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`. diff --git a/docs/src/SUMMARY.md b/docs/src/SUMMARY.md index e481b50..4690eb6 100644 --- a/docs/src/SUMMARY.md +++ b/docs/src/SUMMARY.md @@ -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)