From 5e7a4a702c989987dfe27da25f6586370b691add Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Erik=20Bj=C3=A4reholt?= <erik@bjareho.lt>
Date: Wed, 8 Nov 2023 11:23:42 +0100
Subject: [PATCH] build: updated Makefile, added ruff

---
 Makefile | 20 ++++++++++++--------
 1 file changed, 12 insertions(+), 8 deletions(-)

diff --git a/Makefile b/Makefile
index 9fa32f8..3310fc3 100644
--- a/Makefile
+++ b/Makefile
@@ -1,3 +1,6 @@
+SRCDIRS := src/quantifiedme tests
+SRCFILES := $(shell find $(SRCDIRS) -name '*.py')
+
 # today
 date := $(shell date +%Y-%m-%d)
 
@@ -17,20 +20,21 @@ dashboard/build/dashboard.html:
 install:
 	poetry install
 
+lint:
+	poetry run ruff $(SRCDIRS)
+
 fmt:
-	black src/ tests/
+	poetry run ruff --fix $(SRCDIRS)
+	poetry run pyupgrade --py310-plus $(SRCFILES) --exit-zero-even-if-changed
+	poetry run black $(SRCDIRS)
 
 test:
-	poetry run python3 -m pytest tests/
+	poetry run python3 -m pytest -v tests/ --cov=quantifiedme --durations=5
 
 typecheck:
-	poetry run mypy --ignore-missing-imports --check-untyped-defs src/quantifiedme tests
+	poetry run mypy --ignore-missing-imports --check-untyped-defs $(SRCDIRS)
 
-precommit:
-	make fmt
-	poetry run pyupgrade --py310-plus src/quantifiedme/**.py
-	make typecheck
-	make test
+precommit: fmt typecheck test
 
 jupyter:
 	# From: https://stackoverflow.com/a/47296960/965332