hotdog/scripts/lint

28 lines
591 B
Bash
Executable file

#!/bin/sh -e
autoflake_opts='
--remove-duplicate-keys
--remove-unused-variables
--remove-all-unused-imports
--ignore-init-module-imports
'
if [ "$1" = '--fix' ]; then
(
set -x
autoflake --in-place --recursive $autoflake_opts .
black .
isort --profile black .
mypy . || : # ignore
)
exit
fi
error=0
(set -x; autoflake --check --recursive $autoflake_opts . | uniq) || error=$?
(set -x; black --check .) || error=$?
(set -x; isort --profile black --check .) || error=$?
(set -x; mypy .) || : # ignore
exit "$error"