From 9cb1dc9161ddad2384bea1b8ef42e152d90da626 Mon Sep 17 00:00:00 2001 From: Rambaud Pierrick <12rambau@users.noreply.github.com> Date: Fri, 29 Dec 2023 17:09:29 +0000 Subject: [PATCH] fix: reduce number of commit hooks to minimum --- .pre-commit-config.yaml | 72 ++++++++++++++++------------------------- pyproject.toml | 26 +++++++++++++-- 2 files changed, 51 insertions(+), 47 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 25ccac2..0c770af 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,59 +1,41 @@ -ci: - autoupdate_schedule: monthly - autoupdate_commit_msg: "chore: update pre-commit hooks" - repos: - - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.5.0 + - repo: "https://github.com/psf/black" + rev: "22.3.0" hooks: - - id: check-case-conflict - - id: check-ast - - id: check-docstring-first - - id: check-executables-have-shebangs - - id: check-added-large-files - - id: check-case-conflict - - id: check-merge-conflict - - id: check-json - - id: check-toml - - id: check-yaml - - id: debug-statements - - id: end-of-file-fixer - - id: trailing-whitespace + - id: black - - repo: https://github.com/python-jsonschema/check-jsonschema - rev: 0.27.1 + - repo: "https://github.com/kynan/nbstripout" + rev: "0.5.0" hooks: - - id: check-github-workflows + - id: nbstripout - - repo: https://github.com/executablebooks/mdformat - rev: 0.7.17 + - repo: "https://github.com/pre-commit/mirrors-prettier" + rev: "v2.7.1" hooks: - - id: mdformat + - id: prettier + exclude: tests\/test_.+\. - - repo: https://github.com/pre-commit/mirrors-prettier - rev: "v3.0.3" + - repo: https://github.com/charliermarsh/ruff-pre-commit + rev: "v0.0.215" hooks: - - id: prettier - types_or: [yaml, html, json] + - id: ruff - - repo: https://github.com/codespell-project/codespell - rev: "v2.2.6" + - repo: https://github.com/PyCQA/doc8 + rev: "v1.1.1" hooks: - - id: codespell - args: ["-L", "sur,nd"] + - id: doc8 - - repo: https://github.com/pre-commit/pygrep-hooks - rev: "v1.10.0" + - repo: https://github.com/codespell-project/codespell + rev: v2.2.4 hooks: - - id: rst-backticks - - id: rst-directive-colons - - id: rst-inline-touching-normal + - id: codespell + stages: [commit] + additional_dependencies: + - tomli - - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.1.5 + # Prevent committing inline conflict markers + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: v4.3.0 hooks: - - id: ruff - types_or: [python, jupyter] - args: ["--fix", "--show-fixes"] - - id: ruff-format - types_or: [python, jupyter] + - id: check-merge-conflict + args: [--assume-in-merge] diff --git a/pyproject.toml b/pyproject.toml index 1570155..048fde8 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -103,5 +103,27 @@ filterwarnings = [ "module:datetime.datetime.utc:DeprecationWarning" ] -[tool.repo-review] -ignore = ["GH102", "MY100", "RF001", "PY007", "GH103", "PC140"] +[tool.ruff] +ignore-init-module-imports = true +fix = true +select = ["E", "F", "W", "I", "D", "RUF"] +ignore = [ + "E501", # line too long | Black take care of it + "W605", # invalid escape sequence | we escape specific characters for sphinx + "D212", # Multi-line docstring | we use a different convention, too late + "D101", # Missing docstring in public class | we use a different convention, too late +] + +[tool.ruff.flake8-quotes] +docstring-quotes = "double" + +[tool.ruff.pydocstyle] +convention = "google" + +[tool.black] +line-length = 100 + +[tool.doc8] +ignore = [ + "D001" # we follow a 1 line = 1 paragraph style +]