diff --git a/Makefile b/Makefile index 0ae38701..43ae9a26 100644 --- a/Makefile +++ b/Makefile @@ -174,3 +174,17 @@ dev-srv: ruff-check: ruff check --ignore F401 --ignore I001 --ignore E402 --ignore E501 --ignore F841 --exclude rhodecode/lib/dbmigrate --exclude .eggs --exclude .dev . +.PHONY: ruff-format +# Get changed Python files +ruff-format: + + @echo "Finding changed Python files..." + @git diff --name-only | grep '\.py$$' > .changed_files || true + @if [ -s .changed_files ]; then \ + echo "Running Ruff format on the following files:"; \ + cat .changed_files; \ + cat .changed_files | xargs ruff format; \ + else \ + echo "No Python files changed."; \ + fi + @rm -f .changed_files \ No newline at end of file