From f68c8ea4881ebb4ba2e69bf26012b64662404743 Mon Sep 17 00:00:00 2001 From: Alex Tomkins Date: Thu, 26 Mar 2026 20:25:13 +0000 Subject: [PATCH 1/3] Update editorconfig --- .editorconfig | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.editorconfig b/.editorconfig index cc8c24e..6c5964a 100644 --- a/.editorconfig +++ b/.editorconfig @@ -14,8 +14,12 @@ charset = utf-8 [*.py] max_line_length = 99 -# Smaller indent for YAML -[*.{yaml,yml}] +# Smaller indent for TOML/YAML +[*.{toml,yaml,yml}] +indent_size = 2 + +# Use 2 spaces for the HTML files +[*.html] indent_size = 2 # Makefiles always use tabs for indentation From 2e995e6ec6f3ed6b24cdb8ba636154de2fae95d1 Mon Sep 17 00:00:00 2001 From: Alex Tomkins Date: Thu, 26 Mar 2026 20:26:43 +0000 Subject: [PATCH 2/3] Tidy pyproject.toml --- pyproject.toml | 54 +++++++++++++++++++++++++------------------------- 1 file changed, 27 insertions(+), 27 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index a5f0012..c63078a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -6,24 +6,24 @@ readme = 'README.md' maintainers = [{ name = 'The Developer Society', email = 'studio@dev.ngo' }] requires-python = '>= 3.10' dependencies = [ - 'Django>=3.2', + 'Django>=3.2', ] classifiers = [ - 'Intended Audience :: Developers', - 'License :: OSI Approved :: BSD License', - 'Operating System :: OS Independent', - 'Programming Language :: Python', - 'Programming Language :: Python :: 3', - 'Programming Language :: Python :: 3.10', - 'Programming Language :: Python :: 3.11', - 'Programming Language :: Python :: 3.12', - 'Framework :: Django', - 'Framework :: Django :: 3.2', - 'Framework :: Django :: 4.2', + 'Intended Audience :: Developers', + 'License :: OSI Approved :: BSD License', + 'Operating System :: OS Independent', + 'Programming Language :: Python', + 'Programming Language :: Python :: 3', + 'Programming Language :: Python :: 3.10', + 'Programming Language :: Python :: 3.11', + 'Programming Language :: Python :: 3.12', + 'Framework :: Django', + 'Framework :: Django :: 3.2', + 'Framework :: Django :: 4.2', ] [project.urls] -Homepage = "https://github.com/developersociety/django-findreplace" +Homepage = 'https://github.com/developersociety/django-findreplace' [build-system] requires = ['setuptools >= 61.0'] @@ -41,22 +41,22 @@ target-version = 'py310' [tool.ruff.lint] select = [ - 'F', # pyflakes - 'E', # pycodestyle - 'W', # pycodestyle - 'I', # isort - 'N', # pep8-naming - 'UP', # pyupgrade - 'S', # flake8-bandit - 'BLE', # flake8-blind-except - 'C4', # flake8-comprehensions - 'EM', # flake8-errmsg - 'T20', # flake8-print - 'RET', # flake8-return - 'RUF', # ruff + 'F', # pyflakes + 'E', # pycodestyle + 'W', # pycodestyle + 'I', # isort + 'N', # pep8-naming + 'UP', # pyupgrade + 'S', # flake8-bandit + 'BLE', # flake8-blind-except + 'C4', # flake8-comprehensions + 'EM', # flake8-errmsg + 'T20', # flake8-print + 'RET', # flake8-return + 'RUF', # ruff ] ignore = [ - 'EM101', # flake8-errmsg: raw-string-in-exception + 'EM101', # flake8-errmsg: raw-string-in-exception ] [tool.ruff.lint.isort] From cea4a84d0ff263a81ebdf66973dff71a0b6f8dbd Mon Sep 17 00:00:00 2001 From: Alex Tomkins Date: Thu, 26 Mar 2026 20:28:27 +0000 Subject: [PATCH 3/3] Upgrade ruff --- .github/matrix.py | 32 ++++---- .../management/commands/findreplace.py | 2 +- pyproject.toml | 74 +++++++++++++++---- requirements/testing.txt | 2 +- 4 files changed, 78 insertions(+), 32 deletions(-) diff --git a/.github/matrix.py b/.github/matrix.py index 17a63d3..34883f1 100644 --- a/.github/matrix.py +++ b/.github/matrix.py @@ -1,3 +1,4 @@ +# noqa:INP001 import fileinput import json import re @@ -9,21 +10,22 @@ def main(): actions_matrix = [] - for tox_env in fileinput.input(): - tox_env = tox_env.rstrip() - - if python_match := PY_VERSIONS_RE.match(tox_env): - version_tuple = python_match.groups() - else: - version_tuple = sys.version_info[0:2] - - python_version = "{}.{}".format(*version_tuple) - actions_matrix.append( - { - "python": python_version, - "tox_env": tox_env, - } - ) + with fileinput.input() as f: + for tox_env_line in f: + tox_env = tox_env_line.rstrip() + + if python_match := PY_VERSIONS_RE.match(tox_env): + version_tuple = python_match.groups() + else: + version_tuple = sys.version_info[0:2] + + python_version = "{}.{}".format(*version_tuple) + actions_matrix.append( + { + "python": python_version, + "tox_env": tox_env, + } + ) print(json.dumps(actions_matrix)) # noqa:T201 diff --git a/findreplace/management/commands/findreplace.py b/findreplace/management/commands/findreplace.py index fd9b3b4..659cfe7 100644 --- a/findreplace/management/commands/findreplace.py +++ b/findreplace/management/commands/findreplace.py @@ -65,6 +65,6 @@ def get_fields(self): for model in app.get_models(): for field in model._meta.get_fields(): if isinstance(field, models.CharField | models.TextField): - fields.append(field) + fields.append(field) # noqa:PERF401 return fields diff --git a/pyproject.toml b/pyproject.toml index c63078a..16584dd 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -40,23 +40,67 @@ line-length = 99 target-version = 'py310' [tool.ruff.lint] -select = [ - 'F', # pyflakes - 'E', # pycodestyle - 'W', # pycodestyle - 'I', # isort - 'N', # pep8-naming - 'UP', # pyupgrade - 'S', # flake8-bandit - 'BLE', # flake8-blind-except - 'C4', # flake8-comprehensions - 'EM', # flake8-errmsg - 'T20', # flake8-print - 'RET', # flake8-return - 'RUF', # ruff +extend-select = [ + 'ERA', # eradicate + 'YTT', # flake8-2020 + 'ASYNC', # flake8-async + 'S', # flake8-bandit + 'BLE', # flake8-blind-except + 'B', # flake8-bugbear + 'A', # flake8-builtins + 'COM', # flake8-commas + 'C4', # flake8-comprehensions + 'DTZ', # flake8-datetimez + 'T10', # flake8-debugger + 'DJ', # flake8-django + 'EM', # flake8-errmsg + 'EXE', # flake8-executable + 'FA', # flake8-future-annotations + 'INT', # flake8-gettext + 'ISC', # flake8-implicit-str-concat + 'ICN', # flake8-import-conventions + 'LOG', # flake8-logging + 'G', # flake8-logging-format + 'INP', # flake8-no-pep420 + 'PIE', # flake8-pie + 'T20', # flake8-print + 'PYI', # flake8-pyi + 'Q', # flake8-quotes + 'RSE', # flake8-raise + 'RET', # flake8-return + 'SLOT', # flake8-slots + 'SIM', # flake8-simplify + 'TID', # flake8-tidy-imports + 'TD', # flake8-todos + 'TCH', # flake8-type-checking + 'PTH', # flake8-use-pathlib + 'FLY', # flynt + 'I', # isort + 'NPY', # numpy-specific rules + 'PD', # pandas-vet + 'N', # pep8-naming + 'PERF', # perflint + 'E', # pycodestyle + 'W', # pycodestyle + 'F', # pyflakes + 'PGH', # pygrep-hooks + 'PLC', # pylint + 'PLE', # pylint + 'PLW', # pylint + 'UP', # pyupgrade + 'FURB', # refurb + 'RUF', # ruff-specific rules + 'TRY', # tryceratops ] ignore = [ - 'EM101', # flake8-errmsg: raw-string-in-exception + 'COM812', # flake8-commas: missing-trailing-comma + 'EM101', # flake8-errmsg: raw-string-in-exception + 'ISC001', # flake8-implicit-str-concat: single-line-implicit-string-concatenation + 'RUF012', # ruff-specific rules: mutable-class-default + 'SIM105', # flake8-simplify: suppressible-exception + 'SIM108', # flake8-simplify: if-else-block-instead-of-if-exp + 'TD002', # flake8-todos: missing-todo-author + 'TRY003', # tryceratops: raise-vanilla-args ] [tool.ruff.lint.isort] diff --git a/requirements/testing.txt b/requirements/testing.txt index 0679e5b..842404e 100644 --- a/requirements/testing.txt +++ b/requirements/testing.txt @@ -2,5 +2,5 @@ build==1.4.2 check-wheel-contents==0.6.3 coverage==7.13.5 pipdeptree==2.34.0 -ruff==0.8.4 +ruff==0.15.8 twine==6.2.0