From 4f9be9bfc01fe12a82dfe6c828d550aeed201afc Mon Sep 17 00:00:00 2001 From: Ian Hunt-Isaak Date: Wed, 12 Apr 2023 15:04:16 -0400 Subject: [PATCH] update precommit --- .pre-commit-config.yaml | 31 +++++++++---------------------- pyproject.toml | 35 +++++++++++++++++++++++++++++++++++ 2 files changed, 44 insertions(+), 22 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 782cc34..65afead 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -2,24 +2,24 @@ ci: autoupdate_schedule: "quarterly" repos: - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.3.0 + rev: v4.4.0 hooks: - id: check-docstring-first - id: end-of-file-fixer - id: trailing-whitespace - repo: https://github.com/psf/black - rev: 22.8.0 + rev: 23.3.0 hooks: - id: black - repo: https://github.com/pycqa/isort - rev: 5.10.1 + rev: 5.12.0 hooks: - id: isort - repo: https://github.com/nbQA-dev/nbQA - rev: 1.5.2 + rev: 1.7.0 hooks: - id: nbqa-black - id: nbqa-isort @@ -30,25 +30,12 @@ repos: - id: nbstripout - repo: https://github.com/pre-commit/mirrors-prettier - rev: v3.0.0-alpha.0 + rev: v3.0.0-alpha.6 hooks: - id: prettier - - repo: https://github.com/PyCQA/flake8 - rev: 5.0.4 + - repo: https://github.com/charliermarsh/ruff-pre-commit + rev: v0.0.256 hooks: - - id: flake8 - additional_dependencies: [flake8-typing-imports==1.7.0] - - - repo: https://github.com/PyCQA/autoflake - rev: v1.6.1 - hooks: - - id: autoflake - args: - [ - "--exclude=mpl_interactions/ipyplot.py", - "--in-place", - "--remove-all-unused-imports", - "--ignore-init-module-imports", - "--remove-unused-variables", - ] + - id: ruff + args: [--fix] diff --git a/pyproject.toml b/pyproject.toml index 5f0b1ac..13e419d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -28,3 +28,38 @@ addopts = [ "--mpl", "--nbval", ] + + +# https://github.com/charliermarsh/ruff +[tool.ruff] +line-length = 88 +target-version = "py38" +extend-select = [ + "E", # style errors + "F", # flakes + "D", # pydocstyle + "I001", # isort + "U", # pyupgrade + # "N", # pep8-naming + # "S", # bandit + "C", # flake8-comprehensions + "B", # flake8-bugbear + "A001", # flake8-builtins + "RUF", # ruff-specific rules + "M001", # Unused noqa directive +] +extend-ignore = [ + "D100", # Missing docstring in public module + "D107", # Missing docstring in __init__ + "D203", # 1 blank line required before class docstring + "D212", # Multi-line docstring summary should start at the first line + "D213", # Multi-line docstring summary should start at the second line + "D413", # Missing blank line after last section + "D416", # Section name should end with a colon +] + + +[tool.ruff.per-file-ignores] +"tests/*.py" = ["D"] +"__init__.py" = ["E402"] +"docs/conf.py" = ["A001", "C901", "D200", "D400", "D415"]