From 9c3f13f936460f8ade0f36223d12b6395a6f58ba Mon Sep 17 00:00:00 2001 From: "hela.ben-khalfallah" Date: Mon, 3 Jun 2024 18:30:45 +0200 Subject: [PATCH] [EVOL]: duplication report enhances --- .../duplication/CodeDuplicationAuditor.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/kernel/duplication/CodeDuplicationAuditor.js b/src/kernel/duplication/CodeDuplicationAuditor.js index f827f31..2a5e557 100644 --- a/src/kernel/duplication/CodeDuplicationAuditor.js +++ b/src/kernel/duplication/CodeDuplicationAuditor.js @@ -1,5 +1,11 @@ +import fs from 'fs-extra'; import { execSync } from 'child_process'; import AppLogger from '../../commons/AppLogger.js'; +import AuditUtils from '../../commons/AuditUtils.js'; + +const { + getFileContent, +} = AuditUtils; const defaultOptions = { 'mode': 'strict', @@ -71,6 +77,18 @@ const startAudit = async (directory, outputDir, fileFormat) => { AppLogger.info(`[CodeDuplicationAuditor - inspectDirectory] execSync error: ${error.message}`); } + // modify generated html + if(fileFormat === 'html'){ + const outputHtmlPath = `${outputDir}/html/index.html`; + const outputHtmlContent = await getFileContent(outputHtmlPath); + if(outputHtmlContent?.length){ + const newOutputHtmlDocument = outputHtmlContent + .replace(//, '') + .replace(//, ''); + fs.writeFileSync(outputHtmlPath, newOutputHtmlDocument); + } + } + return true; } catch (error) { AppLogger.info(`[CodeDuplicationAuditor - inspectDirectory] error: ${error.message}`);