Skip to content

Commit be47344

Browse files
committed
fix: limit markdown linter hook to staged files only
Limit markdown linter hook that is being run pre-commit, to staged files only - Change final linting check from '**/*.md' to staged files only - Prevents hook failure on unstaged markdown files in project - Maintains git staging area respect and workflow consistency - Improves developer experience by focusing on actual changes The hook was incorrectly scanning all markdown files after auto-fixing staged files, causing failures on unrelated unstaged files like agent definitions or documentation drafts.
1 parent 5007257 commit be47344

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

adhoc/git/hooks/20-lint-markdown

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@ if command -v markdownlint-cli2 >/dev/null 2>&1; then
3939
stage_changes "$md_files"
4040
fi
4141

42-
# Now run final linting check on all markdown files (for project consistency)
43-
if markdownlint-cli2 "**/*.md"; then
42+
# Now run final linting check on staged markdown files only
43+
if echo "$md_files" | xargs markdownlint-cli2; then
4444
log_success "Markdown linting passed"
4545
else
4646
log_error "Markdown linting failed - manual fixes needed"

0 commit comments

Comments
 (0)