58

Weird question: Do you leave a blank line at the bottom of each file when you program?

Comments
  • 5
    I have atom editor setup to remove all trailing white-space and new lines on save .. so no.
  • 3
  • 16
    Yes, because that looks nicer in the github diff viewer.
  • 8
    Yes, because of lint. But I can see its usefulness in case of needed concatenation
  • 8
    Ye/, because vsCode does it and github stops complaining.
  • 2
    Till completion yes. At the end I like to trim this spaces and makes code sexy.
  • 1
    Every File gets a "#end of File" line
  • 3
    Always try to. Ms word spoiled me to ALWAYS leave a trailing empty line after images, tables, other objects bcz if you don't you'll have trouble inserting text below the object afterwards. I got into a habbit of leaving trailing newlines and paying xtra attention to additional whitespaces - all thanks to ms word.
  • 9
    @netikras is MS WORD your IDE of choice?
  • 0
    IDLE and Atom automatically do it for .py files
  • 1
    Just to shut the f* up f*ing eslint... there is no thing that I hate more (and love more) than eslint. F*ing beautiful bastard. Pimping my code and stuff.
  • 2
    POSIX definition of a file is (something like): lines of characters.

    POSIX definition of a line is zero or more characters ending with a newline character.

    By that definition, the empty file contains one newline character. And every file ends with one too.
  • 1
    I use Prettier which automatically formats *all* my code, and since prettier inserts a newline the answer is yes.
  • 0
    The IDE does what the IDE does.
  • 0
    no, but my IDE occasionally adds it (or it just gets there somehow via my editing), and quite the opposite: every time I notice it, i delete it. because I have some OCD tendencies, and dammit, EOF==EndOfCode==ClosingBrace!
  • 1
    @donnico I used to write a lot of texts for university and college. A LOT! So no, word isn't my ide
  • 0
    I used to simply not care about that final new line. I recently told VS-Code to care for me (in order for every file to be styled the same) so the situation remains unchanged. I still don't care ¯\_(ツ)_/¯
  • 0
    @eeee THIS! THIS IS THE REASON! Try using any POSIX tools without a trailing line break, and you will curse yourself to death wondering why things don't work as expected. And it is not just POSIX, Python's PEP8 says the last char of a file has to be a line break. ALWAYS END YOUR FILES IN A LINE BREAK (and thank me later 😉).
  • 0
    No my IDE does
  • 0
    No, imho having that line is kind of ugly. I have a visual studio plugin for refactoring which I primarily installed to remove those lines automatically.
Add Comment