Repository: Redocly/redocly-cli
Pull request #1679 (2024-08-23 07:32:21)

chore: update issue template and add changesets validation, improve benchmark output
## What/Why/How?

Project maintenance chores:

- updated issue template and benchmark test.
- added changesets validation with Vale (as later they become part of the changelog).
- updated the contributing guide.
- improved benchmark output for release PRs.

## Reference

## Testing

## Screenshots (optional)

<img width="870" alt="image" src="https://github.com/user-attachments/assets/79af46af-5cf3-42bb-9193-02c59ad9c611">


## 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

- [x] Security impact of change has been considered
- [x] Code follows company security practices and guidelines


changeset-bot[bot]: ###  ⚠️  No Changeset found

Latest commit: 749e94a1bb5714c384b976ffa01052d267360c17

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. **If these changes should result in a version bump, you need to add a changeset.**

<details><summary>This PR includes no changesets</summary>

  When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

</details>

[Click here to learn what changesets are, and how to add one](https://github.com/changesets/changesets/blob/main/docs/adding-a-changeset.md).

[Click here if you're a maintainer who wants to add a changeset to this PR](https://github.com/Redocly/redocly-cli/new/chore/update-issue-template?filename=.changeset/tasty-apes-wait.md&value=---%0A%0A---%0A%0Achore%3A%20update%20issue%20temaplate%0A)


github-actions[bot]: | Command | Mean [ms] | Min [ms] | Max [ms] | Relative |
|:---|---:|---:|---:|---:|
| `redocly lint packages/core/src/benchmark/benches/rebilly.yaml` | 998.2 ± 19.3 | 971.3 | 1042.3 | 1.00 ± 0.03 |
| `redocly-next lint packages/core/src/benchmark/benches/rebilly.yaml` | 996.3 ± 18.4 | 966.6 | 1029.0 | 1.00 |

<!-- thollander/actions-comment-pull-request "latest-vs-next-comparison" -->
github-actions[bot]: <!-- jest coverage report action for options with hash 3339ae53a38c44382c0fb4491bdb282d -->

## Coverage report 



| <div title="Status of coverage:&#10; 🟢 - ok&#10; 🟡 - slightly more than threshold&#10; 🔴 - under the threshold">St.<sup>:grey_question:</sup></div> | Category   | Percentage | Covered / Total |
| :----------------------------------------------------------------------------------------------------------------------------------------------------: | :--------- | :--------- | :-------------: |
|                                                                           🟡                                                                           | Statements | 77.5%      |    4739/6115    |
|                                                                           🟡                                                                           | Branches   | 65.84%     |    1968/2989    |
|                                                                           🟡                                                                           | Functions  | 71.78%     |     781/1088    |
|                                                                           🟡                                                                           | Lines      | 77.69%     |    4471/5755    |


## Test suite run success
765 tests passing in 108 suites.

<p align="right">Report generated by <a href="https://github.com/ArtiomTr/jest-coverage-report-action">🧪jest coverage report action</a> from 749e94a1bb5714c384b976ffa01052d267360c17</p>

github-actions[bot]:            TIME CHART
┌──────────┬─────────────────────────────────┐
│ cli-1.00 │ ▓                               │
│ cli-1.01 │ ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓           │
│ cli-1.02 │ ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓               │
│ cli-1.03 │ ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓           │
│ cli-1.04 │ ▓▓▓▓▓▓▓▓▓▓▓▓                    │
│ cli-1.05 │ ▓▓▓▓▓▓▓▓▓▓▓▓                    │
│ cli-1.06 │ ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓                │
│ cli-1.07 │ ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓                 │
│ cli-1.08 │ ▓▓▓▓▓▓▓▓▓▓▓▓▓▓                  │
│ cli-1.09 │ ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓              │
│ cli-1.10 │ ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓          │
│ cli-1.11 │ ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓              │
│ cli-1.12 │ ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓       │
│ cli-1.13 │ ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓      │
│ cli-1.14 │ ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓ │
│ cli-1.15 │ ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓  │
│ cli-1.16 │ ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓    │
│ cli-1.17 │ ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓     │
│ cli-1.18 │ ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓      │
│ cli-1.19 │ ▓▓▓▓▓▓▓▓▓▓▓▓▓                   │
│ cli-1.20 │ ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓                 │
│ cli-1.21 │ ▓▓▓▓▓▓▓▓▓▓▓▓▓                   │
│ cli-next │ ▓▓▓▓▓▓▓▓▓▓▓▓▓▓                  │
└──────────┴─────────────────────────────────┘

<!-- thollander/actions-comment-pull-request "historical-versions-comparison" -->
github-actions[bot]: | CLI Version | Performance benchmark (test duration) |
|---|---|
| cli-1.00 | ▓                               |
| cli-1.01 | ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓          |
| cli-1.02 | ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓            |
| cli-1.03 | ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓          |
| cli-1.04 | ▓▓▓▓▓▓▓▓▓                       |
| cli-1.05 | ▓▓▓▓▓▓▓▓▓▓▓▓▓                   |
| cli-1.06 | ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓                |
| cli-1.07 | ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓                |
| cli-1.08 | ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓              |
| cli-1.09 | ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓        |
| cli-1.10 | ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓         |
| cli-1.11 | ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓            |
| cli-1.12 | ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓           |
| cli-1.13 | ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓        |
| cli-1.14 | ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓       |
| cli-1.15 | ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓    |
| cli-1.16 | ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓   |
| cli-1.17 | ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓     |
| cli-1.18 | ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓ |
| cli-1.19 | ▓▓▓▓▓▓▓▓▓                       |
| cli-1.20 | ▓▓▓▓▓▓▓▓▓▓▓▓▓▓                  |
| cli-1.21 | ▓▓▓▓▓▓▓▓▓▓▓▓                    |
| cli-next | ▓▓▓▓▓▓▓▓▓▓▓▓                    |
<!-- thollander/actions-comment-pull-request "historical-versions-comparison" -->

Patch:
diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md
index 9cb8d660..d2e8abbe 100644
--- a/.github/ISSUE_TEMPLATE/bug_report.md
+++ b/.github/ISSUE_TEMPLATE/bug_report.md
@@ -39,6 +39,10 @@ At a minimum, please state the specification version(s) you're using (e.g. 2.0,
 
 <!-- What version of `node.js` are you using? -->
 
+**OS, environment**
+
+<!-- What OS are you using? -->
+
 **Additional context**
 
 <!-- Add any other context about the problem here. -->
diff --git a/.github/workflows/performance.yaml b/.github/workflows/performance.yaml
index 9c21758a..dd952e87 100644
--- a/.github/workflows/performance.yaml
+++ b/.github/workflows/performance.yaml
@@ -66,6 +66,7 @@ jobs:
           cd benchmark/
           npm test # This command is generated and injected into package.json in the previous step.
           cat benchmark_check.md
+          npm run chart # Creates benchmark_chart.md with the performance bar chart.
         env:
           CI: true
           REDOCLY_TELEMETRY: off
@@ -74,5 +75,5 @@ jobs:
         if: ${{ github.event.pull_request.head.repo.full_name == github.repository }}
         uses: thollander/actions-comment-pull-request@v2
         with:
-          filePath: benchmark/benchmark_check.md
+          filePath: benchmark/benchmark_chart.md
           comment_tag: historical-versions-comparison
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 847522e9..a3c788ed 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -122,7 +122,7 @@ It only checks links within the local docs (it can't check links to other docs s
 
 ## Built-in rules changes
 
-After adding a new rule, make sure it is added to the `minimal`, `recommended` and `all` rulesets with appropriate severity levels. The defaults are `off` for `minimal` and `recommended` and `error` for `all`.
+After adding a new rule, make sure it is added to the `minimal`, `recommended`, `recommended-strict` (the same as the previous but with warnings turned into error) and `all` rulesets with appropriate severity levels. The defaults are `off` for `minimal` and `recommended` and `error` for `all`.
 Also add the rule to the `builtInRulesList` in [the config types tree](../packages/core/src/types/redocly-yaml.ts).
 
 Separately, open a merge request with the corresponding documentation changes.
@@ -149,11 +149,11 @@ The **redocly.yaml** file is the most flexible way of providing arguments. Pleas
 
 The application maintains the following exit codes.
 
-| Exit code | Description              |
-| --------- | ------------------------ |
-| 0         | Success                  |
-| 1         | Command execution error  |
-| 2         | Config resolving failure |
+| Exit code | Description               |
+| --------- | ------------------------- |
+| 0         | Success                   |
+| 1         | Command execution error   |
+| 2         | Config resolution failure |
 
 ## Tests
 
diff --git a/benchmark/.gitignore b/benchmark/.gitignore
index 0dcbb7e1..7d90fe0b 100644
--- a/benchmark/.gitignore
+++ b/benchmark/.gitignore
@@ -4,3 +4,4 @@ package-lock.json
 test-command.txt
 benchmark_check.md
 benchmark_check.json
+benchmark_chart.md
diff --git a/benchmark/chart.mjs b/benchmark/chart.mjs
new file mode 100644
index 00000000..e6caee62
--- /dev/null
+++ b/benchmark/chart.mjs
@@ -0,0 +1,26 @@
+import fs from 'node:fs';
+
+const content = fs.readFileSync('benchmark_check.json', 'utf8');
+const json = JSON.parse(content);
+const arr = json.results.map((r) => [
+  r.command.replace(/^node node_modules\/([^/]+)\/.*/, (_, cliVersion) => cliVersion),
+  r.mean,
+]);
+const min = Math.min(...arr.map(([_, mean]) => mean));
+const max = Math.max(...arr.map(([_, mean]) => mean));
+
+const constructBarForChart = (x) => {
+  const length = Math.floor(x * 30);
+  return '▓' + '▓'.repeat(length);
+};
+
+const output = [
+  '| CLI Version | Performance benchmark (test duration) |',
+  '|---|---|',
+  ...arr.map(
+    ([cliVersion, mean]) =>
+      `| ${cliVersion} | ${constructBarForChart((mean - min) / (max - min))} |`
+  ),
+].join('\n');
+
+process.stdout.write(output);
diff --git a/benchmark/package.json b/benchmark/package.json
index 7b6d23ea..9bb7001e 100644
--- a/benchmark/package.json
+++ b/benchmark/package.json
@@ -3,6 +3,7 @@
   "version": "1.0.0",
   "description": "Test benchmark for Redocly CLI",
   "scripts": {
+    "chart": "node chart.mjs > benchmark_chart.md",
     "make-test": "bash make-test-command.sh"
   },
   "dependencies": {
@@ -26,6 +27,8 @@
     "cli-1.17": "npm:@redocly/cli@1.17.1",
     "cli-1.18": "npm:@redocly/cli@1.18.1",
     "cli-1.19": "npm:@redocly/cli@1.19.0",
+    "cli-1.20": "npm:@redocly/cli@1.20.1",
+    "cli-1.21": "npm:@redocly/cli@1.21.1",
     "cli-next": "file:../redocly-cli.tgz"
   }
 }


Test patch:
diff --git a/.github/workflows/docs-tests.yaml b/.github/workflows/docs-tests.yaml
index ea1fef7f..6b8cb1ec 100644
--- a/.github/workflows/docs-tests.yaml
+++ b/.github/workflows/docs-tests.yaml
@@ -22,7 +22,7 @@ jobs:
       - uses: actions/checkout@v4
       - uses: errata-ai/vale-action@reviewdog
         with:
-          files: '["README.md", "docs"]'
+          files: '["README.md", "docs", ".changeset"]'
           filter_mode: file
           fail_on_error: true