-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: setup git hooks to run linter for you
By using git hooks, you can make sure your code is linted and formatted as expected. Added docs to readme for how to install these hooks. commit-id:8d6cc4bc
- Loading branch information
1 parent
76d4567
commit a3a5151
Showing
2 changed files
with
22 additions
and
0 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,17 @@ | ||
# Configuration for lefthook tool to manage git hooks | ||
# https://github.com/evilmartians/lefthook | ||
|
||
# Commands to run before committing code. | ||
pre-commit: | ||
commands: | ||
lint: | ||
# Format code and then `git add` modified files from formatter. | ||
run: task format && git add {staged_files} | ||
|
||
# Commands to run before pushing code | ||
pre-push: | ||
commands: | ||
lint: | ||
# Run linter giving you errors to fix. | ||
# By using `|| echo "..."`, we do not block you from pushing code. Running lint in a git hooks is to warn you about lint errors early, but not block you from pushing code with errors if you decide to push. | ||
run: task lint || echo -e "\n\n ⚠️ Linting contains errors that will prevent you from merging a pull request. Fix errors above if you are planning on making a pull request." |