@@ -6,26 +6,26 @@ import {execPythonFile} from './../common/utils';
66import * as settings from './../common/configSettings' ;
77import { OutputChannel , window } from 'vscode' ;
88
9- var NamedRegexp = null ;
9+ let NamedRegexp = null ;
1010const REGEX = '(?<line>\\d+),(?<column>\\d+),(?<type>\\w+),(?<code>\\w\\d+):(?<message>.*)\\r?(\\n|$)' ;
1111
1212export interface IRegexGroup {
13- line : number
14- column : number
15- code : string
16- message : string
17- type : string
13+ line : number ;
14+ column : number ;
15+ code : string ;
16+ message : string ;
17+ type : string ;
1818}
1919
2020export interface ILintMessage {
21- line : number
22- column : number
23- code : string
24- message : string
25- type : string
26- possibleWord ?: string
27- severity ?: LintMessageSeverity
28- provider : string
21+ line : number ;
22+ column : number ;
23+ code : string ;
24+ message : string ;
25+ type : string ;
26+ possibleWord ?: string ;
27+ severity ?: LintMessageSeverity ;
28+ provider : string ;
2929}
3030export enum LintMessageSeverity {
3131 Hint ,
@@ -39,10 +39,10 @@ export function matchNamedRegEx(data, regex): IRegexGroup {
3939 NamedRegexp = require ( 'named-js-regexp' ) ;
4040 }
4141
42- var compiledRegexp = NamedRegexp ( regex , 'g' ) ;
43- var rawMatch = compiledRegexp . exec ( data ) ;
42+ let compiledRegexp = NamedRegexp ( regex , 'g' ) ;
43+ let rawMatch = compiledRegexp . exec ( data ) ;
4444 if ( rawMatch !== null ) {
45- return < IRegexGroup > rawMatch . groups ( )
45+ return < IRegexGroup > rawMatch . groups ( ) ;
4646 }
4747
4848 return null ;
@@ -59,17 +59,17 @@ export abstract class BaseLinter {
5959 public abstract runLinter ( filePath : string , txtDocumentLines : string [ ] ) : Promise < ILintMessage [ ] > ;
6060
6161 protected run ( command : string , args : string [ ] , filePath : string , txtDocumentLines : string [ ] , cwd : string , regEx : string = REGEX ) : Promise < ILintMessage [ ] > {
62- var outputChannel = this . outputChannel ;
63- var linterId = this . Id ;
62+ let outputChannel = this . outputChannel ;
63+ let linterId = this . Id ;
6464
6565 return new Promise < ILintMessage [ ] > ( ( resolve , reject ) => {
6666 execPythonFile ( command , args , cwd , true ) . then ( data => {
6767 outputChannel . append ( '#' . repeat ( 10 ) + 'Linting Output - ' + this . Id + '#' . repeat ( 10 ) + '\n' ) ;
6868 outputChannel . append ( data ) ;
69- var outputLines = data . split ( / \r ? \n / g) ;
70- var diagnostics : ILintMessage [ ] = [ ] ;
69+ let outputLines = data . split ( / \r ? \n / g) ;
70+ let diagnostics : ILintMessage [ ] = [ ] ;
7171 outputLines . filter ( ( value , index ) => index <= this . pythonSettings . linting . maxNumberOfProblems ) . forEach ( line => {
72- var match = matchNamedRegEx ( line , regEx ) ;
72+ let match = matchNamedRegEx ( line , regEx ) ;
7373 if ( match == null ) {
7474 return ;
7575 }
@@ -78,13 +78,13 @@ export abstract class BaseLinter {
7878 match . line = Number ( < any > match . line ) ;
7979 match . column = Number ( < any > match . column ) ;
8080
81- var sourceLine = txtDocumentLines [ match . line - 1 ] ;
82- var sourceStart = sourceLine . substring ( match . column - 1 ) ;
83- var endCol = txtDocumentLines [ match . line - 1 ] . length ;
81+ let sourceLine = txtDocumentLines [ match . line - 1 ] ;
82+ let sourceStart = sourceLine . substring ( match . column - 1 ) ;
83+ let endCol = txtDocumentLines [ match . line - 1 ] . length ;
8484
85- //try to get the first word from the startig position
86- var possibleProblemWords = sourceStart . match ( / \w + / g) ;
87- var possibleWord : string ;
85+ // try to get the first word from the startig position
86+ let possibleProblemWords = sourceStart . match ( / \w + / g) ;
87+ let possibleWord : string ;
8888 if ( possibleProblemWords != null && possibleProblemWords . length > 0 && sourceStart . startsWith ( possibleProblemWords [ 0 ] ) ) {
8989 possibleWord = possibleProblemWords [ 0 ] ;
9090 }
@@ -100,16 +100,16 @@ export abstract class BaseLinter {
100100 } ) ;
101101 }
102102 catch ( ex ) {
103- //Hmm, need to handle this later
104- //TODO:
105- var y = '' ;
103+ // Hmm, need to handle this later
104+ // TODO:
105+ let y = '' ;
106106 }
107107 } ) ;
108108
109109 resolve ( diagnostics ) ;
110110 } ) . catch ( error => {
111111 this . handleError ( this . Id , command , error ) ;
112- return [ ] ;
112+ resolve ( [ ] ) ;
113113 } ) ;
114114 } ) ;
115115 }
0 commit comments