Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pre-commit hook #618

Merged
merged 2 commits into from
Jan 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -108,4 +108,4 @@ profile = "black"
[build-system]

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