@@ -40,9 +40,9 @@ module.exports = function (RED) {
4040 temp . track ( ) ;
4141
4242 // Require the Cloud Foundry Module to pull credentials from bound service
43- // If they are found then the api key is stored in the variable s_apikey .
43+ // If they are found then the api key is stored in the variable sAPIKey .
4444 //
45- // This separation between s_apikey and apikey is to allow
45+ // This separation between sAPIKey and apikey is to allow
4646 // the end user to modify the key credentials when the service is not bound.
4747 // Otherwise, once set apikey is never reset, resulting in a frustrated
4848 // user who, when he errenously enters bad credentials, can't figure out why
@@ -51,12 +51,12 @@ module.exports = function (RED) {
5151 // Taking this line out as codacy was complaining about it.
5252 // var services = cfenv.getAppEnv().services,
5353
54- var apikey , s_apikey ;
54+ var apikey , sAPIKey ;
5555
5656 var service = cfenv . getAppEnv ( ) . getServiceCreds ( / v i s u a l r e c o g n i t i o n / i) ;
5757
5858 if ( service ) {
59- s_apikey = service . apikey ;
59+ sAPIKey = service . apikey ;
6060 }
6161
6262 RED . httpAdmin . get ( '/watson-visual-recognition/vcap' , function ( req , res ) {
@@ -152,7 +152,7 @@ module.exports = function (RED) {
152152
153153 // If it is present the newly provided user entered key
154154 // takes precedence over the existing one.
155- apikey = s_apikey || this . credentials . apikey ;
155+ apikey = sAPIKey || this . credentials . apikey ;
156156 this . status ( { } ) ;
157157
158158 if ( ! apikey ) {
@@ -185,7 +185,8 @@ module.exports = function (RED) {
185185 {
186186 var err_desc = body . images [ 0 ] . error . description ;
187187 var err_id = body . images [ 0 ] . error . error_id ;
188- node . status ( { fill :'red' , shape :'ring' , text :'call to watson visual recognition v3 service failed' } ) ;
188+ node . status ( { fill :'red' , shape :'ring' ,
189+ text :'call to watson visual recognition v3 service failed' } ) ;
189190 msg . result = { } ;
190191 msg . result [ 'error_id' ] = err_id ;
191192 msg . result [ 'error' ] = err_desc ;
@@ -268,7 +269,7 @@ module.exports = function (RED) {
268269 } ) ;
269270 } ) ; // temp
270271 } else if ( feature === 'createClassifier' ) {
271- var list_params = { } ;
272+ var listParams = { } ;
272273 var asyncTasks = [ ] ;
273274 var prop = null ;
274275 for ( var k in msg . params )
@@ -278,7 +279,7 @@ module.exports = function (RED) {
278279 {
279280 // before pushing the function into the task array wrap the push
280281 // in an IIFE function, passing in the 'prop' parameter
281- ( function ( prop , list_params , msg ) {
282+ ( function ( prop , listParams , msg ) {
282283
283284 asyncTasks . push ( function ( callback ) {
284285 var buffer = msg . params [ prop ] ;
@@ -291,16 +292,16 @@ module.exports = function (RED) {
291292 callback ( 'open error on ' + prop ) ;
292293 }
293294 stream_buffer ( info . path , msg . params [ prop ] , function ( ) {
294- list_params [ prop ] = fs . createReadStream ( info . path ) ;
295+ listParams [ prop ] = fs . createReadStream ( info . path ) ;
295296 callback ( null , prop ) ;
296297 } ) ;
297298 } ) ; // temp.open
298299 } ) ; // asyncTasks.push
299300
300- } ) ( prop , list_params , msg ) ;
301+ } ) ( prop , listParams , msg ) ;
301302
302303 } else if ( prop === 'name' ) {
303- list_params [ prop ] = msg . params [ prop ] ;
304+ listParams [ prop ] = msg . params [ prop ] ;
304305 }
305306 } // for
306307
@@ -314,8 +315,8 @@ module.exports = function (RED) {
314315 console . log ( 'Parallel ended with error ' + error ) ;
315316 throw error ;
316317 }
317- for ( p in list_params )
318- params [ p ] = list_params [ p ] ;
318+ for ( p in listParams )
319+ params [ p ] = listParams [ p ] ;
319320 performAction ( params , feature , actionComplete2 ) ;
320321 } ) ;
321322 }
0 commit comments