Skip to content

Commit 8c40056

Browse files
committed
refactor(audits): improve code readability in repo-hygiene.mjs and scanner.test.mjs
1 parent a918650 commit 8c40056

File tree

2 files changed

+14
-4
lines changed

2 files changed

+14
-4
lines changed

src/audits/repo-hygiene.mjs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,10 @@ function getRecentCommits(rootDir) {
249249
timeout: 5000,
250250
stdio: ['pipe', 'pipe', 'pipe'],
251251
});
252-
return output.trim().split('\n').filter((l) => l.trim().length > 0);
252+
return output
253+
.trim()
254+
.split('\n')
255+
.filter((l) => l.trim().length > 0);
253256
} catch {
254257
return [];
255258
}

tests/scanner.test.mjs

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,9 +68,16 @@ describe('scan() — empty repo', () => {
6868
it('should have no found checks in an empty repo (excluding git-history checks)', () => {
6969
// Git commit checks may inherit parent repo history in fixtures
7070
const gitChecks = new Set(['commit-messages', 'conventional-commits']);
71-
const nonGit = findings.filter(f => !gitChecks.has(f.id));
72-
const foundCount = nonGit.filter(f => f.found).length;
73-
assert.equal(foundCount, 0, `Expected 0 found, got ${foundCount}: ${nonGit.filter(f => f.found).map(f => f.id).join(', ')}`);
71+
const nonGit = findings.filter((f) => !gitChecks.has(f.id));
72+
const foundCount = nonGit.filter((f) => f.found).length;
73+
assert.equal(
74+
foundCount,
75+
0,
76+
`Expected 0 found, got ${foundCount}: ${nonGit
77+
.filter((f) => f.found)
78+
.map((f) => f.id)
79+
.join(', ')}`,
80+
);
7481
});
7582

7683
it('should include all standard check fields', () => {

0 commit comments

Comments
 (0)