Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
SHA-25614467ybecause it can confuse some programs (that's what I read at least). GitHub and GitLab display a notice when the file doesn't have a newline at the end. (and flake8(python linter) gives an error)
-
GitBug527y@Olverine maybe this can help you
"The 'newline' character or more accurately 'end of line' character (<EOL>) means 'whatever comes after this point must be considered to be on another line'. With this interpretation — <EOL> is a line terminator — the last line of the file is effectively the last one with an <EOL>.
The problem is that most editors and IDEs have a different interpretation — <EOL> is a line separator — and, logically, default to not add an <EOL> at the end of the last line of a new file and, when they encounter an <EOL>, add a superfluous 'new line' after the real last line." -
@GitBug ues it makes sense but im kimda pissed that i've been debugging my code for days and just realized that the program is reading from a file with an empty line at the end. Which is causing a bug.
-
Bikonja23837yHow do you even get this problem? Never ever never wrote code without trimming your inputs (unless you need the non-trimmed input)... It's like hello world stuff.
-
@Bikonja Just didn't think about it. I mean, I wrote the file myself and thought I knew exactly what it contained. It was just gonna be a quick test so I just made it as simple as it could get.
Related Rants
Why do text editors have to add an empty line at the end of files? It is making me and my C++ programs confused!
undefined
confusion
editors