44import json
55import locale
66
7+ from os import path as op
78from pylama .main import parse_options
89from pylama .tasks import check_path
910
2021def check_file ():
2122 """ Check current buffer. """
2223 buf = interface .get_current_buffer ()
24+ rootpath = interface .eval_code ('getcwd()' )
2325
2426 async = int (interface .get_option ('lint_async' ))
2527 linters = interface .get_option ('lint_checker' )
@@ -33,15 +35,15 @@ def check_file():
3335 if async :
3436 add_task (
3537 run_checkers , callback = parse_result , title = 'Code checking' ,
36- buf = buf , options = options ,
38+ buf = buf , options = options , rootpath = rootpath ,
3739 )
3840
3941 else :
40- result = run_checkers (buf = buf , options = options )
42+ result = run_checkers (buf = buf , options = options , rootpath = rootpath )
4143 parse_result (result , buf = buf )
4244
4345
44- def run_checkers (callback = None , buf = None , options = None ):
46+ def run_checkers (callback = None , buf = None , options = None , rootpath = None ):
4547 """ Run pylama code.
4648
4749 :return list: errors
@@ -50,7 +52,10 @@ def run_checkers(callback=None, buf=None, options=None):
5052 pylint_options = '--rcfile={0} -r n' .format (
5153 interface .get_var ('lint_config' )).split ()
5254
53- return check_path (buf .name , options = options , pylint = pylint_options )
55+ path = buf .name
56+ if rootpath :
57+ path = op .relpath (path , rootpath )
58+ return check_path (path , options = options , pylint = pylint_options )
5459
5560
5661def parse_result (result , buf = None , ** kwargs ):
0 commit comments