Fix regexp compliancy for sonar static analyzer
authorJérôme Benoit <jerome.benoit@sap.com>
Wed, 25 Aug 2021 21:02:05 +0000 (23:02 +0200)
committerJérôme Benoit <jerome.benoit@sap.com>
Wed, 25 Aug 2021 21:02:05 +0000 (23:02 +0200)
Signed-off-by: Jérôme Benoit <jerome.benoit@sap.com>
src/utils/performance-storage/JSONFileStorage.ts

index af709d9105440e594894388a9bd1b77997cde7db..4b5085cb1787f005e023b45e64bffe0a31c5db9c 100644 (file)
@@ -10,7 +10,7 @@ export class JSONFileStorage extends Storage {
   }
 
   public storePerformanceStatistics(performanceStatistics: Statistics): void {
-    const performanceJSONFilePath = path.join(path.resolve(__dirname, '../../../'), this.storageURI.pathname.replace(/^\/|\/$/g, ''));
+    const performanceJSONFilePath = path.join(path.resolve(__dirname, '../../../'), this.storageURI.pathname.replace(/(?:^\/)|(?:\/$)/g, ''));
     fs.appendFile(performanceJSONFilePath, JSON.stringify(performanceStatistics, null, 2), 'utf8', (err) => {
       if (err) {
         FileUtils.handleFileException(this.logPrefix, 'Performance measurements', performanceJSONFilePath, err);