Skip to content
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

feat: add markdown output format for lint command #1559

Merged
merged 11 commits into from
May 20, 2024
Merged

Conversation

lornajane
Copy link
Collaborator

@lornajane lornajane commented May 10, 2024

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

@lornajane lornajane requested a review from a team as a code owner May 10, 2024 09:13
Copy link

changeset-bot bot commented May 10, 2024

🦋 Changeset detected

Latest commit: 39b8eac

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

Copy link
Contributor

github-actions bot commented May 10, 2024

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

Copy link
Contributor

github-actions bot commented May 10, 2024

Coverage report

St.
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 39b8eac

@lornajane
Copy link
Collaborator Author

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 ⚠️ 🛑 or something
  • something else?

@tatomyr tatomyr changed the title feat: Add markdown output format for lint command feat: add markdown output format for lint command May 14, 2024
@lornajane lornajane requested a review from a team as a code owner May 17, 2024 09:47
docs/commands/lint.md Outdated Show resolved Hide resolved
docs/commands/lint.md Outdated Show resolved Hide resolved
Copy link
Contributor

@HCloward HCloward left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left a couple of suggestions, otherwise LGTM!

Copy link
Contributor

@tatomyr tatomyr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. Thanks!

@lornajane lornajane merged commit 546d482 into main May 20, 2024
32 checks passed
@lornajane lornajane deleted the lint-output-markdown branch May 20, 2024 08:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants