8000 Fix mismatched type exception thrown by mccabe.py. · dannon/python-mode@559240f · GitHub
[go: up one dir, main page]

Skip to content

Commit 559240f

Browse files
committed
Fix mismatched type exception thrown by mccabe.py.
This bug is a variation of the same one reported in issue python-mode#447. Commit 00c6c75 on 2014-06-16 introduced this statement in plugin/pymode.vim: call pymode#default("g:pymode_lint_options_mccabe", \ {'complexity': 12}) That results in pymode/libs/pylama/lint/pylama_mccabe/mccabe.py throwing this exception: Run mccabe {'complexity': '12'} <traceback object at 0x101eb9688> Traceback (most recent call last): File "/Users/krader/Dropbox/dotfiles/vim/bundle/python-mode/pymode/libs/pylama/core.py", line 68, in run select=params.get("select", set()), params=lparams): File "/Users/krader/Dropbox/dotfiles/vim/bundle/python-mode/pymode/libs/pylama/lint/pylama_mccabe/__init__.py", line 20, in run return get_code_complexity(code, complexity, filename=path) or [] File "/Users/krader/Dropbox/dotfiles/vim/bundle/python-mode/pymode/libs/pylama/lint/pylama_mccabe/mccabe.py", line 267, in get_code_complexity for lineno, offset, text, check in McCabeChecker(tree, filename).run(): File "/Users/krader/Dropbox/dotfiles/vim/bundle/python-mode/pymode/libs/pylama/lint/pylama_mccabe/mccabe.py", line 247, in run if self.max_complexity < 0: TypeError: unorderable types: str() < int()
1 parent 1e95b8b commit 559240f

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

pymode/libs/pylama/lint/pylama_mccabe/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,5 @@ def run(path, code=None, params=None, **meta):
1616
"""
1717
from .mccabe import get_code_complexity
1818

19-
complexity = params.get('complexity', 10)
19+
complexity = int(params.get('complexity', 10))
2020
return get_code_complexity(code, complexity, filename=path) or []

0 commit comments

Comments
 (0)
0