Skip to content

Commit dd06247

Browse files
committed
Merge pull request #241 from deshipu/master
Fix #240: Allow errors on empty files
2 parents 3dad6b5 + cc0a19f commit dd06247

2 files changed

Lines changed: 2 additions & 1 deletion

File tree

CHANGES.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ Changelog
55
1.x (unreleased)
66
----------------
77

8+
* Allow the checkers to report errors on empty files. (Issue #240)
89
* Fix ignoring too many checks when ``--select`` is used with codes
910
declared in a flake8 extension. (Issue #216)
1011

pep8.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1346,7 +1346,7 @@ def check_ast(self):
13461346
for name, cls, _ in self._ast_checks:
13471347
checker = cls(tree, self.filename)
13481348
for lineno, offset, text, check in checker.run():
1349-
if not noqa(self.lines[lineno - 1]):
1349+
if not self.lines or not noqa(self.lines[lineno - 1]):
13501350
self.report_error(lineno, offset, text, check)
13511351

13521352
def generate_tokens(self):

0 commit comments

Comments
 (0)