mirror of
https://github.com/pbakaus/impeccable.git
synced 2026-09-14 23:26:39 +03:00
Reject scalar frontmatter coverage
AI assistance: Codex validated and addressed the Greptile scalar-frontmatter review finding with regression coverage.
This commit is contained in:
@@ -123,7 +123,7 @@ function hasCoverageValue(value) {
|
||||
return Object.values(value).some(hasCoverageValue);
|
||||
}
|
||||
if (typeof value === 'string') return value.trim().length > 0;
|
||||
return value !== null && value !== undefined;
|
||||
return false;
|
||||
}
|
||||
|
||||
export function checkDesignCoverage({ design, designPath, parseDesignMd }) {
|
||||
|
||||
@@ -216,6 +216,29 @@ describe('checkDesignCoverage', () => {
|
||||
assert.doesNotMatch(findings[0].summary, /typography|components/);
|
||||
});
|
||||
|
||||
it('does not count boolean or numeric frontmatter scalars as section coverage', () => {
|
||||
for (const colors of ['false', '0']) {
|
||||
const design = [
|
||||
'---',
|
||||
'name: X',
|
||||
`colors: ${colors}`,
|
||||
'typography:',
|
||||
' body:',
|
||||
' fontFamily: Inter',
|
||||
'components:',
|
||||
' button:',
|
||||
' backgroundColor: "#111111"',
|
||||
'---',
|
||||
'',
|
||||
'# Design System: X',
|
||||
'',
|
||||
].join('\n');
|
||||
const findings = checkDesignCoverage({ design, designPath: 'DESIGN.md', parseDesignMd });
|
||||
assert.deepEqual(ids(findings), ['design-md-coverage']);
|
||||
assert.match(findings[0].summary, /no colors section/);
|
||||
}
|
||||
});
|
||||
|
||||
it('reports nothing without a DESIGN.md', () => {
|
||||
assert.deepEqual(checkDesignCoverage({ design: null, parseDesignMd }), []);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user