leapp-repository/SOURCES/0020-Fix-lint-in-Makefile-for-docs.patch
eabdullin b1bd6e77a6 Import from CS git
(cherry picked from commit 5bdc5cf293)
2025-05-15 11:55:21 +03:00

46 lines
1.6 KiB
Diff

From 9dd50a2fc3f30d3f5a00998ed9fc96d34129426d Mon Sep 17 00:00:00 2001
From: karolinku <kkula@redhat.com>
Date: Fri, 25 Apr 2025 14:23:20 +0200
Subject: [PATCH 20/37] Fix lint in Makefile for docs
isort is failing when getting empty list of arguments, what takes
place when only doc files was modified in a commit. This fix handles
that issue.
JIRA: RHELMISC-11679
---
Makefile | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)
diff --git a/Makefile b/Makefile
index 3e090159..ceb013ab 100644
--- a/Makefile
+++ b/Makefile
@@ -356,16 +356,17 @@ lint:
echo "--- Linting done. ---"; \
fi
- if [[ "`git rev-parse --abbrev-ref HEAD`" != "$(MASTER_BRANCH)" ]] && [[ -n "`git diff $(MASTER_BRANCH) --name-only --diff-filter AMR`" ]]; then \
+ if [[ "`git rev-parse --abbrev-ref HEAD`" != "$(MASTER_BRANCH)" ]]; then \
. $(VENVNAME)/bin/activate; \
- git diff $(MASTER_BRANCH) --name-only --diff-filter AMR | grep -v "^docs/" | xargs isort -c --diff || \
- { \
+ files_to_sort=`git diff main --name-only --diff-filter AMR | grep -v "^docs/"`; \
+ if [ -n "$$files_to_sort" ]; then \
+ echo "$$files_to_sort" | xargs isort -c --diff || { \
echo; \
- echo "------------------------------------------------------------------------------"; \
- echo "Hint: Apply the required changes."; \
+ echo "Hint: Apply the required changes.";\
echo " Execute the following command to apply them automatically: make lint_fix"; \
exit 1; \
- } && echo "--- isort check done. ---"; \
+ } && echo "--- isort check done. ---"; \
+ fi \
fi
lint_fix:
--
2.49.0