Replace pre-commit with prek and lint YAML

This commit is contained in:
ponas committed 2026-10-23 02:18:50 +02:00
1 parent 6ae99528dd
commit c2f30c8ca4
4 files changed
+49 -38

No files matched your search

-12
View File
@@ -1,12 +0,0 @@
repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: 'v0.11.7'
hooks:
- id: ruff
args: [--fix, --exit-non-zero-on-fix]
- id: ruff-format
- repo: https://github.com/adamchainz/django-upgrade
rev: "1.24.0"
hooks:
- id: django-upgrade
args: [--target-version, "5.2"]
+8
View File
@@ -0,0 +1,8 @@
extends: default
rules:
document-start: disable
line-length:
max: 120
truthy:
allowed-values: ["true", "false", "on", "off"]
+18 -26
View File
@@ -75,32 +75,24 @@ class InventoryQueries:
inventory_purchases = sum((product["purchase_value"] for product in product_data), Decimal(0)) inventory_purchases = sum((product["purchase_value"] for product in product_data), Decimal(0))
product_sales = sum((product["sales_value"] for product in product_data), Decimal(0)) product_sales = sum((product["sales_value"] for product in product_data), Decimal(0))
deposits = ( deposits = models.Transaction.objects.filter(created__range=(start_time, end_time)).aggregate(
models.Transaction.objects.filter(created__range=(start_time, end_time)).aggregate(total=Sum("amount"))[ total=Sum("amount")
"total" )["total"] or Decimal(0)
] order_purchases = models.Order.objects.filter(created__range=(start_time, end_time)).aggregate(
or Decimal(0) total=Sum("order_sum")
) )["total"] or Decimal(0)
order_purchases = ( deposits_start = models.Transaction.objects.filter(created__lt=start_time).aggregate(total=Sum("amount"))[
models.Order.objects.filter(created__range=(start_time, end_time)).aggregate(total=Sum("order_sum"))[ "total"
"total" ] or Decimal(0)
] orders_start = models.Order.objects.filter(created__lt=start_time).aggregate(total=Sum("order_sum"))[
or Decimal(0) "total"
) ] or Decimal(0)
deposits_start = ( deposits_end = models.Transaction.objects.filter(created__lte=end_time).aggregate(total=Sum("amount"))[
models.Transaction.objects.filter(created__lt=start_time).aggregate(total=Sum("amount"))["total"] "total"
or Decimal(0) ] or Decimal(0)
) orders_end = models.Order.objects.filter(created__lte=end_time).aggregate(total=Sum("order_sum"))[
orders_start = ( "total"
models.Order.objects.filter(created__lt=start_time).aggregate(total=Sum("order_sum"))["total"] or Decimal(0) ] or Decimal(0)
)
deposits_end = (
models.Transaction.objects.filter(created__lte=end_time).aggregate(total=Sum("amount"))["total"]
or Decimal(0)
)
orders_end = (
models.Order.objects.filter(created__lte=end_time).aggregate(total=Sum("order_sum"))["total"] or Decimal(0)
)
return InventoryReport( return InventoryReport(
products=[InventoryReportProduct(**product) for product in product_data], products=[InventoryReportProduct(**product) for product in product_data],
+23
View File
@@ -0,0 +1,23 @@
#:schema https://www.schemastore.org/prek.json
[[repos]]
repo = "https://github.com/astral-sh/ruff-pre-commit"
rev = "v0.11.7"
hooks = [
{ id = "ruff", args = ["--fix", "--exit-non-zero-on-fix"] },
{ id = "ruff-format" },
]
[[repos]]
repo = "https://github.com/adamchainz/django-upgrade"
rev = "1.24.0"
hooks = [
{ id = "django-upgrade", args = ["--target-version", "5.2"] },
]
[[repos]]
repo = "https://github.com/adrienverge/yamllint"
rev = "v1.38.0"
hooks = [
{ id = "yamllint" },
]