@@ -23,56 +23,57 @@ def pylsp_settings():
2323
2424@hookimpl
2525def pylsp_lint (workspace , document ):
26- config = workspace ._config
27- settings = config .plugin_settings ('flake8' , document_path = document .path )
28- log .debug ("Got flake8 settings: %s" , settings )
29-
30- ignores = settings .get ("ignore" , [])
31- per_file_ignores = settings .get ("perFileIgnores" )
32-
33- if per_file_ignores :
34- prev_file_pat = None
35- for path in per_file_ignores :
36- try :
37- file_pat , errors = path .split (":" )
38- prev_file_pat = file_pat
39- except ValueError :
40- # It's legal to just specify another error type for the same
41- # file pattern:
42- if prev_file_pat is None :
43- log .warning (
44- "skipping a Per-file-ignore with no file pattern" )
45- continue
46- file_pat = prev_file_pat
47- errors = path
48- if PurePath (document .path ).match (file_pat ):
49- ignores .extend (errors .split ("," ))
50-
51- opts = {
52- 'config' : settings .get ('config' ),
53- 'exclude' : settings .get ('exclude' ),
54- 'filename' : settings .get ('filename' ),
55- 'hang-closing' : settings .get ('hangClosing' ),
56- 'ignore' : ignores or None ,
57- 'max-line-length' : settings .get ('maxLineLength' ),
58- 'indent-size' : settings .get ('indentSize' ),
59- 'select' : settings .get ('select' ),
60- }
61-
62- # flake takes only absolute path to the config. So we should check and
63- # convert if necessary
64- if opts .get ('config' ) and not os .path .isabs (opts .get ('config' )):
65- opts ['config' ] = os .path .abspath (os .path .expanduser (os .path .expandvars (
66- opts .get ('config' )
67- )))
68- log .debug ("using flake8 with config: %s" , opts ['config' ])
69-
70- # Call the flake8 utility then parse diagnostics from stdout
71- flake8_executable = settings .get ('executable' , 'flake8' )
72-
73- args = build_args (opts )
74- output = run_flake8 (flake8_executable , args , document )
75- return parse_stdout (document , output )
26+ with workspace .report_progress ("flake8" ):
27+ config = workspace ._config
28+ settings = config .plugin_settings ('flake8' , document_path = document .path )
29+ log .debug ("Got flake8 settings: %s" , settings )
30+
31+ ignores = settings .get ("ignore" , [])
32+ per_file_ignores = settings .get ("perFileIgnores" )
33+
34+ if per_file_ignores :
35+ prev_file_pat = None
36+ for path in per_file_ignores :
37+ try :
38+ file_pat , errors = path .split (":" )
39+ prev_file_pat = file_pat
40+ except ValueError :
41+ # It's legal to just specify another error type for the same
42+ # file pattern:
43+ if prev_file_pat is None :
44+ log .warning (
45+ "skipping a Per-file-ignore with no file pattern" )
46+ continue
47+ file_pat = prev_file_pat
48+ errors = path
49+ if PurePath (document .path ).match (file_pat ):
50+ ignores .extend (errors .split ("," ))
51+
52+ opts = {
53+ 'config' : settings .get ('config' ),
54+ 'exclude' : settings .get ('exclude' ),
55+ 'filename' : settings .get ('filename' ),
56+ 'hang-closing' : settings .get ('hangClosing' ),
57+ 'ignore' : ignores or None ,
58+ 'max-line-length' : settings .get ('maxLineLength' ),
59+ 'indent-size' : settings .get ('indentSize' ),
60+ 'select' : settings .get ('select' ),
61+ }
62+
63+ # flake takes only absolute path to the config. So we should check and
64+ # convert if necessary
65+ if opts .get ('config' ) and not os .path .isabs (opts .get ('config' )):
66+ opts ['config' ] = os .path .abspath (os .path .expanduser (os .path .expandvars (
67+ opts .get ('config' )
68+ )))
69+ log .debug ("using flake8 with config: %s" , opts ['config' ])
70+
71+ # Call the flake8 utility then parse diagnostics from stdout
72+ flake8_executable = settings .get ('executable' , 'flake8' )
73+
74+ args = build_args (opts )
75+ output = run_flake8 (flake8_executable , args , document )
76+ return parse_stdout (document , output )
7677
7778
7879def run_flake8 (flake8_executable , args , document ):
0 commit comments