Skip to content

Commit 37f7702

Browse files
committed
Update dependencies and enable using ruff format by default
It's new but it's 30% faster than Black in my tests on a 1,000 SLOC codebase.
1 parent 9920550 commit 37f7702

2 files changed

Lines changed: 273 additions & 198 deletions

File tree

Makefile

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -103,16 +103,25 @@ test-integration: ## Run integration tests
103103
# $(PYTEST) tests -m integration
104104

105105
.PHONY: check
106-
check: check-py-black check-py-ruff check-py-mypy ## Run all checks
106+
check: check-py-ruff-format check-py-ruff-lint check-py-mypy ## Run all checks
107107

108-
.PHONY: check-py-ruff
109-
check-py-ruff: ## Run ruff linter
110-
$(RUFF) example tests
108+
.PHONY: check-py-ruff-lint
109+
check-py-ruff-lint: ## Run ruff linter
110+
$(RUFF) $(RUFF_OPTS) tgt_measurement tests || \
111+
(echo "$(COLOR_RED)Run '$(notdir $(MAKE)) check-py-ruff-fix' to fix some of these automatically if [*] appears above, then run '$(notdir $(MAKE)) $(MAKECMDGOALS)' again." && false)
112+
113+
.PHONY: check-py-ruff-fix
114+
check-py-ruff-fix: ## Run ruff linter
115+
$(MAKE) check-py-ruff-lint RUFF_OPTS=--fix
111116

112117
.PHONY: check-py-black
113118
check-py-black: ## Runs black code formatter
114119
$(BLACK) --check --fast .
115120

121+
.PHONY: check-py-ruff-format
122+
check-py-ruff-format: ## Runs ruff code formatter
123+
$(RUFF) $(RUFF_OPTS) format --check .
124+
116125
BUILD_DIR ?= build
117126
REPORTS_DIR = $(BUILD_DIR)/reports
118127
MYPY_OPTS ?= --show-column-numbers --pretty --html-report $(REPORTS_DIR)/mypy
@@ -125,8 +134,8 @@ check-precommit: ## Runs pre-commit on all files
125134
pre-commit run --all-files
126135

127136
.PHONY: format-py
128-
format-py: ## Runs Black formatter, makes changes where necessary
129-
$(BLACK) .
137+
format-py: ## Runs formatter, makes changes where necessary
138+
$(RUFF) format .
130139

131140
##@ Building and Publishing
132141

@@ -301,4 +310,3 @@ all:
301310
.PHONY: clean
302311
clean: ## Clean artifacts from build and dist directories
303312
rm -rf $(BUILD_DIR) dist/requirements.txt
304-

0 commit comments

Comments
 (0)