Skip to content

Commit

Permalink
Newer ruff + minor linter tweaks.
Browse files Browse the repository at this point in the history
  • Loading branch information
Julian committed Jul 8, 2024
1 parent 949964e commit 26c472f
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 22 deletions.
8 changes: 0 additions & 8 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,6 @@ repos:
hooks:
- id: fmt
- id: clippy
- repo: https://github.com/PyCQA/isort
rev: 5.13.2
hooks:
- id: isort
- repo: https://github.com/asottile/pyupgrade
rev: v3.16.0
hooks:
- id: pyupgrade
- repo: https://github.com/psf/black
rev: 24.4.2
hooks:
Expand Down
11 changes: 10 additions & 1 deletion noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,16 @@ def style(session):
Check Python code style.
"""
session.install("ruff")
session.run("ruff", "check", ROOT)
session.run("ruff", "check", TESTS, __file__)


@session()
def typing(session):
"""
Check the codebase using pyright by type checking the test suite.
"""
session.install("pyright", ROOT, "-r", REQUIREMENTS["tests"])
session.run("pyright", TESTS)


@session(tags=["docs"])
Expand Down
21 changes: 8 additions & 13 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[build-system]
requires = ["maturin>=1.0,<2.0"]
requires = ["maturin>=1.2,<2.0"]
build-backend = "maturin"

[project]
Expand Down Expand Up @@ -64,15 +64,6 @@ ignore = [
"D001", # one sentence per line, so max length doesn't make sense
]

[tool.isort]
combine_as_imports = true
ensure_newline_before_comments = true
from_first = true
include_trailing_comma = true
multi_line_output = 3
known_first_party = ["rpds"]
use_parentheses = true

[tool.maturin]
features = ["pyo3/extension-module"]

Expand All @@ -86,13 +77,16 @@ exclude = [

[tool.ruff]
line-length = 79

[tool.ruff.lint]
select = ["ALL"]
ignore = [
"A001", # It's fine to shadow builtins
"A002",
"A003",
"ARG", # This is all wrong whenever an interface is involved
"ANN", # Just let the type checker do this
"B006", # Mutable arguments require care but are OK if you don't abuse them
"B008", # It's totally OK to call functions for default arguments.
"B904", # raise SomeException(...) is fine.
"B905", # No need for explicit strict, this is simply zip's default behavior
Expand All @@ -112,7 +106,6 @@ ignore = [
"EM102",
"FBT", # It's worth avoiding boolean args but I don't care to enforce it
"FIX", # Yes thanks, if I could it wouldn't be there
"I001", # We can't yet use ruff's isort
"N", # These naming rules are silly
"PLR0912", # These metrics are fine to be aware of but not to enforce
"PLR0913",
Expand All @@ -130,17 +123,19 @@ ignore = [
"TD", # These TODO style rules are also silly
"UP007", # We support 3.8 + 3.9
]

[tool.ruff.lint.flake8-pytest-style]
mark-parentheses = false

[tool.ruff.flake8-quotes]
[tool.ruff.lint.flake8-quotes]
docstring-quotes = "double"

[tool.ruff.lint.isort]
combine-as-imports = true
from-first = true
known-first-party = ["rpds"]

[tool.ruff.per-file-ignores]
[tool.ruff.lint.per-file-ignores]
"noxfile.py" = ["ANN", "D100", "S101", "T201"]
"docs/*" = ["ANN", "D", "INP001"]
"tests/*" = ["ANN", "B018", "D", "PLR", "RUF012", "S", "SIM", "TRY"]

0 comments on commit 26c472f

Please sign in to comment.