Commits

Tamás Gulácsi  committed fc39c3d Merge

merge upstream

  • Participants
  • Parent commits 17d0f4e, d519e27

Comments (0)

Files changed (6)

 28547d53010248c55e77678087a7ef4195ab7a8a 0.4
 ea4d5abfd0c02a96dd10cfe7ec3e7a76a080f38f 0.5
 a914ae72b4eae171ca50b0ebda12765a68c7f744 0.6
+405ffe2bfa854ba85428ee1627f5e0b01246ee22 0.7
+b04dcad949573b1cef99392cf66caa5c55a0f930 0.8

File CONTRIBUTORS.txt

+Project created by Tarek Ziadé.
+
+Contributors:
+
+- Tamás Gulácsi
+- Nicolas Dumazet
+- Stefan Scherfke
+include CONTRIBUTORS.txt
+include README
 
 If *strict* option is set to **1**, any warning will block the commit. When
 *strict* is set to **0**, warnings are just displayed in the standard output.
+
+CHANGES
+=======
+
+0.7 - 2010-02-18
+----------------
+
+- Fix pep8 intialization when run through Hg
+- Make pep8 short options work when run throug the command line
+- skip duplicates when controlling files via Hg
+
+
+0.6 - 2010-02-15
+----------------
+
+- Fix the McCabe metric on some loops
+
+

File flake8/run.py

 """
 import sys
 import os
+import os.path
 
 from flake8.util import skip_file
 from flake8 import pep8
 
 DEFAULT_COMPLEXITY = 15
 
-
 def check_file(path, complexity=DEFAULT_COMPLEXITY):
-
     warnings = pyflakes.checkPath(path)
     warnings += pep8.input_file(path)
     warnings += mccabe.get_module_complexity(path, complexity)
 
 
 def _get_files(repo, **kwargs):
+    seen = set()
     for rev in xrange(repo[kwargs['node']], len(repo)):
         for file_ in repo[rev].files():
+            file_ = os.path.join(repo.root, file_)
+            if file_ in seen or not os.path.exists(file_):
+                continue
+            seen.add(file_)
             if not file_.endswith('.py'):
                 continue
             if skip_file(file_):
             yield file_
 
 
+class _PEP8Options(object):
+    exclude = select = []
+    show_pep8 = show_source = quiet = verbose = testsuite = False
+    no_repeat = False
+    counters = {}
+    messages = {}
+    ignore = pep8.DEFAULT_IGNORE
+
+
 def hg_hook(ui, repo, **kwargs):
-    pep8.process_options()
+    # default pep8 setup
+    pep8.options = _PEP8Options()
+    pep8.options.physical_checks = pep8.find_checks('physical_line')
+    pep8.options.logical_checks = pep8.find_checks('logical_line')
+    pep8.args = []
+
     warnings = 0
     for file_ in _get_files(repo, **kwargs):
         warnings += check_file(file_)
 
-    strict = ui.config('flake8', 'strict')
-    if strict is None:
-        strict = True
+    strict = ui.configbool('flake8', 'strict', default=True)
 
-    if strict.lower() in ('1', 'true'):
+    if strict:
         return warnings
 
     return 0
 setup(
     name="flake8",
     license="MIT",
-    version="0.6",
+    version="0.8",
     description="code checking using pep8 and pyflakes",
     author="Tarek Ziade",
     author_email="tarek@ziade.org",