aboutsummaryrefslogtreecommitdiff
path: root/scripts/lintdoc.lua
diff options
context:
space:
mode:
authorJongwook Choi <wookayin@gmail.com>2024-01-28 17:22:39 -0500
committerGitHub <noreply@github.com>2024-01-28 14:22:39 -0800
commit01e82eba209a96f932d3497e580ab0ca749efafa (patch)
tree51e434eb3fa50a319950d485454d42c6dd3a89c1 /scripts/lintdoc.lua
parent47cd532bf15d81c913e2c29b4c9a14c3654f85d2 (diff)
downloadrneovim-01e82eba209a96f932d3497e580ab0ca749efafa.tar.gz
rneovim-01e82eba209a96f932d3497e580ab0ca749efafa.tar.bz2
rneovim-01e82eba209a96f932d3497e580ab0ca749efafa.zip
build(docs): separate lint job to validate vimdoc #27227
Summary: Separate the lint job (`make lintdoc`) to validate runtime/doc, it is no longer as a part of functionaltest (help_spec). Build (cmake) and CI: - `make lintdoc`: validate vimdoc files and test-generate HTML docs. CI will run this as a part of the "docs" workflow. - `scripts/lintdoc.lua` is added as an entry point (executable script) for validating vimdoc files. scripts/gen_help_html.lua: - Move the tests for validating docs and generating HTMLs from `help_spec.lua` to `gen_help_html`. Added: - `gen_help_html.run_validate()`. - `gen_help_html.test_gen()`. - Do not hard-code `help_dir` to `build/runtime/doc`, but resolve from `$VIMRUNTIME`. Therefore, the `make lintdoc` job will check doc files on `./runtime/doc`, not on `./build/runtime/doc`. - Add type annotations for gen_help_html.
Diffstat (limited to 'scripts/lintdoc.lua')
-rwxr-xr-xscripts/lintdoc.lua20
1 files changed, 20 insertions, 0 deletions
diff --git a/scripts/lintdoc.lua b/scripts/lintdoc.lua
new file mode 100755
index 0000000000..5e78b4cdcb
--- /dev/null
+++ b/scripts/lintdoc.lua
@@ -0,0 +1,20 @@
+#!/usr/bin/env -S nvim -l
+
+-- Validate vimdoc files on $VIMRUNTIME/doc, and test generating HTML docs.
+-- Checks for duplicate/missing tags, parse errors, and invalid links/urls/spellings.
+-- See also `make lintdoc`.
+--
+-- Usage:
+-- $ nvim -l scripts/lintdoc.lua
+-- $ make lintdoc
+
+print('Running lintdoc ...')
+
+-- gen_help_html requires :helptags to be generated on $VIMRUNTIME/doc
+-- :helptags checks for duplicate tags.
+vim.cmd [[ helptags ALL ]]
+
+require('scripts.gen_help_html').run_validate()
+require('scripts.gen_help_html').test_gen()
+
+print('lintdoc PASSED.')