Commit 02e30ca6 authored by Aarni Koskela's avatar Aarni Koskela
Browse files

Upgrade Ruff + configure formatting

parent fd723b78
repos: repos:
- repo: https://github.com/astral-sh/ruff-pre-commit - repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.2.0 rev: v0.3.2
hooks: hooks:
- id: ruff - id: ruff
args: args:
- --fix - --fix
# - id: ruff-format # TODO: enable when the time is right - id: ruff-format
- repo: https://github.com/pre-commit/pre-commit-hooks - repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0 rev: v4.5.0
hooks: hooks:
......
...@@ -8,6 +8,10 @@ src = [ ...@@ -8,6 +8,10 @@ src = [
"tests", "tests",
"benchmarking" "benchmarking"
] ]
target-version = "py38"
line-length = 119
[tool.ruff.lint]
select = [ select = [
"B", # bugbear: security warnings "B", # bugbear: security warnings
"E", # pycodestyle "E", # pycodestyle
...@@ -17,7 +21,6 @@ select = [ ...@@ -17,7 +21,6 @@ select = [
"UP", # alert you when better syntax is available in your python version "UP", # alert you when better syntax is available in your python version
"RUF", # the ruff developer's own rules "RUF", # the ruff developer's own rules
] ]
target-version = "py38"
ignore = [ ignore = [
"B007", # Loop control variable not used within the loop body (TODO: enable) "B007", # Loop control variable not used within the loop body (TODO: enable)
"B028", # Warning without stacklevel (TODO: enable) "B028", # Warning without stacklevel (TODO: enable)
...@@ -30,7 +33,7 @@ ignore = [ ...@@ -30,7 +33,7 @@ ignore = [
] ]
ignore-init-module-imports = true # allow to expose in __init__.py via imports ignore-init-module-imports = true # allow to expose in __init__.py via imports
[tool.ruff.extend-per-file-ignores] [tool.ruff.lint.extend-per-file-ignores]
"**/__init__.py" = ["F401"] # allow unused imports in __init__.py "**/__init__.py" = ["F401"] # allow unused imports in __init__.py
"{benchmarking,tests}/**/*.py" = [ "{benchmarking,tests}/**/*.py" = [
"B007", "B007",
...@@ -42,7 +45,7 @@ ignore-init-module-imports = true # allow to expose in __init__.py via imports ...@@ -42,7 +45,7 @@ ignore-init-module-imports = true # allow to expose in __init__.py via imports
"UP030", "UP030",
] ]
[tool.ruff.isort] [tool.ruff.lint.isort]
combine-as-imports = true combine-as-imports = true
detect-same-package = true detect-same-package = true
force-sort-within-sections = true force-sort-within-sections = true
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment