Repository: yevhen-m/flake8-fancy-header

Issue:
Header in empty file
I think plugin should allow empty files without header. 
It will be great if you change current behavior

Discussion:

Patch:
diff --git a/flake8_fancy_header/checker.py b/flake8_fancy_header/checker.py
index eaa9baa..94717b9 100644
--- a/flake8_fancy_header/checker.py
+++ b/flake8_fancy_header/checker.py
@@ -60,9 +60,6 @@ class FancyHeaderCheckerBefore37(BaseChecker):
     def run(self):
         body = self.tree.body
         if not body:
-            yield (
-                1, 1, self.message_missing, type(self),
-            )
             return
 
         if not isinstance(body[0], ast.Expr):
@@ -87,6 +84,9 @@ class FancyHeaderChecker(BaseChecker):
     def run(self):
         docstring = self.tree.docstring
         if not docstring:
+            if not self.tree.body:
+                return
+
             yield (
                 1, 1, self.message_missing, type(self),
             )


Test patch:
diff --git a/tests/test_checker.py b/tests/test_checker.py
index b229032..3eb8bfd 100644
--- a/tests/test_checker.py
+++ b/tests/test_checker.py
@@ -23,7 +23,11 @@ class CheckerTestCase(unittest.TestCase):
     def test_empty_module(self):
         module = ast.parse('')
         checker = FancyHeaderChecker(tree=module, filename='spam.py')
-        self.assertEqual(len(list(checker.run())), 1)
+        self.assertEqual(len(list(checker.run())), 0)
+
+        module = ast.parse('\n\n\n')
+        checker = FancyHeaderChecker(tree=module, filename='spam.py')
+        self.assertEqual(len(list(checker.run())), 0)
 
     def test_module_with_docstring(self):
         module = ast.parse('"Spam module."')