Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit b235419

Browse files
committed
refactor: optimize Vale style checking in Makefile
- Restructure Makefile Vale style checking to match GitHub Actions pattern - Improve changed file detection and variable handling - Enhance error handling with proper redirection and status messages
1 parent d77fdf2 commit b235419

File tree

1 file changed

+14
-8
lines changed

1 file changed

+14
-8
lines changed

Makefile

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -532,17 +532,23 @@ lint/docs-style: node_modules/.installed
532532
@if [ "$(DOCS_MD_FILES)" -gt 0 ]; then \
533533
echo "$(GREEN)==>$(RESET) $(BOLD)lint/docs-style$(RESET)"; \
534534
if command -v vale >/dev/null 2>&1; then \
535+
# Determine files to check
536+
VALE_FILES="docs/README.md docs/index.md"; \
535537
if echo "$(MAKEFLAGS)" | grep -q "all"; then \
536538
echo "Checking all documentation files..."; \
537-
vale --no-exit --config=.github/docs/vale/.vale.ini docs/; \
539+
VALE_FILES="docs/"; \
540+
elif [ -n "$(DOCS_CHANGED_FILES)" ]; then \
541+
echo "Checking changed files only: $(DOCS_CHANGED_FILES)"; \
542+
VALE_FILES="$(DOCS_CHANGED_FILES)"; \
538543
else \
539-
if [ -n "$(DOCS_CHANGED_FILES)" ]; then \
540-
echo "Checking changed files only: $(DOCS_CHANGED_FILES)"; \
541-
vale --no-exit --config=.github/docs/vale/.vale.ini $(DOCS_CHANGED_FILES); \
542-
else \
543-
echo "No changed files detected, checking representative files..."; \
544-
vale --no-exit --config=.github/docs/vale/.vale.ini docs/README.md docs/index.md 2>/dev/null || echo "No representative files found"; \
545-
fi; \
544+
echo "No changed files detected, checking representative files..."; \
545+
fi; \
546+
# Run Vale on the determined files
547+
if [ -n "$$VALE_FILES" ]; then \
548+
vale --no-exit --config=.github/docs/vale/.vale.ini $$VALE_FILES 2>/dev/null || \
549+
echo "Warning: Some vale checks produced issues"; \
550+
else \
551+
echo "No files found to check"; \
546552
fi; \
547553
else \
548554
echo "Vale is an optional tool for style checking."; \

0 commit comments

Comments
 (0)