Replace pre-commit with prek and lint YAML
This commit is contained in:
4 files changed
+47
-36
No files matched your search
@@ -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"]
|
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
extends: default
|
||||||
|
|
||||||
|
rules:
|
||||||
|
document-start: disable
|
||||||
|
line-length:
|
||||||
|
max: 120
|
||||||
|
truthy:
|
||||||
|
allowed-values: ["true", "false", "on", "off"]
|
||||||
@@ -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"] or Decimal(0)
|
||||||
|
order_purchases = models.Order.objects.filter(created__range=(start_time, end_time)).aggregate(
|
||||||
|
total=Sum("order_sum")
|
||||||
|
)["total"] or Decimal(0)
|
||||||
|
deposits_start = models.Transaction.objects.filter(created__lt=start_time).aggregate(total=Sum("amount"))[
|
||||||
"total"
|
"total"
|
||||||
]
|
] or Decimal(0)
|
||||||
or Decimal(0)
|
orders_start = models.Order.objects.filter(created__lt=start_time).aggregate(total=Sum("order_sum"))[
|
||||||
)
|
|
||||||
order_purchases = (
|
|
||||||
models.Order.objects.filter(created__range=(start_time, end_time)).aggregate(total=Sum("order_sum"))[
|
|
||||||
"total"
|
"total"
|
||||||
]
|
] or Decimal(0)
|
||||||
or Decimal(0)
|
deposits_end = models.Transaction.objects.filter(created__lte=end_time).aggregate(total=Sum("amount"))[
|
||||||
)
|
"total"
|
||||||
deposits_start = (
|
] or Decimal(0)
|
||||||
models.Transaction.objects.filter(created__lt=start_time).aggregate(total=Sum("amount"))["total"]
|
orders_end = models.Order.objects.filter(created__lte=end_time).aggregate(total=Sum("order_sum"))[
|
||||||
or Decimal(0)
|
"total"
|
||||||
)
|
] or Decimal(0)
|
||||||
orders_start = (
|
|
||||||
models.Order.objects.filter(created__lt=start_time).aggregate(total=Sum("order_sum"))["total"] 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],
|
||||||
|
|||||||
@@ -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" },
|
||||||
|
]
|
||||||
Reference in new issue
Block a user