File tree Expand file tree Collapse file tree 1 file changed +23
-0
lines changed
Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -111,6 +111,16 @@ MXMAKE?=-e .
111111# Default: src
112112RUFF_SRC? =src
113113
114+ # Enable ruff check --fix when running ruff-format.
115+ # Set to `true` to enable automatic fixes.
116+ # Default: false
117+ RUFF_FIXES? =false
118+
119+ # Enable unsafe fixes when RUFF_FIXES is enabled.
120+ # Set to `true` to enable unsafe fixes.
121+ # Default: false
122+ RUFF_UNSAFE_FIXES? =false
123+
114124# # qa.isort
115125
116126# Source folder to scan for Python files to run isort on.
@@ -352,6 +362,15 @@ ifeq ($(RUFF_SRC),src)
352362RUFF_SRC: =$(PYTHON_PROJECT_PREFIX ) src
353363endif
354364
365+ # Build ruff check flags based on settings
366+ ifeq ("$(RUFF_FIXES ) ","true")
367+ ifeq ("$(RUFF_UNSAFE_FIXES ) ","true")
368+ RUFF_FIX_FLAGS =--fix --unsafe-fixes
369+ else
370+ RUFF_FIX_FLAGS =--fix
371+ endif
372+ endif
373+
355374RUFF_TARGET: =$(SENTINEL_FOLDER ) /ruff.sentinel
356375$(RUFF_TARGET ) : $(MXENV_TARGET )
357376 @echo " Install Ruff"
@@ -367,6 +386,10 @@ ruff-check: $(RUFF_TARGET)
367386ruff-format : $(RUFF_TARGET )
368387 @echo " Run ruff format"
369388 @ruff format $(RUFF_SRC )
389+ ifeq ("$(RUFF_FIXES ) ","true")
390+ @echo "Run ruff check $(RUFF_FIX_FLAGS)"
391+ @ruff check $(RUFF_FIX_FLAGS) $(RUFF_SRC)
392+ endif
370393
371394.PHONY : ruff-dirty
372395ruff-dirty :
You can’t perform that action at this time.
0 commit comments