precommit

This commit is contained in:
Joel Falknau 2025-03-03 14:15:39 +10:00
parent 15fc38ccfd
commit 9547826272
No known key found for this signature in database
10 changed files with 13 additions and 15 deletions

View File

@ -24,16 +24,22 @@ exclude: |
repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.8.1
rev: v0.9.9
hooks:
# Run the linter, and only the linter
- id: ruff
- repo: https://github.com/adamchainz/django-upgrade
rev: 1.22.2
rev: 1.23.1
hooks:
- id: django-upgrade
args: [--target-version=4.2]
args: [--target-version=5.1]
- repo: https://github.com/asottile/pyupgrade # Ruff doesnt get everything.
rev: v3.19.1
hooks:
- id: pyupgrade
args: [--py310-plus]
# Formatting
- repo: https://github.com/pre-commit/pre-commit-hooks

View File

@ -126,7 +126,7 @@ class UserProfile(models.Model):
self.save(update_fields=['state'])
notify(
self.user,
_('State changed to: {}'.format(state)),
_(f'State changed to: {state}'),
_('Your user\'s state is now: %(state)s')
% ({'state': state}),
'info'

View File

@ -1,4 +1,3 @@
from django.db.models.signals import post_save
from django.test.testcases import TestCase

View File

@ -175,9 +175,9 @@ def add_character(request, token):
if CharacterOwnership.objects.filter(character__character_id=token.character_id).filter(
owner_hash=token.character_owner_hash).filter(user=request.user).exists():
messages.success(request, _(
'Added {name} to your account.'.format(name=token.character_name)))
f'Added {token.character_name} to your account.'))
else:
messages.error(request, _('Failed to add {name} to your account: they already have an account.'.format(name=token.character_name)))
messages.error(request, _(f'Failed to add {token.character_name} to your account: they already have an account.'))
return redirect('authentication:dashboard')

View File

@ -1,5 +1,3 @@
from django.conf import settings
from django.contrib.auth.models import Group, User
from django.db import models

View File

@ -1,4 +1,3 @@
from django.contrib.auth.models import User
from django.db import models

View File

@ -112,7 +112,7 @@ def jabber_broadcast_view(request):
OpenfireManager.send_broadcast_message(group_to_send, message_to_send)
messages.success(request, _('Sent Jabber broadcast to {}'.format(group_to_send)))
messages.success(request, _(f'Sent Jabber broadcast to {group_to_send}'))
logger.info(f"Sent Jabber broadcast on behalf of user {request.user}")
except PingBotException as e:
messages.error(request, e)

View File

@ -1,4 +1,3 @@
from django.contrib.auth.models import Group, Permission, User
from django.db.models.signals import m2m_changed, post_save, pre_save
from django.test import TestCase

View File

@ -1,4 +1,3 @@
from django.contrib.auth.models import Group, Permission, User
from django.test import TestCase

View File

@ -1,5 +1,3 @@
class ThemeHook:
"""
Theme hook for injecting a Bootstrap 5 Theme and associated JS into alliance auth.