fix: enhance linting process to preserve existing files#2716
fix: enhance linting process to preserve existing files#2716tatomyr merged 13 commits intoRedocly:mainfrom
Conversation
🦋 Changeset detectedLatest commit: c7cad69 The changes in this PR will be included in the next version bump. This PR includes changesets to release 3 packages
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 |
|
Thank you for your contribution, @harshit078! Say, the starting ignore file: ignore-bar.yaml:
no-empty-servers:
- '#/servers'
operation-summary:
- '#/paths/~1items/get/summary'
ignore-foo.yaml:
no-empty-servers:
- '#/servers'Then you fix the ignore-bar.yaml:
no-empty-servers:
- '#/servers'
ignore-foo.yaml:
no-empty-servers:
- '#/servers' |
|
@tatomyr Yes, it will clean up entries for the linted API file but only for files that still have problems in current run. Got it, I'll add the test |
tatomyr
left a comment
There was a problem hiding this comment.
Left a couple of suggestions for improvement. Could you also check if the corresponding docs need to be updated?
tatomyr
left a comment
There was a problem hiding this comment.
Please do consider updating the corresponding docs in docs/@v2/commands/lint.md.
packages/cli/src/commands/lint.ts
Outdated
| totals.ignored += fileTotals.ignored; | ||
|
|
||
| if (argv['generate-ignore-file']) { | ||
| const apiAbsRef = isAbsoluteUrl(apiPath) ? apiPath : resolvePath(apiPath); |
There was a problem hiding this comment.
This check seems incorrect. The ref should align with mappedDefinitionName from Config.saveIgnore. I believe it would be cleaner to move this and the following lines into a new cleanup method next to saveIgnore and use it here.
Co-authored-by: Jacek Łękawa <164185257+JLekawa@users.noreply.github.com>
7c1dde5 to
034532a
Compare
|
@harshit078, your tests are failing. Could you fix that? |
|
@tatomyr pushed a fix for the failing test. thanks ! |
What/Why/How?
redocly lint api1.yaml --generate-ignore-fileupdates only entries related to api1.yaml and its referenced filesReference
lintcommand--generate-ignore-fileoption override previously generated ignore file #2652Testing
Screenshots (optional)
Check yourself
Security