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

Not indenting array is not an error #374

Closed
rwxrob opened this issue Apr 12, 2021 · 3 comments
Closed

Not indenting array is not an error #374

rwxrob opened this issue Apr 12, 2021 · 3 comments

Comments

@rwxrob
Copy link

rwxrob commented Apr 12, 2021

The following is being incorrectly flagged as an error:

AnArray:
- Title: This is Fine
  Comment: Stop reporting this as an error
- Title: Considerations
  Comment: People should RTFS before making a "linter"

That is all.

@adrienverge
Copy link
Owner

Hello Rob Muhlestein,

Your problem is not very clear but it looks like you're not reporting a bug, rather expressing your personal taste on indentation. Some people like extra spaces at the end of lines, some others like dict keys to be unsorted, others don't use --- markers. Still, there are yamllint rules for these use-cases: trailing_spaces, key-ordering and document-start. Your call to use them or not. Your call to configure them to do what you like.

Maybe you'll find the documentation interesting: especially the indent-sequences part.

People should RTFS before making a "linter"

OK

@jagibson
Copy link

@adrienverge while the OP was kind of rude, the YAML failsafe schema does allow list items to be non-indented and recommends to do so "for generic YAML tools" - see yaml/pyyaml#234 (comment) for discussion. (In this specific case pyyaml is following the failsafe schema but yamllint is reporting it as invalid).

@perlpunk
Copy link

perlpunk commented May 25, 2022

@jagibson this has nothing to do with the Failsafe schema or any YAML schema.
This is about the YAML syntax, and it's independent of the used schema.
Zero-indented sequences are always valid.

The schema is about loading things like true, 123, null etc. as certain types or as simple strings. In the failsafe schema everything is loaded as a string.
http://blogs.perl.org/users/tinita/2018/01/introduction-to-yaml-schemas-and-tags.html

PyYAML does not use the Failsafe schema by default, btw, because it implements YAML 1.1, where the word "schema" wasn't even used in the spec.

but yamllint is reporting it as invalid

yamllint does not report it as invalid (as @adrienverge already explained).
It's a matter of taste, and it's configurable, and yamllint decided to prefer indented sequences by default.
It's a linter, not a validator.

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

4 participants