From 8f9c34f80931187e48c243be56a32954c2d7cfca Mon Sep 17 00:00:00 2001 From: Baptiste Pasquier Date: Mon, 15 Apr 2024 16:59:42 +0200 Subject: [PATCH] Update pre-commit hooks and Ruff configuration --- .pre-commit-config.yaml | 25 +++++++--------- pyproject.toml | 66 ++++++++--------------------------------- 2 files changed, 23 insertions(+), 68 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index b7b65ac..eb2011d 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -7,22 +7,17 @@ repos: - id: check-toml - id: check-json - id: check-added-large-files - - repo: local + + - repo: https://github.com/astral-sh/ruff-pre-commit + rev: v0.3.1 hooks: - - id: isort - name: Sorting imports (isort) - entry: isort - types: [python] - language: system - id: ruff - name: Linting (ruff) - entry: ruff --fix - types: [python] - language: system + args: [ --fix ] + - id: ruff-format + + - repo: https://github.com/kynan/nbstripout + rev: 0.7.1 + hooks: - id: nbstripout - name: Strip Jupyter notebook output (nbstripout) - entry: nbstripout - types: [file] - files: (.ipynb)$ - language: system + exclude: ^(.svn|CVS|.bzr|.hg|.git|__pycache__|.tox|.ipynb_checkpoints|assets|tests/assets/|venv/|.venv/) diff --git a/pyproject.toml b/pyproject.toml index f9644a8..ca0497f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -20,64 +20,24 @@ requires-python = ">=3.8" packages = ["lib", "config", "tests"] [tool.ruff] +target-version = "py310" + +[tool.ruff.lint] select = [ - "E", - "W", - "F", - "I", - "N", - "Q", - "PTH", - "PD", -] # See: https://beta.ruff.rs/docs/rules/ + "E", # pycodestyle + "W", # pycodestyle + "F", # Pyflakes + "I", # isort + "N", # pep8-naming + "Q", # flake8-quotes + "PTH", # flake8-use-pathlib + "PD", # pandas-vet +] # See: https://docs.astral.sh/ruff/rules/ ignore = ["D100", "D103", "D203", "D213", "ANN101", "ANN102"] -line-length = 140 -target-version = "py310" -exclude = [ - ".bzr", - ".direnv", - ".eggs", - ".git", - ".ruff_cache", - ".svn", - ".tox", - ".venv", - "__pypackages__", - "_build", - "buck-out", - "build", - "dist", - "node_modules", - "venv", -] -[tool.ruff.pydocstyle] +[tool.ruff.lint.pydocstyle] convention = "google" -# https://black.readthedocs.io/en/stable/usage_and_configuration/the_basics.html -[tool.black] -line-length = 100 -target-version = ["py310"] -include = '\.pyi?$' -exclude = ''' -( - /( - \.direnv - | \.eggs - | \.git - | \.tox - | \.venv - | _build - | build - | dist - | venv - )/ -) -''' - -[tool.isort] -profile = "black" - [tool.bandit] exclude_dirs = [".venv", "tests"] skips = ["B101", "B104"]