15
15
pass
16
16
17
17
18
- def code_check ():# noqa
18
+ def code_check ():
19
19
"""Run pylama and check current file.
20
20
21
21
:return bool:
@@ -24,32 +24,38 @@ def code_check(): # noqa
24
24
with silence_stderr ():
25
25
26
26
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
29
28
30
29
if not env .curbuf .name :
31
30
return env .stop ()
32
31
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' )
33
45
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 ,
37
49
)
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
51
50
env .debug (options )
52
51
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
+
53
59
path = os .path .relpath (env .curbuf .name ,env .curdir )
54
60
env .debug ("Start code check: " ,path )
55
61