Skip to content

Commit 9335bfa

Browse files
committed
style: update ruff configs
style: update ruff formatting and lint configs
1 parent 60763be commit 9335bfa

File tree

5 files changed

+97
-89
lines changed

5 files changed

+97
-89
lines changed

.pre-commit-config.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ repos:
2020
- id: trailing-whitespace
2121

2222
- repo: https://github.com/astral-sh/ruff-pre-commit
23-
rev: "v0.12.7"
23+
rev: "v0.12.11"
2424
hooks:
2525
- id: ruff-check
2626
args: [ --fix, --exit-non-zero-on-fix ]
@@ -41,3 +41,5 @@ repos:
4141
entry: uvx toml-sort --in-place --all pyproject.toml
4242
language: system
4343
files: ^pyproject.toml$
44+
45+
minimum_pre_commit_version: 4.3.0

pyproject.toml

Lines changed: 65 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@ dev = [
99
"mkdocs>=1.6",
1010
"mkdocstrings[python]>=0.30",
1111
"mypy>=1.17",
12-
"pre-commit>=3.8",
12+
"pre-commit>=4.3",
1313
"pytest-cov>=4.1",
1414
"pytest>=7.4",
15-
"ruff>=0.12",
15+
"ruff==0.12.11",
1616
"tox-uv>=1.28"
1717
]
1818

@@ -108,75 +108,81 @@ markers = [
108108
testpaths = ["tests"]
109109

110110
[tool.ruff]
111+
exclude = [
112+
"bin",
113+
"docs",
114+
"sbin"
115+
]
111116
fix = true
112117
line-length = 100
113118
src = ["src", "tests"]
114-
target-version = "py39"
115119

116120
[tool.ruff.format]
117121
docstring-code-format = true
118-
preview = true
119-
quote-style = "double"
120122

121123
[tool.ruff.lint]
122-
fixable = [
123-
"B",
124-
"C4",
125-
"D",
126-
"EM",
127-
"F401",
128-
"F541",
129-
"I",
130-
"PERF",
131-
"PIE",
132-
"PT",
133-
"RET",
134-
"RSE",
135-
"RUF",
136-
"SIM",
137-
"UP"
138-
]
139124
ignore = [
140-
"E111",
141-
"E114",
142-
"E117",
143-
"E501",
144-
"E731",
145-
"PLR0913",
146-
"S321",
147-
"W191"
148-
]
149-
select = [
150-
"A", # https://docs.astral.sh/ruff/rules/#flake8-builtins-a
151-
"ARG", # https://docs.astral.sh/ruff/rules/#flake8-unused-arguments-arg
152-
"B", # https://docs.astral.sh/ruff/rules/#flake8-bugbear-b
153-
"C4", # https://docs.astral.sh/ruff/rules/#flake8-comprehensions-c4
154-
"DTZ", # https://docs.astral.sh/ruff/rules/#flake8-datetimez-dtz
155-
"E",
156-
"EM", # https://docs.astral.sh/ruff/rules/#flake8-errmsg-em
157-
"F", # https://docs.astral.sh/ruff/rules/#pyflakes-f
158-
"G", # https://docs.astral.sh/ruff/rules/#flake8-logging-format-g
159-
"I", # https://docs.astral.sh/ruff/rules/#isort-i
160-
"LOG", # https://docs.astral.sh/ruff/rules/#flake8-logging-log
161-
"N", # https://docs.astral.sh/ruff/rules/#pep8-naming-n
162-
"PERF", # https://docs.astral.sh/ruff/rules/#perflint-perf
163-
"PIE", # https://docs.astral.sh/ruff/rules/#flake8-pie-pie
164-
"PL", # https://docs.astral.sh/ruff/rules/#pylint-pl
165-
"PT", # https://docs.astral.sh/ruff/rules/#flake8-pytest-style-pt
166-
"PTH", # https://docs.astral.sh/ruff/rules/#flake8-use-pathlib-pth
167-
"RET", # https://docs.astral.sh/ruff/rules/#flake8-return-ret
168-
"RSE", # https://docs.astral.sh/ruff/rules/#flake8-raise-rse
169-
"RUF", # https://docs.astral.sh/ruff/rules/#ruff-specific-rules-ruf
170-
"S", # https://docs.astral.sh/ruff/rules/#flake8-bandit-s
171-
"SIM", # https://docs.astral.sh/ruff/rules/#flake8-simplify-sim
172-
"TRY", # https://docs.astral.sh/ruff/rules/#tryceratops-try
173-
"UP", # https://docs.astral.sh/ruff/rules/#pyupgrade-up
174-
"W", # https://docs.astral.sh/ruff/rules/#pycodestyle-e-w
175-
"YTT" # https://docs.astral.sh/ruff/rules/#flake8-2020-ytt
125+
"AIR",
126+
"ANN002",
127+
"ANN003",
128+
"C90",
129+
"COM812", # ignore for compatibility with formatter
130+
"CPY",
131+
"D105",
132+
"D203",
133+
"D205",
134+
"D206",
135+
"D213", # conflicts with D212
136+
"D300", # ignore for compatibility with formatter
137+
"D400",
138+
"D401",
139+
"D403",
140+
"D415",
141+
"DJ",
142+
"E111", # ignore for compatibility with formatter
143+
"E114", # ignore for compatibility with formatter
144+
"E117", # ignore for compatibility with formatter
145+
"E501", # ignore for compatibility with formatter
146+
"EM",
147+
"ERA",
148+
"EXE",
149+
"FA",
150+
"FAST",
151+
"FBT",
152+
"FIX",
153+
"INT",
154+
"NPY",
155+
"PD",
156+
"PGH003",
157+
"PLR0904", # subjective pylint threshold
158+
"PLR091", # subjective pylint threshold
159+
"PLR1702", # subjective pylint threshold
160+
"PYI",
161+
"RET504",
162+
"TC",
163+
"TD",
164+
"TID",
165+
"TRY003",
166+
"W191",
167+
"YTT"
176168
]
169+
select = ["ALL"]
170+
171+
[tool.ruff.lint.flake8-annotations]
172+
mypy-init-return = true
177173

178174
[tool.ruff.lint.per-file-ignores]
179-
"tests/*" = ["S101"]
175+
"tests/*" = [
176+
"ANN001",
177+
"ANN2",
178+
"B011",
179+
"BLE001",
180+
"D10",
181+
"D100",
182+
"INP001",
183+
"S101",
184+
"SLF001"
185+
]
180186

181187
[tool.setuptools]
182188
include-package-data = true

src/biocommons/example/__main__.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
_logger = logging.getLogger(__name__)
99

1010

11-
def main(): # pragma: no cover
11+
def main() -> None: # pragma: no cover
1212
"""marvin.example main"""
1313
import coloredlogs # noqa: PLC0415
1414

@@ -22,8 +22,8 @@ def main(): # pragma: no cover
2222
quote = marvin.get_quote()
2323
_logger.warning("Got quote from Marvin (len=%s)", len(quote))
2424

25-
print("Marvin says:")
26-
print(quote)
25+
print("Marvin says:") # noqa: T201
26+
print(quote) # noqa: T201
2727

2828

2929
if __name__ == "__main__":

src/biocommons/example/marvin_adjacent_test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@
33
from .marvin import get_quote
44

55

6-
def test_get_quote():
6+
def test_get_quote() -> None:
77
"""test get_quote"""
88
assert get_quote() is not None # noqa: S101

uv.lock

Lines changed: 25 additions & 25 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)