From c9ae0c58083bc5b26cea8510afd856b70457d5f4 Mon Sep 17 00:00:00 2001 From: William FH <13333726+hinthornw@users.noreply.github.com> Date: Wed, 5 Apr 2023 09:34:24 -0700 Subject: [PATCH] Add lint_diff command (#2449) It's helpful for developers to run the linter locally on just the changed files. This PR adds support for a `lint_diff` command. Ruff is still run over the entire directory since it's very fast. --- Makefile | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 24a18181..5fc6fff6 100644 --- a/Makefile +++ b/Makefile @@ -23,9 +23,13 @@ format: poetry run black . poetry run ruff --select I --fix . -lint: - poetry run mypy . - poetry run black . --check +PYTHON_FILES=. +lint: PYTHON_FILES=. +lint_diff: PYTHON_FILES=$(shell git diff --name-only --diff-filter=d master | grep -E '\.py$$') + +lint lint_diff: + poetry run mypy $(PYTHON_FILES) + poetry run black $(PYTHON_FILES) --check poetry run ruff . test: