Redocly / redocly-vs-code

Redocly VS Code extension
35 stars 6 forks source link

Extension does not take into account `.redocly.lint-ignore.yaml` file #61

Closed vanya909 closed 8 months ago

vanya909 commented 9 months ago

Actions:

Add some endpoint to .redocly.lint-ignore.yaml file

Expected behavior

Warning for this endpoint is disappeared in VSCode GUI

Actual behavior

Warning for this endpoint is still presented in VSCode GUI but it has disappeared in CLI (i.e. when I run redocly lint command)

jeremyfiel commented 9 months ago

confirmed.. the vs code extension does not resolve an ignore file.

The cli works as expected.

rules:
  rule/path-must-not-be-thing:
    severity: error
    message: Path must not be "thing"
    subject:
      type: Paths
    assertions:
      pattern: '/^\/thing/'

openapi: 3.0.3
info:
  title: blah
  version: 1.0.0
paths:
  /v1/thing:
    get:
      summary: a summary
      description: a description
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema: {}
 # lint-ignore
./rule-error.yml:
  rule/path-must-not-be-thing:
    - '#/paths/~1v1~1thing'
$ redocly lint --config redocly.yaml ~/downloads/rule-error.yml --format stylish
validating C:/Users/fieljere/downloads/rule-error.yml...
C:/Users/fieljere/downloads/rule-error.yml: validated in 10ms

Woohoo! Your API description is valid. 🎉
1 problem is explicitly ignored.

image

adamaltman commented 8 months ago

Maybe the VS Code extension needs to set the config of the ignore file...

https://github.com/Redocly/redocly-cli/blob/918f570203e31dda9c9fe38548ab559119b686b3/packages/core/src/config/config.ts#L117

@tatomyr ?

I also hit this issue when using the extension.

tatomyr commented 8 months ago

@adamaltman the extension resolves config correctly (including the ignore file), but the linter isn't taking it into account for some reason. Might be some kind of pointers mismatch due to different environments.

RomanHotsiy commented 8 months ago

@tatomyr @adamaltman here is the fix: https://github.com/Redocly/openapi-vs-code/pull/209

cc @lornajane

tatomyr commented 8 months ago

Thanks @RomanHotsiy! Will include this into today's release.