Skip to content

Commit 64ed134

Browse files
committed
Fix mccabe
1 parent a384c68 commit 64ed134

1 file changed

Lines changed: 25 additions & 8 deletions

File tree

pylibs/pymode/lint.py

Lines changed: 25 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,26 +15,41 @@
1515
def check_file():
1616
checkers = get_option('lint_checker').split(',')
1717

18-
ignore = set(filter(lambda i: i, get_option('lint_ignore').split(',') +
19-
get_var('lint_ignore').split(',')))
20-
21-
select = set(filter(lambda s: s, get_option('lint_select').split(',') +
22-
get_var('lint_select').split(',')))
18+
ignore = set([
19+
i for i in (
20+
get_option('lint_ignore').split(',') +
21+
get_var('lint_ignore').split(','))
22+
if i
23+
])
24+
select = set([
25+
s for s in (
26+
get_option('lint_select').split(',') +
27+
get_var('lint_select').split(','))
28+
if i
29+
])
2330

2431
buffer = get_current_buffer()
32+
complexity = int(get_option('lint_mccabe_complexity') or 0)
2533

26-
add_task(run_checkers, checkers=checkers, ignore=ignore, title='Code checking', callback=parse_result, buffer=buffer, select=select)
34+
add_task(run_checkers, checkers=checkers, ignore=ignore,
35+
title='Code checking',
36+
callback=parse_result,
37+
buffer=buffer,
38+
select=select,
39+
complexity=complexity)
2740

2841

29-
def run_checkers(task=None, checkers=None, ignore=None, buffer=None, select=None):
42+
def run_checkers(task=None, checkers=None, ignore=None,
43+
buffer=None, select=None, complexity=None):
3044

3145
buffer = (task and task.buffer) or buffer
3246
filename = buffer.name
3347
result = []
3448

3549
pylint_options = '--rcfile={0} -r n'.format(get_var('lint_config')).split()
3650

37-
result = run(filename, ignore=ignore, select=select, linters=checkers, pylint=pylint_options)
51+
result = run(filename, ignore=ignore, select=select, linters=checkers,
52+
pylint=pylint_options, complexity=complexity)
3853

3954
if task:
4055
task.result = result
@@ -45,3 +60,5 @@ def run_checkers(task=None, checkers=None, ignore=None, buffer=None, select=None
4560
def parse_result(result):
4661
command(('let g:qf_list = %s' % repr(result)).replace('\': u', '\': '))
4762
command('call pymode#lint#Parse()')
63+
64+
# pymode:lint_ignore=W0622

0 commit comments

Comments
 (0)