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

Question: Any particular reason why trailing new lines are a problem? #152

Closed
pcastellazzi opened this issue Apr 19, 2016 · 3 comments
Closed

Comments

@pcastellazzi
Copy link

I do not think the removal of trailing new lines or spaces should be forced. Can we convert this to an option at least?

I am agree with the removal of trailing spaces, but some other user may not. For newlines there is a list of very good reasons to keep the last one here

@conorsch
Copy link
Contributor

conorsch commented May 3, 2016

The trailing newline linting error in YAML files threw me for a loop when I started using molecule as well. My objection is the same, namely that it feels distinctly anti-POSIX, but having a style pragma enforced by tooling is arguably better than bickering about preferences.

To put myself in the maintainers' shoes, adding an option to permit trailing newlines, but continue linting on all other attributes, would open the door for a nightmare of configurability. You can, after all, excuse directories from the linting, which may be the best course of action for you if you don't want to trim your YAML files. For spec and other files, doesn't seem like we have much recourse at this time.

@dhutty
Copy link
Contributor

dhutty commented May 3, 2016

Molecule's validator is not checking for trailing newlines (that the last line matches /\n$/), it is checking for trailing blank lines, that is that the last line of the file should not be empty (matches /^\n$/). This is an important distinction.

https://github.com/metacloud/molecule/blob/master/molecule/validators.py#L96

@dhutty dhutty closed this as completed May 3, 2016
@conorsch
Copy link
Contributor

conorsch commented May 6, 2016

it is checking for trailing blank lines

Thank you for clearing this up. Great explanation, and I now agree with the implementation.

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

3 participants