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

v8r failing due to megalinter not executing within project path #231

Open
estahn opened this issue Sep 15, 2022 · 1 comment
Open

v8r failing due to megalinter not executing within project path #231

estahn opened this issue Sep 15, 2022 · 1 comment

Comments

@estahn
Copy link

estahn commented Sep 15, 2022

see for more details oxsecurity/megalinter#1875

@chris48s
Copy link
Owner

I can't really speak to the megalinter side of this too much because it is not something I use myself, but I've read over the linked issue.

When it comes to using v8r locally (or in any environment, really), v8r will attempt to use the path/filename to find an appropriate schema, but it is fundamentally a guess and won't always be able to find a single schema. In some cases, there might be more than one pattern that matches. If I take megalinter out of the equation:

$ mkdir -p .github/workflows && touch .github/workflows/deploy.yml

$ npx v8r@latest .github/workflows/deploy.yml 
ℹ No config file found
ℹ Processing .github/workflows/deploy.yml
ℹ Found multiple possible schemas for .github/workflows/deploy.yml. Possible matches:
  Deployer Recipe
  A JSON schema for Deployer yaml recipes
  https://raw.githubusercontent.com/deployphp/deployer/master/src/schema.json

  GitHub Workflow
  YAML schema for GitHub Workflow
  https://json.schemastore.org/github-workflow.json

✖ Could not find a schema to validate .github/workflows/deploy.yml

side note: I think MegaLinter actually chooses to just squash errors like this https://github.com/oxsecurity/megalinter/blob/8907fdf0d5c48316a8091ea9cd96075f3dbf7d00/megalinter/descriptors/yaml.megalinter-descriptor.yml#L97

so even if you run it from the root of your repo, you'll need to manually give v8r a hint in this case by using either:

In general, v8r is quite heavily tied to running in the root of your repo for auto-detecting schemas and that's not really avoidable because that's where all the glob patterns on schemastore are relative to.

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

No branches or pull requests

2 participants