Skip to content

Commit

Permalink
🐛 make check should check all files if there too many of them
Browse files Browse the repository at this point in the history
  • Loading branch information
Marigold committed Nov 20, 2024
1 parent 29e293b commit 82b3050
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion default.mk
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,16 @@ check-default:
@RELATIVE_PATH=$$(pwd | sed "s|^$$(git rev-parse --show-toplevel)/||"); \
CHANGED_PY_FILES=$$(git diff --name-only origin/master HEAD -- . && git diff --name-only && git ls-files --others --exclude-standard | grep '\.py'); \
CHANGED_PY_FILES=$$(echo "$$CHANGED_PY_FILES" | sed "s|^$$RELATIVE_PATH/||" | grep '\.py' | xargs -I {} sh -c 'test -f {} && echo {}' | grep -v '{}'); \
if [ -n "$$CHANGED_PY_FILES" ]; then \
FILE_COUNT=$$(echo "$$CHANGED_PY_FILES" | wc -l); \
if [ "$$FILE_COUNT" -le 1 ] && [ "$$FILE_COUNT" -gt 0 ]; then \
echo "$$CHANGED_PY_FILES" | xargs ruff check --fix; \
echo "$$CHANGED_PY_FILES" | xargs ruff format; \
echo "$$CHANGED_PY_FILES" | xargs pyright; \
else \
echo "Too many files, checking all files instead."; \
make lint; \
make format; \
make check-typing; \
fi

lint-default: .venv
Expand Down

0 comments on commit 82b3050

Please sign in to comment.