@@ -13,35 +13,34 @@ def code_check():
1313
1414 """
1515
16- from pylama .main import parse_options
17- from pylama .tasks import check_path
16+ with silence_stderr ():
1817
19- if not env .curbuf .name :
20- env .stop ()
21- return False
18+ from pylama .main import parse_options
19+ from pylama .tasks import check_path
2220
23- options = parse_options (
24- ignore = env .var ('g:pymode_lint_ignore' ),
25- select = env .var ('g:pymode_lint_select' ),
26- linters = env .var ('g:pymode_lint_checkers' ),
27- )
21+ if not env .curbuf .name :
22+ return env .stop ()
2823
29- path = os .path .relpath (env .curbuf .name , env .curdir )
30- env .debug ("Start code check: " , path )
24+ options = parse_options (
25+ ignore = env .var ('g:pymode_lint_ignore' ),
26+ select = env .var ('g:pymode_lint_select' ),
27+ linters = env .var ('g:pymode_lint_checkers' ),
28+ )
3129
32- if getattr (options , 'skip' , None ) and any (p .match (path ) for p in options .skip ): # noqa
33- env .message ('Skip code checking.' )
34- env .debug ("Skipped" )
35- env .stop ()
36- return False
30+ path = os .path .relpath (env .curbuf .name , env .curdir )
31+ env .debug ("Start code check: " , path )
3732
38- if env .options .get ('debug' ):
39- from pylama .core import LOGGER , logging
40- LOGGER .setLevel (logging .DEBUG )
33+ if getattr (options , 'skip' , None ) and any (p .match (path ) for p in options .skip ): # noqa
34+ env .message ('Skip code checking.' )
35+ env .debug ("Skipped" )
36+ return env .stop ()
4137
42- with silence_stderr ():
43- errors = check_path (path , options = options ,
44- code = '\n ' .join (env .curbuf ) + '\n ' )
38+ if env .options .get ('debug' ):
39+ from pylama .core import LOGGER , logging
40+ LOGGER .setLevel (logging .DEBUG )
41+
42+ errors = check_path (
43+ path , options = options , code = '\n ' .join (env .curbuf ) + '\n ' )
4544
4645 env .debug ("Find errors: " , len (errors ))
4746 sort_rules = env .var ('g:pymode_lint_sort' )
0 commit comments