diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index bb659b727291a1935635d270e3313d4de5502ca0..35d0fb0bf585b42d59a47df0570c337e3db6fb69 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -56,7 +56,8 @@ repos: files: \.(h|cpp)$ - id: vale name: Check spelling with vale - entry: bash -c 'if command -v vale &> /dev/null; then vale --minAlertLevel warning; else exit 0; fi' + entry: bash -c 'if command -v vale &> /dev/null; then VALE_MIN_ALERT_LEVEL=error scripts/ci/helper/run-vale; else exit 0; fi' + pass_filenames: false language: system - repo: https://github.com/igorshubovych/markdownlint-cli rev: v0.31.1 diff --git a/scripts/ci/helper/run-markdownlint b/scripts/ci/helper/run-markdownlint new file mode 100755 index 0000000000000000000000000000000000000000..10d7e8312031affc72905d345a2f657339cf9403 --- /dev/null +++ b/scripts/ci/helper/run-markdownlint @@ -0,0 +1,14 @@ +echo "Lint Markdown" +if command -v markdownlint >/dev/null 2>&1; then + # TODO: 'Documentation/**/*.md' + markdownlint 'web/content/**/*.md' || ((ERROR_RESULTS++)) +else + echo "markdownlint is missing, please install it from https://github.com/igorshubovych/markdownlint-cli#installation" +fi +if [ "${ERROR_RESULTS}" -ne 0 ]; then + echo "✖ ${ERROR_RESULTS} markdownlint failed. Review the log carefully to see full listing." + exit 1 +else + echo "✔ markdownlint passed" + exit 0 +fi diff --git a/scripts/ci/helper/lint-docs b/scripts/ci/helper/run-vale similarity index 70% rename from scripts/ci/helper/lint-docs rename to scripts/ci/helper/run-vale index 6865144af19bd059f09ff777440d3c0d5954fd2d..061ad491d5e57babfcc11e80ea1065416c97d434 100755 --- a/scripts/ci/helper/lint-docs +++ b/scripts/ci/helper/run-vale @@ -30,17 +30,11 @@ fi if [ "${VALE_OUTPUT}" == "json" ]; then exit 0 fi -echo "Lint Markdown" -if command -v markdownlint >/dev/null 2>&1; then - # TODO: 'Documentation/**/*.md' - markdownlint 'web/content/**/*.md' || ((ERROR_RESULTS++)) -else - echo "markdownlint is missing, please install it from https://github.com/igorshubovych/markdownlint-cli#installation" -fi + if [ "${ERROR_RESULTS}" -ne 0 ]; then - echo "✖ ${ERROR_RESULTS} lint test(s) failed. Review the log carefully to see full listing." + echo "✖ ${ERROR_RESULTS} Vale spell check failed. Review the log carefully to see full listing." exit 1 else - echo "✔ Linting passed" + echo "✔ Vale spell check passed" exit 0 fi diff --git a/scripts/ci/jobs/build-docs.yml b/scripts/ci/jobs/build-docs.yml index 4f5ca0cc9736686754037f5e520b0661394e2996..93a2d07127f02706f675cdd6138dbecbe2482a5e 100644 --- a/scripts/ci/jobs/build-docs.yml +++ b/scripts/ci/jobs/build-docs.yml @@ -104,7 +104,7 @@ spell check docs: variables: VALE_OUTPUT: json script: - - scripts/ci/helper/lint-docs > vale-report.json + - scripts/ci/helper/run-vale > vale-report.json artifacts: paths: - vale-report.json