Skip to content

Commit

Permalink
New hook poetry-run (#47)
Browse files Browse the repository at this point in the history
  • Loading branch information
ls-andreas-koschinsky authored Dec 16, 2022
1 parent 1116781 commit 5c448c1
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 0 deletions.
7 changes: 7 additions & 0 deletions .pre-commit-hooks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,13 @@
language: script
pass_filenames: false
always_run: true
- id: poetry-run
name: General poetry run command
description: Use poetry to run any check command
entry: ls_pre_commit_hooks/poetry-run.sh
language: script
pass_filenames: false
always_run: true
- id: pylint
name: pylint
description: pylint - It's not just a linter that annoys you!
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ All hooks are defined in [.pre-commit-hooks-yaml](.pre-commit-hooks-yaml). For f
- `google-java-code-format`
- `isort`: Python import sorting
- `poetry-pytest`: Use poetry to create a virtual-env and run pytest
- `poetry-run`: Use poetry to run any check command (pyright, pylint, ...)
- `shellcheck`
- `shfmt`
- `yamllint`
Expand Down
9 changes: 9 additions & 0 deletions ls_pre_commit_hooks/poetry-run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/bash -e

if ! which -s poetry; then
echo 'poetry command not found'
echo 'See https://python-poetry.org/docs/#installation for installation instructions.'
exit 1
fi

poetry run "$@"

0 comments on commit 5c448c1

Please sign in to comment.