Skip to content

Commit

Permalink
Replace isort, black, flake8 with ruff
Browse files Browse the repository at this point in the history
  • Loading branch information
Reckless-Satoshi committed Jan 9, 2024
1 parent 84ea693 commit 1b71f69
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 33 deletions.
44 changes: 17 additions & 27 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -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'
Expand Down Expand Up @@ -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
- 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]

1 change: 0 additions & 1 deletion api/management/commands/telegram_watcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@


class Command(BaseCommand):

help = "Polls telegram /getUpdates method"
rest = 3 # seconds between consecutive polls

Expand Down
1 change: 0 additions & 1 deletion api/models/currency.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@


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())]
Expand Down
2 changes: 0 additions & 2 deletions control/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

@admin.register(AccountingDay)
class AccountingDayAdmin(ImportExportModelAdmin):

list_display = (
"day",
"contracted",
Expand All @@ -34,7 +33,6 @@ class AccountingDayAdmin(ImportExportModelAdmin):

@admin.register(BalanceLog)
class BalanceLogAdmin(ImportExportModelAdmin):

list_display = (
"time",
"total",
Expand Down
8 changes: 6 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -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 = [
Expand Down

0 comments on commit 1b71f69

Please sign in to comment.