summaryrefslogtreecommitdiff
path: root/pylint/checkers/format.py
diff options
context:
space:
mode:
Diffstat (limited to 'pylint/checkers/format.py')
-rw-r--r--pylint/checkers/format.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/pylint/checkers/format.py b/pylint/checkers/format.py
index 4ed779054..9e353e6d5 100644
--- a/pylint/checkers/format.py
+++ b/pylint/checkers/format.py
@@ -1074,7 +1074,10 @@ class FormatChecker(BaseTokenChecker):
def _check_line_ending(self, line_ending, line_num):
# check if line endings are mixed
if self._last_line_ending is not None:
- if line_ending != self._last_line_ending:
+ # line_ending == "" indicates a synthetic newline added at
+ # the end of a file that does not, in fact, end with a
+ # newline.
+ if line_ending and line_ending != self._last_line_ending:
self.add_message("mixed-line-endings", line=line_num)
self._last_line_ending = line_ending