From 02249d03d086e71a589733280a2f5e32990f72b1 Mon Sep 17 00:00:00 2001 From: Bryan Newbold Date: Wed, 27 Oct 2021 15:08:58 -0700 Subject: update lint, fmt, make settings --- .flake8 | 15 ++++++++++++--- Makefile | 9 +++++++-- pyproject.toml | 3 +++ 3 files changed, 22 insertions(+), 5 deletions(-) create mode 100644 pyproject.toml diff --git a/.flake8 b/.flake8 index dc2d3eb..96345cd 100644 --- a/.flake8 +++ b/.flake8 @@ -1,6 +1,15 @@ [flake8] select = C,E,F,W,ANN -ignore = F405,F403,W503,E231,E203,E501,E226,E711,E713,E265,ANN101,ANN204,ANN102 -max-complexity = 25 +# ANN003 is annotation on, eg, **kwargs +# ANN101 is annotation on 'self' +# ANN204 is annotation on '__init__()' +# E265,E266 are restrictions on comments ('#') +# E501 is line-too-long, which we enforce with black +# W503,E203 are allowed by black +ignore = ANN003,ANN101,ANN204,E265,E266,E501,W503,E203 +per-file-ignores = + fatcat_scholar/__init__.py: F401 + tests/*.py: ANN201,ANN001,F403,F405 exclude = .git,__pycache__,.venv -max-line-length = 120 +max-line-length = 88 +max-complexity = 30 diff --git a/Makefile b/Makefile index b790d54..dbccc7e 100644 --- a/Makefile +++ b/Makefile @@ -16,12 +16,17 @@ dep: ## Install dependencies using pipenv .PHONY: lint lint: ## Run lints (eg, flake8, mypy) pipenv run flake8 fatcat_scholar/ tests/ --exit-zero + pipenv run isort -q -c fatcat_scholar/ tests/ || true pipenv run mypy fatcat_scholar/ tests/ --ignore-missing-imports - #pipenv run pytype fatcat_scholar/ + +.PHONY: pytype +pytype: ## Run slow pytype type check (not part of dev deps) + pipenv run pytype fatcat_scholar/ .PHONY: fmt fmt: ## Run code formating on all source code - pipenv run black fatcat_scholar/ tests/ + pipenv run isort --atomic fatcat_scholar/ tests/ + pipenv run black --line-length 88 fatcat_scholar/ tests/ .PHONY: test test: ## Run all tests and lints diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..e1d02b6 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,3 @@ +[tool.isort] +profile = "black" +line_length = 88 -- cgit v1.2.3