Repository navigation
feat(cli): add the recheck engine and the redocly recheck command #3080
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
99 commits
Select commit
Hold shift + click to select a range
ffbb993
feat(recheck): add the recheck engine package
adamaltman 2f7eb41
chore(recheck): type-check the engine tests and use the complexity ov…
adamaltman 11cdc30
chore(recheck): narrow the config type and trim the console disables
adamaltman 7b1e8d0
feat(recheck): resolve a redocly.yaml recheck block into engine rules
adamaltman a7d1607
feat(recheck): expose lint, baseline, readability, and schema actions
adamaltman 8048e10
docs(recheck): describe the engine package and its build
adamaltman b276c59
docs(recheck): fix a stale reference and tidy the package prose
adamaltman 4a5583a
chore(recheck): changeset for the engine package
adamaltman 51c605d
feat(recheck): accept several roots in the lint, baseline, and readab…
adamaltman 7673c12
fix(recheck): remove standalone-tool references from shipped text
adamaltman 4daf241
chore(recheck): tidy comments, examples, coverage excludes, and the c…
adamaltman 5cab1ed
docs(recheck): make the README consistent about when the command ships
adamaltman efe989e
chore(recheck): name the CLI command in the last engine strings
adamaltman 197ff5b
docs(recheck): split the contributing note on upstream differences
adamaltman c66a65e
fix(recheck): resolve code scanning and review findings in the engine
adamaltman 8da2ee1
docs(recheck): apply README wording suggestions from review
adamaltman ed6b50a
fix(recheck): add the idea admonition type to the Realm Markdoc schema
adamaltman f53d116
test(recheck): make the outside-root assertion path-separator safe
adamaltman 820dcb8
feat(recheck): add the singleExpanded attribute to accordion-group
adamaltman 0e917b2
fix(recheck): reject a non-object recheck block
adamaltman d530dbd
chore(recheck): ship the skills directory and drop a config comment
adamaltman 607073b
feat(core): set recheck presets aside in extends and accept the reche…
adamaltman 03d3b02
feat(recheck): add an output channel to the engine logger
adamaltman 51a919e
fix(recheck): send the --stats breakdown to the output channel
adamaltman c1d5022
feat(cli): wire the recheck engine into the CLI build
adamaltman 8c9a00c
feat(cli): add the redocly recheck command
adamaltman d00f16e
fix(cli): run the markdoc schema action without the recheck lint config
adamaltman 996c09a
tests(cli): end-to-end coverage for redocly recheck and the recheck b…
adamaltman 599d30f
docs(cli): document redocly recheck and the recheck configuration block
adamaltman a3935a0
fix(cli): keep sarif stdout clean and correct the recheck docs
adamaltman f34c1c2
docs(cli): split the recheck sentence in the extends reference
adamaltman a08ec3c
docs(cli): rewrite the recheck pages in plain language
adamaltman 0d7d5b8
feat(core): pin @redocly/config 0.56.0 and validate the recheck block
adamaltman 3eaced1
refactor(cli): align recheck flags and fallback with lint
adamaltman 2411e0c
chore(cli): drop the inert package rewrite from local-pack.sh
adamaltman 7846022
fix(cli): exit through AbortFlowError, reserve plugin ids, and hide t…
adamaltman e6ea447
fix(recheck): write the baseline group separator as an escape
adamaltman 30b5f69
refactor(cli): split recheck args, rename toLintOptions, lazy-load th…
adamaltman 92a3ccf
feat(cli): discover .redocly.recheck-baseline.yaml next to redocly.yaml
adamaltman e2a998e
test(cli): cover the recheck command with e2e fixtures
adamaltman 0cdd84c
chore(cli): bundle the spell-check packages into the CLI
adamaltman 9dd9c66
Merge remote-tracking branch 'origin/main' into aa/recheck-relocate-e…
adamaltman 3a8a938
docs(recheck): fold the recheck contributor guide into the root guide
adamaltman 22c7c57
Merge remote-tracking branch 'origin/aa/recheck-relocate-engine' into…
adamaltman 969febe
refactor(cli): drop --severity and the recheck baseline key
adamaltman f77bca2
refactor(recheck): return the lint run as data and print it from the CLI
adamaltman b8505f6
fix(cli): print the lint preamble before a baseline or run failure
adamaltman b3a05aa
refactor(cli): move the recheck report formats into the CLI
adamaltman 2fbd2c6
refactor(recheck): return readability rows and print them from the CLI
adamaltman 215468e
refactor(recheck): return the baseline run as data and print it from …
adamaltman 9c29c82
refactor(recheck): return the Markdoc schema result and print it from…
adamaltman 4d6662e
refactor(recheck): drop the engine logger
adamaltman 1c00cf7
docs(recheck): note the data-returning actions in the changeset
adamaltman 809effd
chore(cli): apply the final review of the recheck logger rework
adamaltman 304177a
Merge remote-tracking branch 'origin/main' into aa/recheck-relocate-e…
adamaltman 84518c4
fix(cli): emit ::notice for info findings in the GitHub Actions format
adamaltman 74f2c2b
fix(cli): cover every rule severity in the GitHub Actions command map
adamaltman 21d0f29
refactor(recheck): export preset blocks and the rule merge for core
adamaltman 3a99a42
fix(recheck): keep the public rule merge safe on unvalidated entries
adamaltman 7a7978b
feat(core): resolve recheck presets as a built-in plugin and merge th…
adamaltman de1b8aa
fix(core): load the recheck plugin for extends in shared files and sc…
adamaltman 3338573
feat(cli): read the merged recheck block from the config
adamaltman e3ec9e5
chore(recheck): apply the final review fixes for the config integration
adamaltman e48bdbc
refactor(recheck): keep preset data pure and fill token rule messages…
adamaltman bc30543
refactor(core): register the recheck presets as a static built-in plugin
adamaltman 4374219
chore(recheck): apply the round-2 review fixes
adamaltman 160125f
refactor(core): own the recheck config merge and set the presets aside
adamaltman 11b12b4
fix(core): keep files under recheck/ and non-object blocks intact in …
adamaltman 3f503b3
refactor(recheck): compose presets in the engine with core's rule merge
adamaltman f8890d1
chore(recheck): apply the round-3 review fixes
adamaltman 820fd92
fix(core): keep the last listing of a repeated recheck preset
adamaltman 83f8772
Merge remote-tracking branch 'origin/main' into aa/recheck-relocate-e…
adamaltman 243bb5b
refactor(cli): drop --output-path, rename --out, and align recheck op…
adamaltman f1c3f52
fix(cli): count all problems in the recheck table and warn before the…
adamaltman ff78cfd
fix(recheck): report config errors with block paths and no repeated path
adamaltman 99ff571
chore(recheck): drop the rule key from messages that already carry it…
adamaltman 69d2189
Merge remote-tracking branch 'origin/main' into aa/recheck-relocate-e…
adamaltman 2f6b195
docs(recheck): link the README to the in-repo command page
adamaltman 29e31ab
docs(recheck): make the README documentation pointer a link
adamaltman e9bb6e4
test(recheck): audit tests and fill gaps
RomanHotsiy e7497bf
docs(recheck): rewrite code comments in plain English
RomanHotsiy 075234f
test(recheck): audit token rule tests
RomanHotsiy 820fc48
test(recheck): audit core, actions, config and utils tests
RomanHotsiy 3333f31
test(recheck): audit cli, config, and e2e recheck tests
RomanHotsiy 4b07855
docs(recheck): remove the deleted unit harness from the rules guide
RomanHotsiy 6fa2b20
test(recheck): audit scope, parser and metrics tests
RomanHotsiy f86c404
fix(recheck): drop stale hints and test references
RomanHotsiy 37c0e31
refactor(recheck): remove the unused `baseline` key from the engine c…
RomanHotsiy 08da759
refactor(core): trim the recheck exports of the package entry point
RomanHotsiy bfbb907
refactor(recheck): keep test-only token rule exports out of the engine
RomanHotsiy df6e2bd
test(e2e): remove the check-config case for a recheck block
RomanHotsiy a32812c
refactor: resolve recheck presets through the normal extends path
RomanHotsiy 309397c
refactor(recheck): stop expanding extends in the engine
RomanHotsiy 18e1bf3
docs(recheck): describe native preset resolution
RomanHotsiy 77a43d9
test: drop leftover recheckExtends references
RomanHotsiy f4e3011
fix(recheck): keep shared preset data unchanged when validating
RomanHotsiy ae12d0a
docs(cli): explain the table format fallback in config linting
RomanHotsiy 9aaa913
chore: remove needless config
tatomyr e5dbdb5
Merge branch 'main' into aa/recheck-relocate-engine
adamaltman File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| --- | ||
| '@redocly/cli': minor | ||
| '@redocly/openapi-core': minor | ||
| '@redocly/recheck': minor | ||
| --- | ||
|
|
||
| Added the `redocly recheck` command. | ||
| It lints Markdown prose and structure from the `recheck` block in `redocly.yaml`, with presets named in the root `extends` (for example `recheck/markdown`). | ||
| Presets merge with the `recheck` blocks in `extends` order, like other presets. | ||
| The engine's actions return data. | ||
| The CLI prints it. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| --- | ||
| '@redocly/openapi-core': minor | ||
| --- | ||
|
|
||
| Added the `plugins` option to `loadConfig` and `createConfig`: ready plugin objects that are added next to the built-in plugin. | ||
| Resolved configs carry the merged `recheck` block in `Config.recheck`. | ||
| A `recheck/*` entry in `extends` resolves like any other preset when a plugin with the id `recheck` is passed, and is skipped otherwise. | ||
| `lint` reads no rules from the block. | ||
| A custom plugin cannot use the id `recheck`. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| --- | ||
| '@redocly/recheck': minor | ||
| --- | ||
|
|
||
| Added the `@redocly/recheck` engine package to this repository. | ||
| It powers the upcoming `redocly recheck` command. | ||
| `@redocly/recheck/presets` exports the presets as a plugin for `@redocly/openapi-core`. | ||
|
|
||
| **Note:** the standalone `recheck` binary and `recheck.yaml` are removed. | ||
| Configuration moves to the `recheck` block of `redocly.yaml`, read by the `redocly recheck` command in a later release. | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,126 @@ | ||
| # `recheck` | ||
|
|
||
| ## Introduction | ||
|
|
||
| The `recheck` command lints Markdown files for prose and structure problems. | ||
| It checks headings, sentences, links, images, and Markdoc tags against a set of rules. | ||
|
|
||
| Rules come from presets, such as `recheck/markdown`, that you add to the root `extends` in `redocly.yaml`. | ||
| The [`recheck` block](../configuration/reference/recheck.md) adjusts those rules. | ||
| With no `redocly.yaml`, the command uses `recheck/markdown`. | ||
| With a `redocly.yaml` that has neither, the command checks nothing and says so. | ||
| The command reads the root `recheck` config; settings under `apis.<name>` are not used. | ||
|
|
||
| ## Usage | ||
|
|
||
| ```bash | ||
| redocly recheck | ||
| redocly recheck <paths>... | ||
| redocly recheck [--fix] | ||
| redocly recheck [--readability] | ||
| redocly recheck [--generate-baseline] | ||
| redocly recheck [--generate-markdoc-schema] [--from=<path>...] [--output=<path>] [--check] | ||
| redocly recheck --help | ||
| ``` | ||
|
|
||
| {% admonition type="info" name="One action per run" %} | ||
| `--readability`, `--generate-baseline`, and `--generate-markdoc-schema` each replace the default lint action. | ||
| Use at most one of them in a run. | ||
| `--fix` works with the default lint action only. | ||
| {% /admonition %} | ||
|
|
||
| ## Options | ||
|
|
||
| | Option | Type | Description | | ||
| | ------------------------- | -------- | --------------------------------------------------------------------------------------------------------------------------------- | | ||
| | paths | [string] | Files or directories to lint. Default value is the current directory. | | ||
| | --check | boolean | Fail when the generated schema differs from the file in `--output`. Use with `--generate-markdoc-schema`. | | ||
| | --config | string | Path to the [configuration file](../configuration/index.md). | | ||
| | --fix | boolean | Apply fixes to the Markdown files. Alias: `-f`. | | ||
| | --format | string | Format for the report.<br />**Possible values:** `table`, `json`, `sarif`, `github-actions`. Default value is `table`. | | ||
| | --from | [string] | Module paths to read Markdoc tags from. Use with `--generate-markdoc-schema`. | | ||
| | --generate-baseline | boolean | Write a baseline file from the current errors. | | ||
| | --generate-markdoc-schema | boolean | Generate a Markdoc tag schema from theme modules. Needs `--from` and `--output`. | | ||
| | --help | boolean | Show help. | | ||
| | --lint-config | string | Specify the severity level for the configuration file.<br/> **Possible values:** `warn`, `error`, `off`. Default value is `warn`. | | ||
| | --max-problems | number | Maximum number of problems in the report; applies to every format. | | ||
| | --output | string | Output file for the generated schema. | | ||
| | --readability | boolean | Report readability scores instead of lint findings. | | ||
| | --rule | [string] | Run only these rules. Alias: `-r`. | | ||
| | --skip-rule | [string] | Skip these rules. | | ||
| | --stats | boolean | Print statistics per rule. Alias: `-s`. | | ||
| | --summary | string | Print a summary of the run.<br />**Possible values:** `json`, `text`. | | ||
| | --summary-path | string | Write the summary to this file. | | ||
| | --tags | [string] | Run only rules with these tags. | | ||
| | --version | boolean | Show version number. | | ||
|
|
||
| ## Examples | ||
|
|
||
| ### Lint a folder | ||
|
|
||
| Add a preset to the root `extends`: | ||
|
|
||
| ```yaml | ||
| extends: | ||
| - recheck/markdown | ||
| ``` | ||
|
|
||
| Then run the command on a folder: | ||
|
|
||
| ```bash | ||
| redocly recheck docs | ||
| ``` | ||
|
|
||
| The command lints every Markdown file under `docs` with the rules from `recheck/markdown`. | ||
| The report goes to stdout and progress messages go to stderr. | ||
|
|
||
| ### Turn off a rule | ||
|
|
||
| Set the rule to `off` in the `recheck` block: | ||
|
|
||
| ```yaml | ||
| extends: | ||
| - recheck/markdown | ||
| recheck: | ||
| rules: | ||
| recheck/line-length: off | ||
| ``` | ||
|
|
||
| The run applies every rule from `recheck/markdown` except `recheck/line-length`. | ||
|
|
||
| ### Annotate a pull request | ||
|
|
||
| ```bash | ||
| redocly recheck docs --format=github-actions | ||
| ``` | ||
|
|
||
| In a GitHub Actions workflow, this format adds each finding as an annotation on the changed line. | ||
| An error becomes `::error`, a warning `::warning`, and an info finding `::notice`. | ||
| Each finding is one line of output: | ||
|
|
||
| ```text | ||
| ::error title=recheck/single-h1,file=docs/index.md,line=2,endLine=2,col=1,endColumn=1::Multiple top-level headings in the same document | ||
| ``` | ||
|
|
||
| ### Use a baseline | ||
|
|
||
| A baseline records the current errors. | ||
| Later runs report only errors that the baseline does not list. | ||
|
|
||
| ```bash | ||
| redocly recheck docs --generate-baseline | ||
| ``` | ||
|
|
||
| The command writes `.redocly.recheck-baseline.yaml` next to `redocly.yaml`. | ||
| Commit the file. | ||
| Later runs pick it up automatically. | ||
|
|
||
| After you fix errors, generate the baseline again and commit the smaller file. | ||
|
|
||
| ### Check readability | ||
|
|
||
| ```bash | ||
| redocly recheck docs --readability | ||
| ``` | ||
|
|
||
| The command prints readability scores for each Markdown file instead of lint findings. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.