Skip to content

Commit

Permalink
bin/lint-markdown: Only run against git-tracked markdown files (#780)
Browse files Browse the repository at this point in the history
Rather than maintaining effectively another ignore list, use the one we
already have via git. This also adapts better to usage in child
projects, as they will likely have more language/project specific
locations to ignore that we can't realistically maintain in this parent
template.
  • Loading branch information
doshitan authored Jan 23, 2025
1 parent 09d0ede commit 546b89b
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions bin/lint-markdown
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,5 @@ else
link_check_cmd="npx markdown-link-check"
fi

# Recursively find all markdown files (*.md) in the current directory, excluding node_modules and .venv subfolders.
# Pass them in as args to the lint command using the handy `xargs` command.
find . -name \*.md -not -path "*/node_modules/*" -not -path "*/.venv/*" -not -path "*/.terraform/*" -print0 | xargs -0 -I{} sh -c "${link_check_cmd} --quiet --config ${link_check_config} {}"
# Run the linter against each markdown file that's tracked in git
git ls-files -z '*.md' | xargs -0 -I{} sh -c "${link_check_cmd} --quiet --config ${link_check_config} {}"

0 comments on commit 546b89b

Please sign in to comment.