Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade ruff and drop black #417

Merged
merged 3 commits into from
Aug 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 2 additions & 5 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,9 @@ repos:
- id: check-added-large-files
- id: debug-statements
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.3.3
rev: v0.6.2
hooks:
- id: ruff
args: [--fix, --exit-non-zero-on-fix]
exclude: docs\/.*
- repo: https://github.com/psf/black
rev: "24.3.0"
hooks:
- id: black
- id: ruff-format
2 changes: 2 additions & 0 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
#
from __future__ import annotations

import os
import sys
from pathlib import Path
Expand Down
4 changes: 2 additions & 2 deletions payments/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,8 @@ def get_payment_model():
payment_model = apps.get_model(app_label, model_name)
if payment_model is None:
msg = (
'PAYMENT_MODEL refers to model "%s" that has not been installed'
% settings.PAYMENT_MODEL
f'PAYMENT_MODEL refers to model "{settings.PAYMENT_MODEL}"'
" that has not been installed"
)
raise ImproperlyConfigured(msg)
return payment_model
2 changes: 1 addition & 1 deletion payments/coinbase/test_coinbase.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ def test_incorrect_data_process_data(self):
def test_provider_returns_checkout_url(self, mocked_post, mocked_time):
code = "123abc"
signature = "21d476eff7b2e6cccdfe6deb0c097ba638d5de7e775b303e4fdb2f8bfeff72e2"
url = "https://sandbox.coinbase.com/checkouts/%s" % code
url = f"https://sandbox.coinbase.com/checkouts/{code}"
post = MagicMock()
post.json = MagicMock(return_value={"button": {"code": code}})
post.status_code = 200
Expand Down
2 changes: 1 addition & 1 deletion payments/sofort/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ def refund(self, payment, amount=None):
"holder": sender_data["holder"],
"bic": sender_data["bic"],
"iban": sender_data["iban"],
"title": "Refund %s" % payment.description,
"title": f"Refund {payment.description}",
"transaction_id": payment.transaction_id,
"amount": amount,
"comment": "User requested a refund",
Expand Down
8 changes: 5 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,9 @@ DJANGO_SETTINGS_MODULE = "test_settings"
pythonpath = "."

[tool.ruff]
target-version = "py38"

[tool.ruff.lint]
select = [
"F",
"E",
Expand Down Expand Up @@ -120,16 +123,15 @@ select = [
"PLE",
"RUF",
]
target-version = "py38"
ignore = [
"RUF012", # FIXME
]

[tool.ruff.isort]
[tool.ruff.lint.isort]
force-single-line = true
required-imports = ["from __future__ import annotations"]

[tool.ruff.per-file-ignores]
[tool.ruff.lint.per-file-ignores]
# Fails with auto-generated migrations. Unsolvable contradiction between ruff and mypy.
# This likely needs to be addressed in Django itself (either use an immutable
# type or annotate these fields as ClassVar)
Expand Down
1 change: 1 addition & 0 deletions testapp/manage.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#!/usr/bin/env python
"""Django's command-line utility for administrative tasks."""

from __future__ import annotations

import os
Expand Down
Loading