From 2a4b453b588ef2c7c95596bec69b4ff19a17f320 Mon Sep 17 00:00:00 2001 From: Ben Grande Date: Thu, 4 Jul 2024 18:09:38 +0200 Subject: [PATCH] fix: lint GitHub issue and pull request templates --- .github/ISSUE_TEMPLATE/bug.md | 10 +++++----- .github/ISSUE_TEMPLATE/feat.md | 12 ++++++------ .github/ISSUE_TEMPLATE/question.md | 10 +++++----- .github/pull_request_template.md | 16 ++++++++-------- scripts/markdown-lint.sh | 29 +++++++++++++++++++++++++---- 5 files changed, 49 insertions(+), 28 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/bug.md b/.github/ISSUE_TEMPLATE/bug.md index 7f02cc5..211a596 100644 --- a/.github/ISSUE_TEMPLATE/bug.md +++ b/.github/ISSUE_TEMPLATE/bug.md @@ -10,11 +10,11 @@ assignees: '' I confirm that I have read the following resources: -- [How to troubleshoot Qusal](https://github.com/ben-grande/qusal/blob/main/docs/TROUBLESHOOT.md) -- [How to ask questions The Smart Way](http://catb.org/esr/faqs/smart-questions.html) -- [Writing the perfect question](https://codeblog.jonskeet.uk/2010/08/29/writing-the-perfect-question/) -- [Question checklist](https://codeblog.jonskeet.uk/2012/11/24/stack-overflow-question-checklist/) -- [Could you please make my preference the default?](https://www.qubes-os.org/faq/#could-you-please-make-my-preference-the-default) +* [How to troubleshoot Qusal](https://github.com/ben-grande/qusal/blob/main/docs/TROUBLESHOOT.md) +* [How to ask questions The Smart Way](http://catb.org/esr/faqs/smart-questions.html) +* [Writing the perfect question](https://codeblog.jonskeet.uk/2010/08/29/writing-the-perfect-question/) +* [Question checklist](https://codeblog.jonskeet.uk/2012/11/24/stack-overflow-question-checklist/) +* [Could you please make my preference the default?](https://www.qubes-os.org/faq/#could-you-please-make-my-preference-the-default) diff --git a/scripts/markdown-lint.sh b/scripts/markdown-lint.sh index e33f09a..5edd537 100755 --- a/scripts/markdown-lint.sh +++ b/scripts/markdown-lint.sh @@ -12,6 +12,8 @@ command -v git >/dev/null || cd "$(git rev-parse --show-toplevel)" || exit 1 ./scripts/requires-program.sh mdl +extra_files_rules="~MD002,~MD012,~MD022,~MD032,~MD041" + find_tool="find" if command -v fd; then find_tool="fd" @@ -21,21 +23,40 @@ fi if test -n "${1-}"; then files="" + extra_files="" for f in "$@"; do test -f "$f" || continue extension="${f##*.}" case "$extension" in - md) files="$files $f";; - *) continue;; + md) + case "${f}" in + .github/*) extra_files="$extra_files $f"; continue;; + esac + files="$files $f";; + *) + continue + ;; esac done + if test -n "${extra_files}"; then + mdl --rules ${extra_files_rules} ${extra_files} + fi test -n "$files" || exit 0 exec mdl ${files} fi case "${find_tool}" in - fd|fdfind) files="$(${find_tool} . --extension=md)";; - find) files="$(find minion.d/ -type f -name "*.md")";; + fd|fdfind) + files="$(${find_tool} . --hidden --exclude .github --type=f --extension=md)" + extra_files="$(${find_tool} . --hidden --type=f --extension=md .github)" + ;; + find) + files="$(find . -not -path './.github/*' -type f -name "*.md")" + extra_files="$(find .github -type f -name "*.md")" + ;; esac +if test -n "${extra_files}"; then + mdl --rules ${extra_files_rules} ${extra_files} +fi exec mdl ${files}