refactor: silence sonar
authorJérôme Benoit <jerome.benoit@sap.com>
Fri, 8 Sep 2023 21:38:36 +0000 (23:38 +0200)
committerJérôme Benoit <jerome.benoit@sap.com>
Fri, 8 Sep 2023 21:38:36 +0000 (23:38 +0200)
Signed-off-by: Jérôme Benoit <jerome.benoit@sap.com>
src/utils/Configuration.ts
src/utils/ErrorUtils.ts

index bf691fa8c1d96ffcb2da9ed44fc6f62ca977e098..8dc1f70a610dcb3f20de922c71fe2f8e5c1eae01 100644 (file)
@@ -568,21 +568,21 @@ export class Configuration {
     let logMsg: string;
     switch (error.code) {
       case 'ENOENT':
-        logMsg = `${fileType} file ${file} not found:`;
+        logMsg = `${fileType} file ${file} not found: `;
         break;
       case 'EEXIST':
-        logMsg = `${fileType} file ${file} already exists:`;
+        logMsg = `${fileType} file ${file} already exists: `;
         break;
       case 'EACCES':
-        logMsg = `${fileType} file ${file} access denied:`;
+        logMsg = `${fileType} file ${file} access denied: `;
         break;
       case 'EPERM':
-        logMsg = `${fileType} file ${file} permission denied:`;
+        logMsg = `${fileType} file ${file} permission denied: `;
         break;
       default:
-        logMsg = `${fileType} file ${file} error:`;
+        logMsg = `${fileType} file ${file} error: `;
     }
-    console.error(`${chalk.green(prefix)}${chalk.red(`${logMsg} `)}`, error);
+    console.error(`${chalk.green(prefix)}${chalk.red(logMsg)}`, error);
     throw error;
   }
 
index fea221e4fc4f371688a1d33960cc7cbd36d6219b..872348795e4838f6dc6571e3f0650c7a2da38820 100644 (file)
@@ -56,10 +56,11 @@ export const handleFileException = (
       logMsg = `${fileType} file ${file} error:`;
   }
   if (params?.consoleOut === true) {
+    logMsg = `${logMsg} `;
     if (params?.throwError) {
-      console.error(`${chalk.green(prefix)}${chalk.red(`${logMsg} `)}`, error);
+      console.error(`${chalk.green(prefix)}${chalk.red(logMsg)}`, error);
     } else {
-      console.warn(`${chalk.green(prefix)}${chalk.yellow(`${logMsg} `)}`, error);
+      console.warn(`${chalk.green(prefix)}${chalk.yellow(logMsg)}`, error);
     }
   } else if (params?.consoleOut === false) {
     if (params?.throwError) {