Added pre-commit hooks
This commit is contained in:
parent
50b6d038c3
commit
2fa9486db3
2 changed files with 20 additions and 0 deletions
16
README.md
16
README.md
|
@ -16,3 +16,19 @@ This app uses /l10n/ according to the official flutter
|
|||
We use [weblate](https://translate.codeberg.org/engage/outbag/) to manage translations.
|
||||
|
||||
[![Translation status](https://translate.codeberg.org/widget/outbag/outbag-app/multi-auto.svg)](https://translate.codeberg.org/engage/outbag/)
|
||||
|
||||
## Contributing
|
||||
To keep the code formatted properly,
|
||||
we use git hooks to format files before committing.
|
||||
|
||||
You can easily add git-hooks using the following command:
|
||||
``` sh
|
||||
git config core.hooksPath ./hooks
|
||||
```
|
||||
|
||||
Afterwards the `pre-commit` hook will automatically be run,
|
||||
when you commit your changes:
|
||||
``` sh
|
||||
git add # some files
|
||||
git commit
|
||||
```
|
||||
|
|
4
hooks/pre-commit
Executable file
4
hooks/pre-commit
Executable file
|
@ -0,0 +1,4 @@
|
|||
git_dir=$(git rev-parse --git-dir)
|
||||
project_dir=$(dirname $git_dir)
|
||||
|
||||
dart format $project_dir
|
Loading…
Reference in a new issue