Skip to content

Commit

Permalink
Merge pull request #238 from MightyCreak/chore/add-git-hooks
Browse files Browse the repository at this point in the history
chore: add pre-commit git hooks to run linters
  • Loading branch information
MightyCreak authored Aug 24, 2024
2 parents 2876332 + e4eca4d commit d631dc1
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 0 deletions.
19 changes: 19 additions & 0 deletions .githooks/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/bin/bash

set -e

txtred='\e[0;31m'
txtbld='\e[1m'
txtrst='\e[0m'

if ! flake8 src/ po/
then
echo -e "${txtred}${txtbld}Linter error(s) from flake8${txtrst}"
exit 1
fi

if ! mypy src/ po/
then
echo -e "${txtred}${txtbld}Linter error(s) from mypy${txtrst}"
exit 1
fi
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Translation: update Portuguese translation (@hugok79)
- Translation: add 'nl' in LINGUAS (@hugok79)
- Update pypi packages (@MightyCreak)
- Add pre-commit git hooks to run linters (@MightyCreak)

## 0.9.0 - 2024-01-13

Expand Down
10 changes: 10 additions & 0 deletions docs/developers/developers-setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,16 @@ Diffuse depends on these projects:
* Meson
* Flatpak and Flatpak builder (Linux only)

### Install git hooks (optional)

There is a pre-commit git hook that runs some linters on the source code before committing.

To install the git hooks (for the repository only), run this command:

```sh
git config --local core.hooksPath ./.githooks
```

## Install the dependencies

### Install the system dependencies
Expand Down

0 comments on commit d631dc1

Please sign in to comment.