From 9c2c937abc8db9b5a673410930ea7640506ee1dd Mon Sep 17 00:00:00 2001 From: Zevaryx Date: Sat, 16 Mar 2024 22:34:16 -0600 Subject: [PATCH] [fix] Update pre-commit --- .pre-commit-config.yaml | 72 +++++++++++++--------------- pyproject.toml | 102 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 135 insertions(+), 39 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 04dd85d..2313a2a 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,49 +1,43 @@ repos: - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.1.0 + rev: v4.5.0 hooks: - - id: check-toml - - id: check-yaml - args: [--unsafe] - - id: check-merge-conflict - id: requirements-txt-fixer - - id: end-of-file-fixer + name: Requirements + types: [file] + exclude_types: ["image"] - id: debug-statements - language_version: python3.10 + name: Debugging + language: python + types: [file, python] + exclude_types: ["image"] - id: trailing-whitespace - args: [--markdown-linebreak-ext=md] - - - repo: https://github.com/pre-commit/pygrep-hooks - rev: v1.9.0 + name: Trailing Whitespace + language: python + types: [file] + exclude_types: ["image", "binary", "executable"] + - id: end-of-file-fixer + name: EOF Newlines + language: python + types: [file] + exclude_types: ["image", "binary", "executable"] + - id: check-yaml + name: YAML Structure + language: python + args: ["--unsafe"] + - id: check-toml + name: TOML Structure + - id: check-merge-conflict + name: Merge Conflicts + - repo: https://github.com/astral-sh/ruff-pre-commit + rev: "v0.2.2" hooks: - - id: python-check-blanket-noqa - + - id: ruff + args: [--fix, --exit-non-zero-on-fix] - repo: https://github.com/psf/black - rev: 22.3.0 + rev: 24.2.0 hooks: - id: black - args: [--line-length=120, --target-version=py310] - language_version: python3.10 - - - repo: https://github.com/pre-commit/mirrors-isort - rev: v5.10.1 - hooks: - - id: isort - args: ["--profile", "black"] - - - repo: https://github.com/pycqa/flake8 - rev: 4.0.1 - hooks: - - id: flake8 - additional_dependencies: - - flake8-annotations~=2.0 - #- flake8-bandit~=2.1 - - flake8-docstrings~=1.5 - - flake8-bugbear - - flake8-comprehensions - - flake8-quotes - - flake8-raise - - flake8-deprecated - - flake8-print - - flake8-return - language_version: python3.10 + name: Black Formatting + language: python + types: [file, python] diff --git a/pyproject.toml b/pyproject.toml index a2852b3..b97fd4f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -47,3 +47,105 @@ black = "^23.1.0" [build-system] requires = ["poetry-core>=1.0.0"] build-backend = "poetry.core.masonry.api" + +[tool.pytest.ini_options] +minversion = "8.0" +testpaths = ["tests"] +addopts = "--cov=spamback --cov-report term --cov-report xml:coverage.xml" + +[tool.black] +line-length = 120 + +[tool.isort] +profile = "black" +skip = ["__init__.py"] + +[tool.mypy] +ignore_missing_imports = true + +[tool.pyright] +useLibraryCodeForTypes = true +reportMissingImports = false + +[tool.ruff] +line-length = 120 +target-version = "py312" +output-format = "full" + +[tool.ruff.lint] +task-tags = ["TODO", "FIXME", "XXX", "HACK", "REVIEW", "NOTE"] +select = ["E", "F", "B", "Q", "RUF", "D", "ANN", "RET", "C"] +ignore-init-module-imports = true +ignore = [ + "Q0", + "E501", + # These default to arguing with Black. We might configure some of them eventually + "ANN1", + # These insist that we have Type Annotations for self and cls. + "D105", + "D107", + # Missing Docstrings in magic method and __init__ + "D401", + # First line should be in imperative mood; try rephrasing + "D400", + "D415", + # First line should end with a period + "D106", + # Missing docstring in public nested class. This doesn't work well with Metadata classes. + "D417", + # Missing argument in the docstring + "D406", + # Section name should end with a newline + "D407", + # Missing dashed underline after section + "D212", + # Multi-line docstring summary should start at the first line + "D404", + # First word of the docstring should not be This + "D203", + # 1 blank line required before class docstring + + # Everything below this line is something we care about, but don't currently meet + "ANN001", + # Missing type annotation for function argument 'token' + "ANN002", + # Missing type annotation for *args + "ANN003", + # Missing type annotation for **kwargs + "ANN401", + # Dynamically typed expressions (typing.Any) are disallowed + # "B009", + # Do not call getattr with a constant attribute value, it is not any safer than normal property access. + "B010", + # Do not call setattr with a constant attribute value, it is not any safer than normal property access. + "D100", + # Missing docstring in public module + "D101", + # ... class + "D102", + # ... method + "D103", + # ... function + "D104", + # ... package + + # Plugins we don't currently include: flake8-return + "RET503", + # missing explicit return at the end of function ableto return non-None value. + "RET504", + # unecessary variable assignement before return statement. +] + +[tool.ruff.lint.flake8-quotes] +docstring-quotes = "double" + +[tool.ruff.lint.flake8-annotations] +mypy-init-return = true +suppress-dummy-args = true +suppress-none-returning = true + +[tool.ruff.lint.flake8-errmsg] +max-string-length = 20 + +[tool.ruff.lint.mccabe] +max-complexity = 13