Skip to content

Introduce Yaml Lint check to prevent errors in yml files #6434

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

Merged
merged 1 commit into from
Nov 20, 2020
Merged

Conversation

sgiehl
Copy link
Member

@sgiehl sgiehl commented Nov 20, 2020

fixes #6433

@sgiehl
Copy link
Member Author

sgiehl commented Nov 20, 2020

@Findus23 I've added a Linter instead of adding a test with symfony. Tried the problem we had before and it's correctly marked as error. See 780b749
Guess that should be enough to prevent further problems like this, right?

Findus23
Findus23 previously approved these changes Nov 20, 2020
Copy link
Collaborator

@Findus23 Findus23 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This might even be better. Thanks for the change.

@Findus23
Copy link
Collaborator

Not sure how helpful error messages like this are:

======================
= Linting YAML files =
======================
Error: syntax error: expected <block end>, but found '<block sequence start>' (syntax)
Error: Process completed with exit code 1.

@sanchezzzhak
Copy link
Collaborator

@sgiehl Is it possible to make a more detailed error reports in YAML Lint?

@Findus23
Copy link
Collaborator

Findus23 commented Nov 20, 2020

Interestingly running yamllint regexes/**/*.yml locally gives nice error messages.

➜  ~/public_html/device-detector git:(ymllint) ✗ yamllint regexes/**/*.yml
regexes/device/mobiles.yml
  17576:5   error    syntax error: expected <block end>, but found '<block sequence start>' (syntax)

I see now that it shows an inline block in https://github.com/matomo-org/device-detector/pull/6434/files#diff-1c8c04e817f8cf3650ade17a6d2a3080093d82d90fc1ecd8e2919e1f74c0e88fR17576, but only after uncollapsing the mobiles.yml section.

And one has to look at https://github.com/matomo-org/device-detector/actions/runs/374180337 instead of https://github.com/matomo-org/device-detector/actions/runs/374180337 to see the nice overview of errors.

@sgiehl
Copy link
Member Author

sgiehl commented Nov 20, 2020

as @Findus23 mentioned. The errors should be highlighted in the diff on github. Guess there's not much that can be changed on the error messages. But imho that should be enough... we should at least now see if any yml file is broken

@sgiehl sgiehl marked this pull request as ready for review November 20, 2020 12:34
Copy link
Collaborator

@Findus23 Findus23 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good to me

@sgiehl sgiehl merged commit 1f55069 into master Nov 20, 2020
@sgiehl sgiehl deleted the ymllint branch November 20, 2020 13:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

Add a test using the Symfony yaml parser to parse all files
3 participants