hotdog/scripts/lint

28 lines
561 B
Text
Raw Permalink Normal View History

2020-11-01 16:31:37 +01:00
#!/bin/sh -e
autoflake_opts='
--remove-duplicate-keys
--remove-unused-variables
--remove-all-unused-imports
--ignore-init-module-imports
'
2020-11-01 16:31:37 +01:00
if [ "$1" = '--fix' ]; then
2020-11-08 01:17:33 +01:00
(
set -x
autoflake --in-place --recursive $autoflake_opts .
2020-11-08 01:17:33 +01:00
black .
isort --profile black .
)
exit
2020-11-01 16:31:37 +01:00
fi
2020-11-08 01:17:33 +01:00
error=0
(set -x; autoflake --check --recursive $autoflake_opts . | uniq) || error=$?
2020-11-08 01:17:33 +01:00
(set -x; black --check .) || error=$?
(set -x; isort --profile black --check .) || error=$?
2020-11-08 10:35:26 +01:00
(set -x; mypy .) || : # ignore
2020-11-08 01:17:33 +01:00
exit "$error"