Commits

Tarek Ziadé committed e599221

make sure pep8style is always initialized

Comments (0)

Files changed (1)

 
 def _initpep8():
     # default pep8 setup
+    global pep8style
+    if pep8style is None:
+        pep8style = pep8.StyleGuide(config_file=True)
     pep8.options = _PEP8Options()
     pep8.options.physical_checks = pep8.find_checks('physical_line')
     pep8.options.logical_checks = pep8.find_checks('logical_line')
 
 
 def git_hook(complexity=-1, strict=False, ignore=None):
-    global pep8style
-    pep8style = pep8.StyleGuide(config_file=True)
-
     _initpep8()
     if ignore:
         pep8.options.ignore = ignore
                     yield "%s.py" % filename
 
         def run(self):
-            global pep8style
-            pep8style = pep8.StyleGuide(config_file=True)
-
             _initpep8()
 
             # _get_python_files can produce the same file several