question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Document how to avoid redundant newline at the end of `.copier-answers.yml`.

See original GitHub issue

Is your feature request related to a problem? Please describe.

Currently, there is a redundant newline at the end of the generated .copier-answers.yml which violate the hook end-of-file-fixer in pre-commit-hook.

Describe the solution you’d like

No redundant newline at the end of .copier-answers.yml.

Describe alternatives you’ve considered

N/A

Additional context

I tried to find the related code but failed, if with guidance, I am willing to fix this tiny issue if confirmed.

Issue Analytics

  • State:closed
  • Created 9 months ago
  • Reactions:2
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
yajocommented, Dec 16, 2022

Have you tried adding a - character at the end of the Jinja expression?

# Changes here will be overwritten by Copier
{{ _copier_answers|to_nice_yaml -}}
0reactions
yajocommented, Dec 19, 2022

The lack of that instruction is not a bug. It’s just something that will produce a file with 2 empty lines at the end, which is most likely not what you want, but is not really an invalid yaml file.

So, you can leave all the code and tests as they are. Just update the docs and readme.

Read more comments on GitHub >

github_iconTop Results From Across the Web

format add an extra line at the end of the file · Issue #282
When insert=false and the file already ends in a new line, it is removed as "redundant", which seems to be to be incorrect...
Read more >
No Newline at End of File - Thoughtbot
A source file that is not empty shall end in a new-line character, which shall not be immediately preceded by a backslash character....
Read more >
What's the significance of the "No newline at end of file" log?
It indicates that you do not have a newline (usually \n , aka LF or CRLF) at the end of file. That is,...
Read more >
What's the point in adding a new line to the end of a file?
It's not about adding an extra newline at the end of a file, it's about not removing the newline that should be there....
Read more >
On save new line added to end of file. How stop this?
I looked in settings but there are so many I am not sure where to look. When I save a file, PhpStorm adds...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found