diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 57bafd2416..ba9bf87df2 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -4,6 +4,15 @@ default_stages: [commit, manual] repos: + - repo: https://github.com/astral-sh/ruff-pre-commit + # Ruff version. + rev: v0.0.277 + hooks: + - id: ruff + name: "ruff on kedro/, tests/ and docs/" + args: ["--fix", "--exit-non-zero-on-fix"] + exclude: "^kedro/templates/|^features/steps/test_starter/" + - repo: https://github.com/pre-commit/pre-commit-hooks rev: v2.2.3 hooks: @@ -48,26 +57,6 @@ repos: additional_dependencies: [black~=22.0] entry: blacken-docs --skip-errors - - repo: https://github.com/astral-sh/ruff-pre-commit - # Ruff version. - rev: v0.0.277 - hooks: - - id: ruff - name: "ruff on kedro/" - args: ["--fix", "--show-fixes", "--exit-non-zero-on-fix"] - exclude: "^kedro/templates/|^features/steps/test_starter/|tests|docs" - - repo: https://github.com/astral-sh/ruff-pre-commit - # Ruff version. - rev: v0.0.277 - hooks: - - id: ruff - name: "ruff on tests/ and docs/" - # PLR2004: Magic value used - # PLR0913: Too many arguments - args: ["--fix", "--show-fixes", "--exit-non-zero-on-fix", "--ignore=PLR2004,PLR0913"] - # include: "tests" - exclude: "^kedro/templates/|^features/steps/test_starter/|kedro" - - repo: local hooks: - id: black diff --git a/docs/source/conf.py b/docs/source/conf.py index 804bbbbfa9..4519143968 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -464,7 +464,7 @@ def autolink_classes_and_methods(lines): lines[i] = re.sub(existing, rf"{replacement}", lines[i]) -def autodoc_process_docstring(app, what, name, obj, options, lines): +def autodoc_process_docstring(app, what, name, obj, options, lines): # noqa: PLR0913 try: # guarded method to make sure build never fails log_suggestions(lines, name) diff --git a/kedro/framework/cli/micropkg.py b/kedro/framework/cli/micropkg.py index 36d103a332..f42ea0edbf 100644 --- a/kedro/framework/cli/micropkg.py +++ b/kedro/framework/cli/micropkg.py @@ -1,5 +1,5 @@ """A collection of CLI commands for working with Kedro micro-packages.""" -# ruff: noqa: I001 # https://github.com/kedro-org/kedro/pull/2634 +# ruff: noqa: I001 from __future__ import annotations import logging diff --git a/pyproject.toml b/pyproject.toml index df3bf4a2fe..0421e10093 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -206,14 +206,18 @@ ignore_imports = [ [tool.ruff] line-length = 88 show-fixes = true -# select = ["A", "B", "C", "E", "F", "G", "I", "N", "Q", "S", "T", "W", "ARG", "BLE", "COM", "DJ", "DTZ", "EM", "ERA", "EXE", "FBT", "ICN", "INP", "ISC", "NPY", "PD", "PGH", "PIE", "PL", "PT", "PTH", "PYI", "RET", "RSE", "RUF", "SIM", "SLF", "TCH", "TID", "TRY", "UP", "YTT"] select = [ - "F", # Pyflakes - "E", # Pycodestyle - "W", # Pycodestyle + "F", # Pyflakes + "W", # pycodestyle + "E", # pycodestyle + "I", # isort "UP", # pyupgrade - "I", # isort - "PL", # Pylint + "PL", # Pylint ] -ignore = ["E501"] # Black take care off line-too-long -unfixable = [] +ignore = ["E501"] # Black takes care of line-too-long + +[tool.ruff.isort] +known-first-party = ["kedro"] + +[tool.ruff.per-file-ignores] +"{tests,docs}/*" = ["PLR2004","PLR0913"]