Skip to content

Commit

Permalink
[FIX]: code duplication exclude
Browse files Browse the repository at this point in the history
  • Loading branch information
helabenkhalfallah committed Jun 2, 2024
1 parent d0e0fbb commit c04fd85
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 7 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.7.0",
"version": "1.8.0",
"description": "",
"main": "src/index.js",
"type": "module",
Expand Down
28 changes: 22 additions & 6 deletions src/kernel/duplication/CodeDuplicationAuditor.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,28 @@ const defaultOptions = {
'**/target/**',
'**/dist/**',
'**/__mocks__/*',
'**/husky/**',
'**/.husky/**',
'**/.vscode/.*',
'**/.idea/**',
'**/.gitlab/**',
'**/.github/**',
'eslint.*',
'jest.*',
'test',
'next.*',
'babel.*',
'**/eslint-config/**',
'**/jest-config/**',
'**/tailwind-config/**',
'**/typescript-config/**',
'**/.eslintrc.**',
'**/.gitlab-ci.**',
'**/tailwind.**',
'**/tsconfig.json',
'**/turbo.json',
'**/jest.**',
'**/__test__/**',
'**/**test.**',
'**/**.config.**',
'**/webpack/**',
'**/**webpack**',
'**/next**.**',
'babel',
'.*.d.ts.*'
]
};
Expand All @@ -45,6 +57,10 @@ const startAudit = async (directory, outputDir, fileFormat) => {
AppLogger.info(`[CodeDuplicationAuditor - inspectDirectory] outputDir: ${outputDir}`);
AppLogger.info(`[CodeDuplicationAuditor - inspectDirectory] fileFormat: ${fileFormat}`);

// add jscpd if not installed
execSync('npm i -g [email protected]');

// execute audit
const codeDuplicationCommand = `jscpd --silent --mode "${defaultOptions.mode}" --threshold ${defaultOptions.threshold} --reporters "${fileFormat}" --output "${outputDir}" --format "${defaultOptions.format}" --ignore "${defaultOptions.ignore.join(',')}" ${directory}`;
AppLogger.info(`[CodeDuplicationAuditor - inspectDirectory] jscpd script: ${codeDuplicationCommand}`);

Expand Down

0 comments on commit c04fd85

Please sign in to comment.