From 8f61286241a1a453216fa33a43c8dc94bc6789a8 Mon Sep 17 00:00:00 2001 From: Oksana Shadura Date: Tue, 17 May 2022 20:18:11 +0200 Subject: [PATCH] Add other usefull pre-commit hooks suggested by scikit-hep --- .pre-commit-config.yaml | 35 +++++++++++++++++++++++++++++++---- pyproject.toml | 1 + setup.cfg | 2 ++ 3 files changed, 34 insertions(+), 4 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 6d3a2813..c38f8521 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -33,13 +33,40 @@ repos: rev: v1.6.0 hooks: - id: autopep8 -- repo: https://github.com/PyCQA/flake8 +- repo: https://github.com/pycqa/flake8 rev: 4.0.1 hooks: - id: flake8 + additional_dependencies: [flake8-bugbear, flake8-import-order, flake8-print] +- repo: https://github.com/psf/black + rev: stable + hooks: + - id: black + +- repo: https://github.com/asottile/blacken-docs + rev: v1.12.1 + hooks: + - id: blacken-docs +- repo: https://github.com/pycqa/isort + rev: 5.6.4 + hooks: + - id: isort + args: ["--profile", "black"] +- repo: https://github.com/codespell-project/codespell + rev: v2.1.0 + hooks: + - id: codespell + args: ["-L", "coffea_casa", "tests", "docs/*rst"] - repo: https://github.com/pre-commit/mirrors-mypy - rev: v0.950 + rev: v0.942 hooks: - id: mypy - additional_dependencies: [types-all] - exclude: ^testing/resources/ \ No newline at end of file + name: mypy with Python 3.7 + files: coffea_casa + additional_dependencies: ["dask", "distributed"] + args: ["--python-version=3.7"] + - id: mypy + name: mypy with Python 3.9 + files: coffea_casa + additional_dependencies: ["dask", "distributed"] + args: ["--python-version=3.9"] \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml index 3531c7ce..f1af60e8 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -35,6 +35,7 @@ show_error_codes = true show_error_context = true no_implicit_optional = true ignore_missing_imports = true +enable_error_code = ["ignore-without-code", "redundant-expr", "truthy-bool"] # pyproject.toml [tool.pytest.ini_options] diff --git a/setup.cfg b/setup.cfg index c8dc700e..c38333f6 100644 --- a/setup.cfg +++ b/setup.cfg @@ -25,6 +25,8 @@ ignore = E741, # Too long lines (still not ready for it) E501 +# extend-ignore uses flake8's default ignore list, and adds to it +extend-ignore = E203, E501 max-line-length = 120 [versioneer]