@@ -32,7 +32,7 @@ let documents: TextDocuments = new TextDocuments();
3232documents . listen ( connection ) ;
3333
3434// After the server has started the client sends an initialize request. The server receives
35- // in the passed params the rootPath of the workspace plus the client capabilities.
35+ // in the passed params the rootPath of the workspace plus the client capabilities.
3636connection . onInitialize ( ( ) : InitializeResult => {
3737 return {
3838 capabilities : {
@@ -47,7 +47,7 @@ connection.onInitialize((): InitializeResult => {
4747} ) ;
4848
4949// The content of a CloudFormation document has saved. This event is emitted
50- // when the document get saved
50+ // when the document get saved
5151documents . onDidSave ( ( event ) => {
5252 console . log ( 'Running cfn-lint...' ) ;
5353 validateCloudFormationFile ( event . document ) ;
@@ -107,9 +107,6 @@ function validateCloudFormationFile(document: TextDocument): void {
107107 isValidating [ uri ] = true ;
108108
109109 let file_to_lint = Files . uriToFilePath ( uri ) ;
110- if ( file_to_lint . search ( / \/ t a s k s \/ / i) !== - 1 ) {
111- file_to_lint = file_to_lint . substr ( 0 , ( file_to_lint . search ( / \/ t a s k s \/ / i) ) ) ;
112- }
113110
114111 let is_cfn_regex = new RegExp ( '"?AWSTemplateFormatVersion"?\s*' ) ;
115112 let is_cfn = false ;
@@ -121,21 +118,20 @@ function validateCloudFormationFile(document: TextDocument): void {
121118 }
122119
123120 connection . console . log ( "Is CFN: " + is_cfn ) ;
124-
125- let args = `--format json --template ${ file_to_lint } ` ;
121+ let args = [ '--format' , 'json' , '--template' , file_to_lint ] ;
126122
127123 connection . console . log ( `running............. ${ Path } ${ args } ` ) ;
128124
129125 let child = spawn (
130- Path ,
131- args . split ( " " )
126+ Path ,
127+ args
132128 ) ;
133129
134130 let diagnostics : Diagnostic [ ] = [ ] ;
135131 let filename = uri . toString ( ) ;
136132 let start = 0 ;
137133 let end = Number . MAX_VALUE ;
138-
134+
139135 child . stderr . on ( "data" , ( data : Buffer ) => {
140136 let err = data . toString ( ) ;
141137 connection . console . log ( err ) ;
0 commit comments