Skip to content

Commit

Permalink
Merge pull request #618 from lbiaggi/pre-commit-hook
Browse files Browse the repository at this point in the history
Pre-commit hook
  • Loading branch information
neerdoc committed Jan 26, 2024
2 parents 4326c38 + ddbe061 commit eec59a5
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 1 deletion.
20 changes: 20 additions & 0 deletions .pre-commit-hooks.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# expected stages: commit, commit-msg, manual, merge-commit, post-checkout, post-commit, post-merge, post-rewrite, prepare-commit-msg, push

- id: check-doorstop-errors
args: ["-W"]
name: check for doorstop errors
description: ensures the changes introduces no errors
entry: doorstop
language: python
verbose: true
pass_filenames: false
stages: [commit, push, manual]

- id: check-unreviewed-items
name: ensure that all requirements are reviewed before being committed
description: ensure that all documents/requirements are reviewed before being committed
entry: git_hooks/check_unreviewed_requirements.sh
language: script
verbose: true
pass_filenames: false
stages: [merge-commit, manual]
8 changes: 8 additions & 0 deletions git_hooks/check_unreviewed_requirements.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/usr/bin/env bash

output="$(doorstop -W 2>&1 | grep 'unreviewed changes')"

if [ -n "$output" ]; then
echo "$output"
exit 1
fi
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -110,4 +110,4 @@ profile = "black"
[build-system]

requires = ["poetry>=0.12"]
build-backend = "poetry.masonry.api"
build-backend = "poetry.core.masonry.api"

0 comments on commit eec59a5

Please sign in to comment.