@njong392/qa-duplicate-check
v1.3.0
Published
Configurable duplicate detector for function and variable patterns in JS/TS projects
Maintainers
Readme
@njong392/qa-duplicate-check
Config-driven duplicate detection for QA codebases.
It supports:
- Function duplicate detection (similarity-based)
- Variable duplicate detection (exact string-content match)
- Commit-time enforcement (
strictblock orpromptoverride)
Install
npm i -D @njong392/qa-duplicate-checkConfig
Create qa-duplicate-check.config.js in your project root:
module.exports = {
functionSimilarityThreshold: 0.92,
commitMode: 'strict', // 'strict' | 'prompt'
rules: [
{
name: 'QA Actions',
path: 'cypress/e2e/actions',
kind: 'functions', // 'functions' | 'variables'
include: ['.js'],
crossFile: true,
},
{
name: 'QA Pages',
path: 'cypress/e2e/pages',
kind: 'variables',
include: ['.js'],
crossFile: true,
},
],
};Commands
qa-duplicate-check commit
qa-duplicate-check checkcommit: checks staged changes and enforces based oncommitModecheck: checks staged changes and exits non-zero on duplicates
Husky integration
package.json:
{
"scripts": {
"dupcheck:commit": "qa-duplicate-check commit",
"dupcheck:check": "qa-duplicate-check check"
}
}.husky/pre-commit:
#!/bin/sh
npm run dupcheck:commit