diff --git a/lint.sh b/lint.sh new file mode 100755 index 00000000..69fb32f7 --- /dev/null +++ b/lint.sh @@ -0,0 +1,16 @@ +#!/usr/bin/env bash +set -e + +find . -name "*.py[co]" -o -name __pycache__ -exec rm -rf {} + +#rm -rf .mypy_cache + +echo "> isort" +isort --gitignore --settings-file=setup.cfg . +echo "> brunette" +brunette --config=setup.cfg . +echo "> flake8" +flake8 --config=setup.cfg . +echo "> mypy" +mypy --config-file=setup.cfg . +echo "> prettyjson" +python3 -m scripts.prettyjson diff --git a/requirements-dev.txt b/requirements-dev.txt new file mode 100755 index 00000000..d221f3b0 --- /dev/null +++ b/requirements-dev.txt @@ -0,0 +1,4 @@ +isort +brunette +flake8 +mypy diff --git a/setup.cfg b/setup.cfg new file mode 100755 index 00000000..588918a1 --- /dev/null +++ b/setup.cfg @@ -0,0 +1,39 @@ +[isort] +# https://github.com/PyCQA/isort +line_length = 120 +multi_line_output = 3 +include_trailing_comma = true +force_grid_wrap = 0 +use_parentheses = true +force_alphabetical_sort = false + +[tool:brunette] +# https://github.com/odwyersoftware/brunette +line-length = 120 +single-quotes = false + +[flake8] +# https://github.com/PyCQA/flake8 +exclude = .git,__pycache__,.mypy_cache,.vercel +max-line-length = 120 +max-complexity = 15 +select = B,C,E,F,W,T4,B9 +# E203: Whitespace before ':' +# E266: Too many leading '#' for block comment +# E501: Line too long (82 > 79 characters) +# E722: Do not use bare except, specify exception instead +# W503: Line break occurred before a binary operator +# F403: 'from module import *' used; unable to detect undefined names +# C901: Function is too complex +ignore = E203,E266,E501,E722,W503,F403,C901 + +[mypy] +# https://github.com/python/mypy +ignore_missing_imports = true +warn_return_any = false +warn_unused_configs = true +disallow_untyped_calls = true +disallow_untyped_defs = true +disallow_incomplete_defs = true +[mypy-api.*] +ignore_errors = true