1515 pass
1616
1717
18- def code_check (): # noqa
18+ def code_check ():
1919 """Run pylama and check current file.
2020
2121 :return bool:
@@ -24,32 +24,38 @@ def code_check(): # noqa
2424 with silence_stderr ():
2525
2626 from pylama .core import run
27- from pylama .main import parse_options
28- from pylama .config import _override_options
27+ from pylama .config import parse_options
2928
3029 if not env .curbuf .name :
3130 return env .stop ()
3231
32+ linters = env .var ('g:pymode_lint_checkers' )
33+ env .debug (linters )
34+
35+ # Fixed in v0.9.3: these two parameters may be passed as strings.
36+ # DEPRECATE: v:0.10.0: need to be set as lists.
37+ if isinstance (env .var ('g:pymode_lint_ignore' ), str ):
38+ ignore = env .var ('g:pymode_lint_ignore' ).split (',' )
39+ else :
40+ ignore = env .var ('g:pymode_lint_ignore' )
41+ if isinstance (env .var ('g:pymode_lint_select' ), str ):
42+ select = env .var ('g:pymode_lint_select' ).split (',' )
43+ else :
44+ select = env .var ('g:pymode_lint_select' )
3345 options = parse_options (
34- force = 1 ,
35- ignore = env . var ( 'g:pymode_lint_ignore' ) ,
36- select = env . var ( 'g:pymode_lint_select' ) ,
46+ linters = linters , force = 1 ,
47+ ignore = ignore ,
48+ select = select ,
3749 )
38-
39- linters = env .var ('g:pymode_lint_checkers' , default = [])
40- if linters :
41- _override_options (options , linters = "," .join (linters ))
42-
43- for linter in dict (options .linters ):
44- opts = env .var ('g:pymode_lint_options_%s' % linter , silence = True )
45- if opts :
46- options .linters_params [linter ] = options .linters_params .get (linter , {})
47- options .linters_params [linter ].update (opts )
48-
49- if 'pylint' in options .linters_params :
50- options .linters_params ['pylint' ]['clear_cache' ] = True
5150 env .debug (options )
5251
52+ for linter in linters :
53+ opts = env .var ('g:pymode_lint_options_%s' % linter , silence = True )
54+ if opts :
55+ options .linters_params [linter ] = options .linters_params .get (
56+ linter , {})
57+ options .linters_params [linter ].update (opts )
58+
5359 path = os .path .relpath (env .curbuf .name , env .curdir )
5460 env .debug ("Start code check: " , path )
5561
0 commit comments