File tree Expand file tree Collapse file tree 2 files changed +8
-9
lines changed Expand file tree Collapse file tree 2 files changed +8
-9
lines changed Original file line number Diff line number Diff line change @@ -29,23 +29,23 @@ export class Flake8 extends BaseLinter {
29
29
// destructuring not yet supported in vscode
30
30
// must be done manually
31
31
{
32
+ //TODO: parse null better
32
33
let match = lint . match ( this . getRegExp ( ) ) ;
34
+ if ( match == null ) {
35
+ this . warn ( "unparsed line:" ) ;
36
+ this . warn ( lint ) ;
37
+ return ;
38
+ }
33
39
matchProperties = {
34
40
completeMatch : match [ 0 ] ,
35
41
filepath : match [ 1 ] ,
36
42
line : parseInt ( match [ 2 ] ) - 1 ,
37
- column : parseInt ( match [ 3 ] ) ,
43
+ column : parseInt ( match [ 3 ] ) - 1 ,
38
44
severityKey : match [ 4 ] ,
39
45
message : match [ 5 ]
40
46
} ;
41
47
}
42
48
43
- if ( matchProperties . completeMatch == null ) {
44
- this . warn ( "unparsed line:" ) ;
45
- this . warn ( lint ) ;
46
- return ;
47
- }
48
-
49
49
let severity = this . _severityMap . has ( matchProperties . severityKey . substring ( 0 , 1 ) )
50
50
? this . _severityMap . get ( matchProperties . severityKey . substring ( 0 , 1 ) )
51
51
: DiagnosticSeverity . Error ;
Original file line number Diff line number Diff line change @@ -137,7 +137,6 @@ function validateTextDocument(textDocument: ITextDocument): void {
137
137
linter . setDocument ( textDocument ) ;
138
138
let cmd : string = linter . getCmd ( ) ;
139
139
140
- //TODO: Flake8 outputs to stderr, need to determine output buffer to parse
141
140
exec ( cmd , function ( error : Error , stdout : ArrayBuffer , stderr : ArrayBuffer ) {
142
141
if ( error . toString ( ) . length !== 0 ) {
143
142
connection . console . warn ( `[ERROR] File: ${ linter . getFilepath ( ) } - Error message: ${ error . toString ( ) } ` ) ;
@@ -147,7 +146,7 @@ function validateTextDocument(textDocument: ITextDocument): void {
147
146
let results : string [ ] = stdout . toString ( ) . split ( / \r ? \n / g) ;
148
147
results = linter . fixResults ( results ) ;
149
148
150
- // log error messages
149
+ // process linter output
151
150
let diagnostics : Diagnostic [ ] = [ ] ;
152
151
for ( let result of results ) {
153
152
let diagnostic = linter . parseLintResult ( result ) ;
You can’t perform that action at this time.
0 commit comments