-
-
Notifications
You must be signed in to change notification settings - Fork 51
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
Linting with --ignore-file
doesn't have a deterministic output
#526
Comments
@lobocv would you like to take a stab at this, as it's your feature? |
Running it with some debug prints I see that the path on the error is sometimes different than the one you are ignoring: On the run with 6 errors (ignoring is failing) I get the following path
When it does work (5 errors, 1 ignored) I see the path is:
Seems like a bug in the code that generates the path? Looking at the openapi.yaml, it looks like the first one is the real path. @daveshanley do you know what could be going wrong here? EDIT: Ah I see. It looks like in one case, the $ref is being resolved and in the other case it's not. Looks like the linting behaviour is not consistent in it's output. |
@DimitrisKaramanis can you recreate this issue on the latest release of vacuum? @daveshanley has made some fixes to how paths are generated in the linting output and it may have resolved this issue. If so, feel free to close the ticket. |
I was able to recreate this issue on v0.13.1 😢 This is my rule which checks that all paths start with a version url-starts-with-major-version: About 1/4 times I run the lint I get a failure. When it fails, it matches on some object in the path rather than the path key:
but it should be
And it is, most of the time (and then the tests pass because I have that ignored) |
I was debugging this and it looks to be coming from this line. It assumes the thing you are matching is an object. For my rule, I am matching against the path keys with Edit: Maybe it's fine, the node that is matched has a Value of the path key but for some reason Not sure what the solution would be here @daveshanley but i'm happy to contribute to a fix. |
Okay I think I've nailed this down the the source. It seems to be an issue in the doctor building a mapping of line number to node objects here. Since this happens asynchronously, there is a race condition where the first node is the right one and the path reported by vacuum is correct. But in other cases, one of the nodes from deeper within the $ref is used and is assigned the line number of the $ref. I hope I am explaining this correctly. Unfortunately I don't know the solution. The I will see if I can recreate this as a test in the doctor |
I am in version 0.11.1 and I am trying to use
vacuum lint
with the--ignore-file
argument.When I lint the yaml file with the ignoring, sometimes I get 5 errors (5 valid ones and 1 ignored), but some other times I get 6 errors (none of them gets ignored).
I am executing it one time after the other without changing anything, so there is no difference between the two executions.
Also, I tried to do the same things with a smaller OpenAPI file (13 lines), but then it was working perfectly.
And I couldn't find any 'sequence` of how often I get the right and the wrong result. It seems random to me.
Below you can find both my demo OpenAPI file and the ignore file that I use.
OpenAPI file:
Ignore file:
The text was updated successfully, but these errors were encountered: