mirror of
https://github.com/tiennm99/ccs.git
synced 2026-10-13 04:14:57 +00:00
fix(maintainability): enforce gate and correct loc metric
This commit is contained in:
1 parent
975c864f94
commit
2610971d2e
4 files changed
+9
-4
No files matched your search
@@ -2,7 +2,7 @@
|
|||||||
"sourceDirectory": "src",
|
"sourceDirectory": "src",
|
||||||
"largeFileThresholdLoc": 350,
|
"largeFileThresholdLoc": 350,
|
||||||
"typeScriptFileCount": 338,
|
"typeScriptFileCount": 338,
|
||||||
"locInSrc": 66207,
|
"locInSrc": 65869,
|
||||||
"processExitReferenceCount": 152,
|
"processExitReferenceCount": 152,
|
||||||
"synchronousFsApiReferenceCount": 842,
|
"synchronousFsApiReferenceCount": 842,
|
||||||
"largeFileCountOver350Loc": 52
|
"largeFileCountOver350Loc": 52
|
||||||
|
|||||||
@@ -204,7 +204,7 @@ All criteria achieved:
|
|||||||
The check mode supports a maintainability regression gate that blocks increases in:
|
The check mode supports a maintainability regression gate that blocks increases in:
|
||||||
- `process.exit` references
|
- `process.exit` references
|
||||||
- synchronous fs API references
|
- synchronous fs API references
|
||||||
- files over 350 LOC
|
- TypeScript files over 350 LOC
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -64,7 +64,7 @@
|
|||||||
"lint:fix": "eslint src/ --fix",
|
"lint:fix": "eslint src/ --fix",
|
||||||
"format": "prettier --write src/",
|
"format": "prettier --write src/",
|
||||||
"format:check": "prettier --check src/",
|
"format:check": "prettier --check src/",
|
||||||
"validate": "bun run typecheck && bun run lint:fix && bun run format:check && bun run test:all",
|
"validate": "bun run typecheck && bun run lint:fix && bun run format:check && bun run maintainability:check && bun run test:all",
|
||||||
"verify:bundle": "node scripts/verify-bundle.js",
|
"verify:bundle": "node scripts/verify-bundle.js",
|
||||||
"maintainability:baseline": "node scripts/maintainability-baseline.js --out docs/metrics/maintainability-baseline.json",
|
"maintainability:baseline": "node scripts/maintainability-baseline.js --out docs/metrics/maintainability-baseline.json",
|
||||||
"maintainability:check": "node scripts/maintainability-baseline.js --check docs/metrics/maintainability-baseline.json",
|
"maintainability:check": "node scripts/maintainability-baseline.js --check docs/metrics/maintainability-baseline.json",
|
||||||
|
|||||||
@@ -142,7 +142,12 @@ function countLines(content) {
|
|||||||
if (content.length === 0) {
|
if (content.length === 0) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
return content.split(/\r?\n/).length;
|
|
||||||
|
const lineBreakMatches = content.match(/\r\n|\n|\r/g);
|
||||||
|
const lineBreakCount = lineBreakMatches ? lineBreakMatches.length : 0;
|
||||||
|
const endsWithLineBreak = content.endsWith('\n') || content.endsWith('\r');
|
||||||
|
|
||||||
|
return endsWithLineBreak ? lineBreakCount : lineBreakCount + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
function countMatches(content, pattern) {
|
function countMatches(content, pattern) {
|
||||||
|
|||||||
Reference in new issue
Block a user