aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar MarkKoz <[email protected]>2020-03-04 20:37:58 -0800
committerGravatar MarkKoz <[email protected]>2021-01-09 19:14:42 -0800
commitb9181f440d97bc092e535675a1550e5abb5113e8 (patch)
treecf18685aa90fb205b8e9fe0021c35a746aa75426
parentInstall pep8-naming (diff)
Add more pre-commit hooks
Hooks added: * check-merge-conflict - checks for files with merge conflict strings * check-toml - attempts to load all toml files to verify syntax * check-yaml - attempts to load all yaml files to verify syntax * end-of-file-fixer - ensures files end in a newline and only a newline * mixed-line-ending - replaces mixed line endings with LF * trailing-whitespace - trims trailing whitespace * python-check-blanket-noqa - enforces that noqa annotations always occur with specific codes See: python-discord/organisation#138
-rw-r--r--.pre-commit-config.yaml15
-rw-r--r--Pipfile2
-rwxr-xr-xscripts/dev.sh1
3 files changed, 17 insertions, 1 deletions
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index b7cf9ee..33921bd 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -1,4 +1,19 @@
repos:
+ - repo: https://github.com/pre-commit/pre-commit-hooks
+ rev: v3.4.0
+ hooks:
+ - id: check-merge-conflict
+ - id: check-toml
+ - id: check-yaml
+ - id: end-of-file-fixer
+ - id: mixed-line-ending
+ args: [--fix=lf]
+ - id: trailing-whitespace
+ args: [--markdown-linebreak-ext=md]
+ - repo: https://github.com/pre-commit/pygrep-hooks
+ rev: v1.6.0
+ hooks:
+ - id: python-check-blanket-noqa
- repo: local
hooks:
- id: flake8
diff --git a/Pipfile b/Pipfile
index 655bda2..0b65853 100644
--- a/Pipfile
+++ b/Pipfile
@@ -29,7 +29,7 @@ pydocstyle = "~= 5.1"
python_version = "3.9"
[scripts]
-lint = "flake8"
+lint = "pre-commit run --all-files"
precommit = "pre-commit install"
test = "sh scripts/dev.sh -c 'pipenv run coverage run -m unittest'"
testb = """
diff --git a/scripts/dev.sh b/scripts/dev.sh
index f9cd28e..3f94874 100755
--- a/scripts/dev.sh
+++ b/scripts/dev.sh
@@ -24,6 +24,7 @@ if [ "$1" = "--build" ]; then
if [ -n "${dangling_imgs}" ]; then
printf "Removing dangling images..."
+ # shellcheck disable=SC2086
docker rmi $dangling_imgs >/dev/null \
&& printf " done!\n" || exit "$?"
fi