Skip to content

Commit

Permalink
[FEATURE]: release VitalityVertex
Browse files Browse the repository at this point in the history
  • Loading branch information
helabenkhalfallah committed Jun 2, 2024
1 parent 45312f5 commit ed23938
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 20 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "code-health-meter",
"version": "1.9.0",
"version": "2.0.0",
"description": "",
"main": "src/index.js",
"type": "module",
Expand Down
6 changes: 3 additions & 3 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ const codeComplexityAnalysisResult = await CodeComplexityAuditor.startAudit(
CodeComplexityUtils
.writeCodeComplexityAuditToFile({
codeComplexityOptions: {
outputDir,
outputDir: `${outputDir}/code-complexity-audit`,
fileFormat: format, // html or json
},
codeComplexityAnalysisResult,
Expand All @@ -97,7 +97,7 @@ const codeCouplingAnalysisResult = await CodeCouplingAuditor.startAudit(srcDir);
CodeCouplingUtils
.writeCodeCouplingAuditToFile({
codeCouplingOptions: {
outputDir,
outputDir: `${outputDir}/code-coupling-audit`,
fileFormat: format, // html or json
},
codeCouplingAnalysisResult,
Expand All @@ -109,6 +109,6 @@ CodeCouplingUtils
*/
CodeDuplicationAuditor.startAudit(
srcDir,
outputDir,
`${outputDir}/code-duplication-audit`,
format
);
21 changes: 5 additions & 16 deletions src/kernel/duplication/CodeDuplicationAuditor.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { execSync } from 'child_process';
import fs from 'fs-extra';
import AppLogger from '../../commons/AppLogger.js';

const defaultOptions = {
Expand All @@ -16,6 +15,7 @@ const defaultOptions = {
'**/target/**',
'**/dist/**',
'**/__mocks__/*',
'**/mocks/*',
'**/.husky/**',
'**/.vscode/.*',
'**/.idea/**',
Expand Down Expand Up @@ -65,21 +65,10 @@ const startAudit = async (directory, outputDir, fileFormat) => {
AppLogger.info(`[CodeDuplicationAuditor - inspectDirectory] jscpd script: ${codeDuplicationCommand}`);

// generate report
execSync(codeDuplicationCommand);

// rename html folder
const temporaryHtmlReportPath = `${outputDir}/html`;
const finalHtmlReportPath = `${outputDir}/code-duplication`;
const temporaryJsonReportFilePath = `${outputDir}/jscpd-report.json`;
const finalJsonReportFilePath = `${outputDir}/CodeDuplicationReport.json`;

if(fs.existsSync(temporaryHtmlReportPath)) {
fs.renameSync(temporaryHtmlReportPath, finalHtmlReportPath);
}

// rename json folder
if(fs.existsSync(temporaryJsonReportFilePath)) {
fs.renameSync(temporaryJsonReportFilePath, finalJsonReportFilePath);
try{
execSync(codeDuplicationCommand);
}catch (error){
AppLogger.info(`[CodeDuplicationAuditor - inspectDirectory] execSync error: ${error.message}`);
}

return true;
Expand Down

0 comments on commit ed23938

Please sign in to comment.