Open pylint-bot opened 8 years ago
Original comment by Claudiu Popa (BitBucket: PCManticore, GitHub: @PCManticore):
Sounds good. I presume the fix is easy, although I didn't check the exact implementation.
Original comment by Mike Frysinger (BitBucket: vapier, GitHub: @vapier?):
i glanced at pylint/checkers/format.py and it seemed pretty easy. update check_lines to do something like:
#!python
lines = lines.splitlines(True)
for line in lines:
...
if len(lines) > 1 and not lines[-1].strip('\r\n'):
self.add_message('trailing-newlines', line=i)
it gets a little tricky if you want to warn for each trailing newline (when there are more than one), but i don't think it needs to.
Original comment by Claudiu Popa (BitBucket: PCManticore, GitHub: @PCManticore):
Just for the record, I add the [easy] tag for issues which are friendly for new contributors. ;-)
Original comment by Mike Frysinger (BitBucket: vapier, GitHub: @vapier?):
sure. i'll try writing a diff, but i generally gave up on trying to use mercurial.
Original comment by Mike Frysinger (BitBucket: vapier, GitHub: @vapier?):
the good news is the new lint test caught a lot of trailing newlines in existing tests ;)
Originally reported by: Mike Frysinger (BitBucket: vapier, GitHub: @vapier?)
it's not uncommon for people to add trailing blank lines to files by accident. it'd be nice if pylint could warn about it. it already has a missing-final-newline check.