From e8072ce06e1cb869f0914fa01df778fa10e6b4e0 Mon Sep 17 00:00:00 2001 From: Henry Schreiner Date: Thu, 26 Oct 2023 09:59:59 -0400 Subject: [PATCH] chore: prepare for ruff-format (#2773) Signed-off-by: Henry Schreiner --- .pre-commit-config.yaml | 8 +------- pyproject.toml | 14 ++++++-------- 2 files changed, 7 insertions(+), 15 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index b17142d4f0..abd4bb79cd 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -21,12 +21,6 @@ repos: - id: name-tests-test args: ["--pytest-test-first"] -- repo: https://github.com/asottile/setup-cfg-fmt - rev: v2.5.0 - hooks: - - id: setup-cfg-fmt - args: [--include-version-classifiers, --max-py-version=3.11] - - repo: https://github.com/psf/black-pre-commit-mirror rev: 23.10.0 hooks: @@ -39,7 +33,7 @@ repos: additional_dependencies: [pyyaml] - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.1.1 + rev: v0.1.2 hooks: - id: ruff args: ["--fix", "--show-fixes"] diff --git a/pyproject.toml b/pyproject.toml index f8302b017d..17bdb683c0 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -257,6 +257,8 @@ ignore_errors = true ignore_missing_imports = true [tool.ruff] +typing-modules = ["awkward._typing"] +src = ["src"] extend-exclude = [ "studies", "pybind11", @@ -264,6 +266,7 @@ extend-exclude = [ "docs-*", "src/awkward/_typeparser/generated_parser.py", ] +[tool.ruff.lint] select = [ "E", "F", "W", # flake8 "B", "B904", # flake8-bugbear @@ -282,7 +285,7 @@ select = [ "NPY", # NumPy specific rules "TID251", # flake8-tidy-imports ] -extend-ignore = [ +ignore = [ "E501", # Line too long "UP030", # {0} -> {} "PLR", # Design related pylint codes @@ -292,8 +295,6 @@ extend-ignore = [ "PLW0603", # Using the global statement to update is discouraged "PLC1901", # x == "" can be simplified to not x (empty string is falsey) ] -typing-modules = ["awkward._typing"] -src = ["src"] unfixable = [ "T20", # Removes print statements "F841", # Removes unused variables @@ -301,7 +302,7 @@ unfixable = [ external = [] mccabe.max-complexity = 100 -[tool.ruff.per-file-ignores] +[tool.ruff.lint.per-file-ignores] "dev/*" = ["T20", "TID251"] "src/awkward/numba/*" = ["TID251"] "src/awkward/_errors.py" = ["TID251"] @@ -315,10 +316,7 @@ mccabe.max-complexity = 100 "src/awkward/_operators.py" = ["TID251"] "tests*/*" = ["T20", "TID251"] -[tool.ruff.flake8-tidy-imports.banned-api] +[tool.ruff.lint.flake8-tidy-imports.banned-api] "numpy".msg = "Use `numpy = ak._nplikes.Numpy.instance()` instead" "jax".msg = "Use `jax = ak._nplikes.Jax.instance()` instead" "cupy".msg = "Use `cupy = ak._nplikes.Cupy.instance()` instead" - -[tool.nbqa.addopts] -pyupgrade = ["--py38-plus"]