From ea59540d5b1ddcbdcc9cd8246142d340c2a50668 Mon Sep 17 00:00:00 2001 From: Philip Top Date: Tue, 28 Oct 2025 05:48:03 -0700 Subject: [PATCH 1/6] update precommit markdownlint and add permissions on workflow files --- .github/workflows/arm_mac_gcc.yml | 3 +++ .github/workflows/pr_merged.yml | 4 +++ .pre-commit-config.yaml | 11 ++++++-- scripts/.markdownlint-cli2.jsonc | 45 +++++++++++++++++++++++++++++++ 4 files changed, 61 insertions(+), 2 deletions(-) create mode 100644 scripts/.markdownlint-cli2.jsonc diff --git a/.github/workflows/arm_mac_gcc.yml b/.github/workflows/arm_mac_gcc.yml index 9b17b88bc..2640b4ce8 100644 --- a/.github/workflows/arm_mac_gcc.yml +++ b/.github/workflows/arm_mac_gcc.yml @@ -4,6 +4,9 @@ on: branches: - main +permissions: + contents: read + jobs: arm64_gcc: name: ARM64 GCC diff --git a/.github/workflows/pr_merged.yml b/.github/workflows/pr_merged.yml index 56f6f741f..8709fbabe 100644 --- a/.github/workflows/pr_merged.yml +++ b/.github/workflows/pr_merged.yml @@ -3,6 +3,10 @@ on: pull_request_target: types: [closed] +permissions: + contents: write + pull-request: write + jobs: label-merged: name: Changelog needed diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 3c331b117..1ecab7eb6 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -43,13 +43,20 @@ repos: - id: prettier types_or: [yaml, markdown, html, css, scss, javascript, json] args: [--prose-wrap=always] - + - repo: https://github.com/jumanjihouse/pre-commit-hooks + rev: 3.0.0 + hooks: + - id: script-must-have-extension - repo: https://github.com/markdownlint/markdownlint rev: v0.13.0 hooks: - id: markdownlint args: [-s, ./scripts/.markdownlintrc] - + - repo: https://github.com/DavidAnson/markdownlint-cli2 + rev: v0.12.0 # Use the latest stable version + hooks: + - id: markdownlint-cli2 + args: ["--fix", "--config", "./scripts/.markdownlint-cli2.jsonc"] # Optional: specify a custom config file # - repo: local # hooks: # - id: remarklint diff --git a/scripts/.markdownlint-cli2.jsonc b/scripts/.markdownlint-cli2.jsonc new file mode 100644 index 000000000..3eceb5cc9 --- /dev/null +++ b/scripts/.markdownlint-cli2.jsonc @@ -0,0 +1,45 @@ +{ + "config": { + "MD001": true, // header levels increment by 1 + "MD002": true, // first header should be a top level header + "MD003": { "style": "atx" }, // header style + "MD004": { "style": "dash" }, // unordered list style - dash + // "MD005": false, // inconsistent indentation handled by prettier + "MD006": true, // bulleted lists at beginning of line + // "MD007": { "indent": 2 }, // handled by prettier + "MD009": true, // no trailing spaces + "MD010": true, // no hard tabs + "MD011": true, // reversed link syntax + "MD012": true, // multiple consecutive blank lines + // "MD013": false, // line length ignored + // "MD014": false, // command syntax ignored + "MD018": true, // space after header style + "MD019": true, // no multiple spaces after header style + "MD020": true, // no spaces inside hashes + "MD021": true, // no spaces inside closing hashes + "MD022": true, // headers surrounded by blank lines + "MD023": true, // headers start at beginning of line + "MD024": { "allow_different_nesting": true }, // duplicate headers allowed in different nests + "MD025": true, // only one H1 + "MD026": { "punctuation": ".,;:" }, // no trailing punctuation + "MD027": true, // multiple spaces after blockquote + "MD028": true, // no blank lines inside blockquote + // "MD029": { "style": "ordered" }, // prettier handles numbering + // "MD030": { "ul_single": 1, "ol_single": 1, "ul_multi": 1, "ol_multi": 3 }, // prettier handles spacing + "MD031": true, // fenced code blocks surrounded by blank lines + // "MD032": false, // lists surrounded by blank lines, prettier handles + // "MD033": { "allowed_elements": "a, em, strong, code, del, ins, sup, sub" }, // inline HTML exceptions + // "MD034": false, // raw URLs allowed + "MD035": { "style": "---" }, // horizontal rule style + // "MD036": false, // strong vs emphasis ignored + "MD037": true, // no spaces inside emphasis + "MD038": true, // no spaces inside code spans + "MD039": true, // no spaces inside link text + "MD040": true, // require fenced language + "MD041": true, // first line is top-level header + // "MD042": false, // empty link disabled + "MD046": { "style": "fenced" }, // code block style + "MD047": true // single newline at end + // "MD048": false // code fence style consistency ignored + } +} \ No newline at end of file From 14585a8702aa30f15651f729a97a51474ceff925 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 28 Oct 2025 13:01:02 +0000 Subject: [PATCH 2/6] style: pre-commit.ci fixes --- README.md | 1 - scripts/.markdownlint-cli2.jsonc | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/README.md b/README.md index bd60ac5f0..99b4c5b1c 100644 --- a/README.md +++ b/README.md @@ -1992,7 +1992,6 @@ try! Feedback is always welcome. https://app.codacy.com/project/badge/Grade/2796b969c1b54321a02ad08affec0800 [codacy-link]: https://www.codacy.com/gh/CLIUtils/CLI11/dashboard?utm_source=github.com&utm_medium=referral&utm_content=CLIUtils/CLI11&utm_campaign=Badge_Grade -[hunter]: https://docs.hunter.sh/en/latest/packages/pkg/CLI11.html [standard readme style]: https://github.com/RichardLitt/standard-readme [argparse]: https://github.com/p-ranav/argparse [toml]: https://toml.io diff --git a/scripts/.markdownlint-cli2.jsonc b/scripts/.markdownlint-cli2.jsonc index 3eceb5cc9..50899b4b4 100644 --- a/scripts/.markdownlint-cli2.jsonc +++ b/scripts/.markdownlint-cli2.jsonc @@ -42,4 +42,4 @@ "MD047": true // single newline at end // "MD048": false // code fence style consistency ignored } -} \ No newline at end of file +} From 114f27f7fb201c8e7adadadf836342690cfbb6f4 Mon Sep 17 00:00:00 2001 From: Philip Top Date: Tue, 28 Oct 2025 06:10:50 -0700 Subject: [PATCH 3/6] tweak the json config --- scripts/.markdownlint-cli2.jsonc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scripts/.markdownlint-cli2.jsonc b/scripts/.markdownlint-cli2.jsonc index 50899b4b4..277eed7ce 100644 --- a/scripts/.markdownlint-cli2.jsonc +++ b/scripts/.markdownlint-cli2.jsonc @@ -11,7 +11,7 @@ "MD010": true, // no hard tabs "MD011": true, // reversed link syntax "MD012": true, // multiple consecutive blank lines - // "MD013": false, // line length ignored + "MD013": false, // line length ignored // "MD014": false, // command syntax ignored "MD018": true, // space after header style "MD019": true, // no multiple spaces after header style @@ -29,6 +29,7 @@ "MD031": true, // fenced code blocks surrounded by blank lines // "MD032": false, // lists surrounded by blank lines, prettier handles // "MD033": { "allowed_elements": "a, em, strong, code, del, ins, sup, sub" }, // inline HTML exceptions + "MD033": false, // "MD034": false, // raw URLs allowed "MD035": { "style": "---" }, // horizontal rule style // "MD036": false, // strong vs emphasis ignored From b06b472e686b793781e09158b1ecbdddb202cacf Mon Sep 17 00:00:00 2001 From: Philip Top Date: Tue, 28 Oct 2025 06:25:52 -0700 Subject: [PATCH 4/6] tweaks for changelog --- scripts/.markdownlint-cli2.jsonc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/.markdownlint-cli2.jsonc b/scripts/.markdownlint-cli2.jsonc index 277eed7ce..cac27306d 100644 --- a/scripts/.markdownlint-cli2.jsonc +++ b/scripts/.markdownlint-cli2.jsonc @@ -19,7 +19,7 @@ "MD021": true, // no spaces inside closing hashes "MD022": true, // headers surrounded by blank lines "MD023": true, // headers start at beginning of line - "MD024": { "allow_different_nesting": true }, // duplicate headers allowed in different nests + "MD024": { "siblings_only": true,"allow_different_nesting": true }, // duplicate headers allowed in different nests "MD025": true, // only one H1 "MD026": { "punctuation": ".,;:" }, // no trailing punctuation "MD027": true, // multiple spaces after blockquote From 2e16eb80de1fee64a9c63ce5b6cb2aed4ea454ff Mon Sep 17 00:00:00 2001 From: Philip Top Date: Tue, 28 Oct 2025 06:29:48 -0700 Subject: [PATCH 5/6] add new linting rules --- scripts/.markdownlint-cli2.jsonc | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/scripts/.markdownlint-cli2.jsonc b/scripts/.markdownlint-cli2.jsonc index cac27306d..580404c81 100644 --- a/scripts/.markdownlint-cli2.jsonc +++ b/scripts/.markdownlint-cli2.jsonc @@ -40,7 +40,22 @@ "MD041": true, // first line is top-level header // "MD042": false, // empty link disabled "MD046": { "style": "fenced" }, // code block style - "MD047": true // single newline at end - // "MD048": false // code fence style consistency ignored + "MD047": true, // single newline at end + "MD048": true, // code fence style consistency ignored + // Newly enabled rules for testing: + "MD044": { + // proper names; empty list means default names only + "names": [] + }, + "MD049": { "style": "consistent" }, // emphasis style + "MD050": { "style": "consistent" }, // strong style + "MD051": true, // valid link fragments + "MD052": true, // reference links/images must use defined labels + "MD053": true, // flag unused or undefined link references + + // Table-related rules: enable if you use tables + "MD055": true, // consistent pipe style + "MD056": true, // consistent column counts + "MD058": true // blank lines around tables } } From 1da64a61a09ccc6140f123cb9fbfdee68cc7d768 Mon Sep 17 00:00:00 2001 From: Philip Top Date: Tue, 28 Oct 2025 06:43:35 -0700 Subject: [PATCH 6/6] add more precommit checks --- .pre-commit-config.yaml | 11 ++++------- scripts/.markdownlintrc | 41 ----------------------------------------- 2 files changed, 4 insertions(+), 48 deletions(-) delete mode 100644 scripts/.markdownlintrc diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 1ecab7eb6..68e92e265 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -18,9 +18,11 @@ repos: - id: check-symlinks - id: check-yaml - id: check-toml + - id: check-json - id: end-of-file-fixer - id: mixed-line-ending - id: trailing-whitespace + - id: check-illegal-windows-names - id: check-shebang-scripts-are-executable - id: check-executables-have-shebangs - id: debug-statements @@ -37,8 +39,8 @@ repos: - id: cmake-format additional_dependencies: [pyyaml] - - repo: https://github.com/pre-commit/mirrors-prettier - rev: "v4.0.0-alpha.8" + - repo: https://github.com/JoC0de/pre-commit-prettier + rev: v3.6.2 hooks: - id: prettier types_or: [yaml, markdown, html, css, scss, javascript, json] @@ -47,11 +49,6 @@ repos: rev: 3.0.0 hooks: - id: script-must-have-extension - - repo: https://github.com/markdownlint/markdownlint - rev: v0.13.0 - hooks: - - id: markdownlint - args: [-s, ./scripts/.markdownlintrc] - repo: https://github.com/DavidAnson/markdownlint-cli2 rev: v0.12.0 # Use the latest stable version hooks: diff --git a/scripts/.markdownlintrc b/scripts/.markdownlintrc deleted file mode 100644 index 5832861fb..000000000 --- a/scripts/.markdownlintrc +++ /dev/null @@ -1,41 +0,0 @@ -rule "MD001" # header levels increment by 1 -rule "MD002" # first header should be a top level header -rule "MD003", :style => :atx # header style - atx -rule "MD004", :style => :dash # unordered list style - dash -#rule "MD005" # don't allow inconsistent indentation for list items managed by prettier -rule "MD006" # consider starting bulleted lists at the beginning of the line -#rule "MD007", :indent => 2 # unordered list indentation should be 4 spaces managed by prettier -rule "MD009" # trailing spaces not allowed -rule "MD010" # hard tabs not allowed -rule "MD011" # alert on reversed link syntax -rule "MD012" # alert on multiple consecutive blank lines -#rule "MD013" # line length should be no more than 80 characters -#rule "MD014" # dollars signs not before commands w/o showing output -rule "MD018" # must have space after header style -rule "MD019" # no multiple spaces after header style -rule "MD020" # no multiple spaces inside hashes on closed atx style headers -rule "MD021" # multiple spaces inside hashes on closed atx style headers -rule "MD022" # headers should be surrounded by blank lines -rule "MD023" # headers must start at the beginning of the line -rule "MD024", :allow_different_nesting => true # no multiple same level headers with same content -rule "MD025" # only 1 level 1 header -rule "MD026", :punctuation => '.,;:' # no trailing punctuation in headers -rule "MD027" # no multiple spaces after blockquote symbol -rule "MD028" # no blank lines within blockquote -#rule "MD029", :style => :ordered # ordered list item prefix, should be ordered -#rule "MD030", :ul_single => 1, :ol_single => 1, :ul_multi => 1, :ol_multi => 3 # spaces after list markers, controlled by prettier -rule "MD031" # fenced code blocks need line surrounding -#rule "MD032" # lists should be surrounded by line # handled by prettier markdown formatting -#rule "MD033", :allowed_elements => 'a, em, strong, code, del, ins, sup, sub' # no inline HTML except these elements -#rule "MD034" # no raw url -rule "MD035", :style => '---' # horizontal rule style - --- -#rule "MD036" # emphasis used instead of strong emphasis -rule "MD037" # no spaces inside emphasis markers -rule "MD038" # spaces inside code span markers -rule "MD039" # no spaces inside link text brackets -rule "MD040" # fenced code blocks should have a language specified -rule "MD041" # first line should be a top level header -#rule "MD042" # no empty links -rule "MD046", :style => :fenced # code block style - fenced -rule "MD047" # files should end with a single newline character -#rule "MD048" # code fence style consistency