redocly-cli
redocly-cli copied to clipboard
feat: add markdown output format for lint command
What/Why/How?
Related to #1539, add markdown format output to the lint command, similar to what we have for stats. This could be used in a lint status report, a github job summary, or anywhere else where a renderable format is useful.
Testing
Caution: PR doesn't include tests yet, I'd like to get some feedback on the feature.
Screenshots (optional)
Markdown output example:
validating /home/lorna/temp/datasette.yaml...
# Lint: ../../temp/datasette.yaml
| Severity | Location | Problem | Message |
|---|---|---|---|
| error | line 18:5 | [security-defined](https://redocly.com/docs/cli/rules/security-defined/) | Every operation should have security defined on it or on the root level. |
| warning | line 5:1 | [info-license](https://redocly.com/docs/cli/rules/info-license/) | Info object should contain `license` field. |
/home/lorna/temp/datasette.yaml: validated in 11ms
❌ Validation failed with 1 error and 1 warning.
run `redocly lint --generate-ignore-file` to add all problems to the ignore file.
validating /home/lorna/temp/datasette.yaml...
Lint: ../../temp/datasette.yaml
| Severity | Location | Problem | Message |
|---|---|---|---|
| error | line 18:5 | security-defined | Every operation should have security defined on it or on the root level. |
| warning | line 5:1 | info-license | Info object should contain license field. |
/home/lorna/temp/datasette.yaml: validated in 11ms
❌ Validation failed with 1 error and 1 warning.
run redocly lint --generate-ignore-file to add all problems to the ignore file.
Check yourself
- [ ] Code changed? - Tested with redoc/reference-docs/workflows (internal)
- [ ] All new/updated code is covered with tests
- [ ] New package installed? - Tested in different environments (browser/node)
Security
- [ ] Security impact of change has been considered
- [ ] Code follows company security practices and guidelines
🦋 Changeset detected
Latest commit: 39b8eac11e526a0cab9577e6558b49a98ce7e842
The changes in this PR will be included in the next version bump.
This PR includes changesets to release 2 packages
| Name | Type |
|---|---|
| @redocly/openapi-core | Minor |
| @redocly/cli | Minor |
Not sure what this means? Click here to learn what changesets are.
Click here if you're a maintainer who wants to add another changeset to this PR
| Command | Mean [ms] | Min [ms] | Max [ms] | Relative |
|---|---|---|---|---|
redocly lint packages/core/src/benchmark/benches/rebilly.yaml |
961.9 ± 16.4 | 936.6 | 983.7 | 1.00 |
redocly-next lint packages/core/src/benchmark/benches/rebilly.yaml |
987.8 ± 33.3 | 946.6 | 1068.8 | 1.03 ± 0.04 |
Coverage report
St.:grey_question: |
Category | Percentage | Covered / Total |
|---|---|---|---|
| 🟡 | Statements | 77.23% | 4481/5802 |
| 🟡 | Branches | 67.51% | 2468/3656 |
| 🟡 | Functions | 70.86% | 744/1050 |
| 🟡 | Lines | 77.44% | 4215/5443 |
Test suite run success
735 tests passing in 102 suites.
Report generated by 🧪jest coverage report action from 39b8eac11e526a0cab9577e6558b49a98ce7e842
Other changes that I think we should consider for this feature:
- less "clutter" in the output, so the content can easily be piped to a file and reused in another context?
- emoji :warning: :stop_sign: or something
- something else?