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 to stats command #1395

Merged
merged 13 commits into from
Jan 31, 2024

Conversation

lornajane
Copy link
Contributor

@lornajane lornajane commented Jan 16, 2024

What/Why/How?

I was answering a question about JSON format output containing not-JSON elements, and I also noticed #976 requesting markdown format output that could be used in other contexts, such as GitHub Job Sumaries.

So this pull request removes the output about which file is being stat-ed from being displayed by default - the stylish format keeps it as that one is human readable. The execution time output is also removed, this isn't used in all commands and breaks the other file formats such as JSON.

The pull request also adds a --format=markdown option to the stats command, to produce a markdown output. The original request was for the GitHub Job Summaries, but the format is generic markdown that could also be used elsewhere.

Example:

Feature Count
🚗 References 39
📦 External Documents 0
📈 Schemas 22
👉 Parameters 7
🔗 Links 0
➡️ Path Items 5
👷 Operations 8
🔖 Tags 3

Check yourself

  • Code is linted
  • Tested with redoc/reference-docs/workflows (internal)
  • All new/updated code is covered with tests

Security

  • Security impact of change has been considered
  • Code follows company security practices and guidelines

Copy link

changeset-bot bot commented Jan 16, 2024

🦋 Changeset detected

Latest commit: 704ba35

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
@redocly/cli Patch
@redocly/openapi-core Patch

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 Jan 16, 2024

Command Mean [s] Min [s] Max [s] Relative
redocly lint packages/core/src/benchmark/benches/rebilly.yaml 1.067 ± 0.009 1.051 1.076 1.00 ± 0.02
redocly-next lint packages/core/src/benchmark/benches/rebilly.yaml 1.066 ± 0.020 1.027 1.095 1.00

Copy link
Contributor

github-actions bot commented Jan 16, 2024

Coverage report

St.
Category Percentage Covered / Total
🟡 Statements 76.1% 4306/5658
🟡 Branches 65.75% 2236/3401
🟡 Functions 68.74% 695/1011
🟡 Lines 76.31% 4049/5306

Test suite run success

699 tests passing in 100 suites.

Report generated by 🧪jest coverage report action from 704ba35

@lornajane
Copy link
Contributor Author

Note: a list rather than tables because the tables would use a helper, which would add dependencies and maybe make the output less reusable. It's up for discussion though.

@lornajane lornajane force-pushed the stats-markdown-output-format branch from 2981a47 to 7c355bb Compare January 17, 2024 21:29
@lornajane lornajane marked this pull request as ready for review January 18, 2024 13:53
@lornajane lornajane requested a review from a team as a code owner January 18, 2024 13:53
@tatomyr tatomyr changed the title feat: Add markdown output format to stats command feat: add markdown output format to stats command Jan 18, 2024
@tatomyr
Copy link
Contributor

tatomyr commented Jan 18, 2024

Thank you for the MR! Will take a closer look at this soon.

@lornajane
Copy link
Contributor Author

Updated to reinstate the timing output for the stylish format.

@tatomyr
Copy link
Contributor

tatomyr commented Jan 24, 2024

a list rather than tables

Fine by me. We can always improve the output format later.

a helper, which would add dependencies

I don't think so. It's easy to describe a table in MD format without extra helpers. All you need to do is replace this:

`- ${metric}: ${total}`

with this:

`| ${metric} | ${total} |`

Am I missing something?

@lornajane
Copy link
Contributor Author

Hmm, maybe I should give that a go. I was taking the helper information from this article: https://github.blog/2022-05-09-supercharging-github-actions-with-job-summaries/

@lornajane lornajane force-pushed the stats-markdown-output-format branch from c145af3 to bcb1af1 Compare January 31, 2024 13:50
@lornajane lornajane force-pushed the stats-markdown-output-format branch from e546d64 to c0055de Compare January 31, 2024 14:09
@lornajane lornajane requested a review from a team as a code owner January 31, 2024 14:13
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 to me. Thank you!

@lornajane lornajane merged commit 4868a5b into main Jan 31, 2024
30 checks passed
@lornajane lornajane deleted the stats-markdown-output-format branch January 31, 2024 17:13
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.

3 participants