Commits

Ian Cordasco  committed d290f68

Fix #21. ``init`` can also be used elsewhere.

Sane defaults are awesome. Also, I hope mercurial uses similar commit messages
to git. ;)

  • Participants
  • Parent commits 779f12c
  • Branches fix_excludes

Comments (0)

Files changed (1)

File flake8/run.py

                 yield path
 
 
+def init(parse_argv=False, config_file=True, **kwargs):
+    global pep8style
+    pep8style = pep8.StyleGuide(parse_argv=parse_argv,
+                                config_file=config_file)
+
+
 def main():
-    global pep8style
-    pep8style = pep8.StyleGuide(parse_argv=True, config_file=True)
+    init(True)
     options = pep8style.options
     complexity = options.max_complexity
     builtins = set(options.builtins)
 
 
 def git_hook(complexity=-1, strict=False, ignore=None):
-    global pep8style
-    pep8style = pep8.StyleGuide(config_file=True)
-
+    init()
     _initpep8()
     if ignore:
         pep8.options.ignore = ignore
                     yield "%s.py" % filename
 
         def run(self):
-            global pep8style
-            pep8style = pep8.StyleGuide(config_file=True)
+            init()
 
             _initpep8()