-
Notifications
You must be signed in to change notification settings - Fork 37
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
Incorrect processing of YAML indentation #15
Comments
Hi Eric, There are no Ansible indentation standards (yet?). That Ansible YAML page is so inconsistent it's a prime example as to why I created standards in the first place. Whether you choose to have two spaces before your list items or none as we do is down to your organisation - if you wish to add a pull request that makes having two spaces before a hyphen (which is valid, and could be consistent with your own standards) a configurable item, then I would treat such a request favourably. Hope that makes sense, I absolutely understand your question and the answer is currently "that's how it's implemented" but it doesn't have to be forever (although if everyone came around to my way of thinking, then that'd work quite well ;) ) |
Hey Will, Thanks for your swift reply and believe me, I'm all in favor of standards. It's something I try to 'enforce' at my workplace as much as possible. As you indicated there's no real agreed standard so it's a 'anything goes' situation. Although it would be nice to have everyone adhere to your standard I'll invest some time to create a pull request adapting the code to take the indentation before a hyphen into account if so desired... configurable item as you indicated. I think it would make it less confusing for people like me if a test verifies 'all' valid configurations instead of 'gently enforcing' one. Kind regards, Eric V. |
Also, as long as you and your colleagues agree, what I think is irrelevant. And if one day the Ansible community agrees on a single standard, we'll likely modify our internal standard. If you are going to implement this, my thoughts are that it should be in config.ini - something like
Not sure I have a better way to do it, but welcome thoughts. From an Ansible point of view, spaces should be irrelevant as long as the yaml parser works. And it'll work with no, two or four or more spaces before a hyphen. |
Couldn't agree more :-) |
I'm not sure I agree with your last point - lots of different ways of writing yaml are valid. But not necessarily meeting an organisation's standards. I could run
Obviously I prefer the first ;) followed by the fourth. |
I imagine you would prefer the first one and if that would set a standard across the board for YAML indentation then I would implement at once... But I think that with the different ways of writing yaml come the differences in opinion and checking.... |
ansible-review and yamllint have conflicting results with indentation of lists. https://github.com/adrienverge/yamllint As "the" standard of ansible-review is only at v0.1 I figure it would not hurt to assimilate. Yamllint can be configured to co-exist with standard 0.1 using: |
I'd definitely accept a patch that used yamllint for the yaml validation. I'd still like to make it configurable though, not really sure how best to do that though - we don't really have anything configurable at the moment. Most people would probably favour a per-repo configuration (rather than the current global ansible-review configuration file) - perhaps a global config with per-repo overrides would make sense. My current org uses the yamllint approach as standard, I can't say I prefer it, but vim does autoindent for it anyway, so saves me some keystrokes. |
According to both YAML documentation and Ansible YAML syntax (http://docs.ansible.com/ansible/YAMLSyntax.html), the indentation that gets checked with the function files_should_be_indented is incorrect.
A warning is thrown if I have indentation at the - with a list of tags for example.
The warning disappears when I remove the two spaces in front of the dash at the tag, as such.
This doesn't follow Ansible YAML syntax as per the documentation, though it works apparently without any issues.
Can you advice on this, if it's intentional or not? Thanks in advance.
Kind regards,
Eric V.
The text was updated successfully, but these errors were encountered: