diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 5abbaf2e..5887c50c 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,6 +1,3 @@ -# TODO -# add a hook which automatically generates the OpenApi schema on API changes -# and places them in an appropriate location exclude: '(api|chat|control)/migrations/.*' repos: - repo: 'https://github.com/pre-commit/pre-commit-hooks' @@ -50,27 +47,20 @@ repos: files: ^mobile/ types_or: [javascript, jsx, ts, tsx, css, markdown, json] # uses https://github.com/pre-commit/identify entry: bash -c 'cd mobile && npm run format' - - id: isort - name: isort - stages: - - commit - - merge-commit - language: system - types: [python] - entry: isort - - id: black - name: black - stages: - - commit - - merge-commit - language: system - types: [python] - entry: black - - id: flake8 - name: flake8 - stages: - - commit - - merge-commit - language: system - types: [python] - entry: flake8 \ No newline at end of file + - repo: https://github.com/astral-sh/ruff-pre-commit + rev: v0.1.11 + hooks: + - id: ruff + stages: + - commit + - merge-commit + language: system + args: [ --fix ] + types: [python] + - id: ruff-format + stages: + - commit + - merge-commit + language: system + types: [python] + diff --git a/api/management/commands/telegram_watcher.py b/api/management/commands/telegram_watcher.py index efc57a04..40e3cb4c 100644 --- a/api/management/commands/telegram_watcher.py +++ b/api/management/commands/telegram_watcher.py @@ -11,7 +11,6 @@ from api.utils import get_session class Command(BaseCommand): - help = "Polls telegram /getUpdates method" rest = 3 # seconds between consecutive polls diff --git a/api/models/currency.py b/api/models/currency.py index 7ac957d3..b9713bc2 100644 --- a/api/models/currency.py +++ b/api/models/currency.py @@ -6,7 +6,6 @@ from django.utils import timezone class Currency(models.Model): - with open("frontend/static/assets/currencies.json") as f: currency_dict = json.load(f) currency_choices = [(int(val), label) for val, label in list(currency_dict.items())] diff --git a/control/admin.py b/control/admin.py index 5bfd2299..932a8d18 100755 --- a/control/admin.py +++ b/control/admin.py @@ -8,7 +8,6 @@ from control.models import AccountingDay, BalanceLog @admin.register(AccountingDay) class AccountingDayAdmin(ImportExportModelAdmin): - list_display = ( "day", "contracted", @@ -34,7 +33,6 @@ class AccountingDayAdmin(ImportExportModelAdmin): @admin.register(BalanceLog) class BalanceLogAdmin(ImportExportModelAdmin): - list_display = ( "time", "total", diff --git a/pyproject.toml b/pyproject.toml index 9ad50bca..e1ddb6e7 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,5 +1,9 @@ -[tool.isort] -profile = "black" +[tool.ruff] +# Exclude a variety of commonly ignored directories. +exclude = [ + "*migrations/*", + "api/nick_generator/nick_generator.py", + ] [tool.coverage.run] omit = [