-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
opa fmt vs git -- trailing newline issue #1032
Labels
Comments
I agree this is annoying. What's the desired behaviour we want? |
Yeah, I suppose that would be it! 👍 |
kichristensen
added a commit
to kichristensen/opa
that referenced
this issue
Oct 24, 2018
opa fmt should only add one newline at the end of the file Fixes open-policy-agent#1032 Signed-off-by: Kim Christensen <kimworking@gmail.com>
@kichristensen thank you! 🎈 |
tsandall
added a commit
to tsandall/opa
that referenced
this issue
Nov 19, 2018
Previously trailing comments inside arrays, objects, and sets were not being formatted correctly. For example: [ 1, 2, # foo ] Would result in: [ 1, 2, # foo ] The problem was that when the sequence was ended, the comments were not being emitted. As a result when the comments were finally emitted, the indenting was wrong and the state of the formatter was not consistent (and so the closing bracket appeared on the same line the comment.) These changes modify the formatter to emit the comments when ending the sequence, as that's the point where the indenting state is known. Also, as part of these changes, the fix for extra newlines (open-policy-agent#1032) has been modified. Instead of changing the startLine and endLine behaviours (which are a bit sensitive) we just squash trailing newlines at the end of the formatting process. Fixes open-policy-agent#1060 Signed-off-by: Torin Sandall <torinsandall@gmail.com>
tsandall
added a commit
that referenced
this issue
Nov 19, 2018
Previously trailing comments inside arrays, objects, and sets were not being formatted correctly. For example: [ 1, 2, # foo ] Would result in: [ 1, 2, # foo ] The problem was that when the sequence was ended, the comments were not being emitted. As a result when the comments were finally emitted, the indenting was wrong and the state of the formatter was not consistent (and so the closing bracket appeared on the same line the comment.) These changes modify the formatter to emit the comments when ending the sequence, as that's the point where the indenting state is known. Also, as part of these changes, the fix for extra newlines (#1032) has been modified. Instead of changing the startLine and endLine behaviours (which are a bit sensitive) we just squash trailing newlines at the end of the formatting process. Fixes #1060 Signed-off-by: Torin Sandall <torinsandall@gmail.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
When committing
opa fmt
'ed files to git, it'll complain about the trailing newline:It's by no means a big deal, just a minor annoyance. Anyhow, I think it would be preferable if it wasn't so. 😃 What do you think?
The text was updated successfully, but these errors were encountered: