Merge pull request #448 from pbakaus/codex/fix-issue-443

Fix Google Fonts ignore-value suppression
This commit is contained in:
Paul Bakaus
2026-07-29 14:55:25 -07:00
committed by GitHub
4 changed files with 15 additions and 0 deletions
+3
View File
@@ -529,6 +529,9 @@ function extractFindingIgnoreValueRaw(finding, rule = normalizeIgnoreRule(findin
const primary = text.match(/Primary font:\s*([^()\n;]+)/i);
if (primary) return cleanIgnoreValueDisplay(primary[1]);
const googleLabel = text.match(/Google Fonts:\s*([^()\n;]+)/i);
if (googleLabel) return cleanIgnoreValueDisplay(googleLabel[1]);
const family = text.match(/font-family\s*:\s*["']?([^'",;\n]+)/i);
if (family) return cleanIgnoreValueDisplay(family[1]);
+3
View File
@@ -880,6 +880,9 @@ function extractFindingIgnoreValueRaw(finding, rule = normalizeIgnoreRule(findin
const primary = text.match(/Primary font:\s*([^()\n;]+)/i);
if (primary) return cleanIgnoreValueDisplay(primary[1]);
const googleLabel = text.match(/Google Fonts:\s*([^()\n;]+)/i);
if (googleLabel) return cleanIgnoreValueDisplay(googleLabel[1]);
const family = text.match(/font-family\s*:\s*["']?([^'",;\n]+)/i);
if (family) return cleanIgnoreValueDisplay(family[1]);
+6
View File
@@ -470,6 +470,7 @@ describe('filterFindings()', () => {
const findings = [
finding('overused-font', 1, { snippet: 'Primary font: Inter (86% of text)' }),
finding('overused-font', 2, { snippet: 'Primary font: Roboto' }),
finding('overused-font', 5, { snippet: 'Google Fonts: space grotesk' }),
finding('bounce-easing', 3, { snippet: 'animation: bounce-ball' }),
finding('bounce-easing', 4, { snippet: 'animation: wobble-card' }),
finding('side-tab', 3),
@@ -478,6 +479,7 @@ describe('filterFindings()', () => {
ignoreRules: [],
ignoreValues: [
{ rule: 'overused-font', value: 'inter' },
{ rule: 'overused-font', value: 'space grotesk' },
{ rule: 'bounce-easing', value: 'bounce-ball' },
],
minSeverity: 'warning',
@@ -574,6 +576,10 @@ describe('filterFindings()', () => {
extractFindingIgnoreValue(finding('overused-font', 1, { snippet: 'https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400' })),
'plus jakarta sans',
);
assert.equal(
extractFindingIgnoreValue(finding('overused-font', 1, { snippet: 'Google Fonts: space grotesk' })),
'space grotesk',
);
assert.equal(extractFindingIgnoreValue(finding('side-tab', 1)), '');
});
+3
View File
@@ -182,6 +182,7 @@ describe('cli/lib/impeccable-config', () => {
{ antipattern: 'design-system-color', file: join(root, 'src', 'demo.css'), line: 3, ignoreValue: '#8b5cf6' },
{ antipattern: 'design-system-color', file: join(root, 'src', 'real.css'), line: 4, ignoreValue: '#8b5cf6' },
{ antipattern: 'design-system-font', file: join(root, 'src', 'demo.css'), line: 5, ignoreValue: 'Avenir Next' },
{ antipattern: 'overused-font', file: join(root, 'src', 'fonts.css'), line: 6, snippet: 'Google Fonts: space grotesk' },
];
const filtered = filterDetectionFindings(findings, {
ignoreRules: [],
@@ -189,6 +190,7 @@ describe('cli/lib/impeccable-config', () => {
{ rule: 'overused-font', value: 'avenir next' },
{ rule: 'design-system-color', value: '*', files: ['src/demo.css'] },
{ rule: 'design-system-font', value: '*' },
{ rule: 'overused-font', value: 'space grotesk' },
],
});
@@ -236,6 +238,7 @@ describe('cli/lib/impeccable-config', () => {
test('extractFindingIgnoreValue handles fonts, Google font URLs, and motion snippets', () => {
expect(extractFindingIgnoreValue({ antipattern: 'overused-font', snippet: 'Primary font: Avenir Next (80% of text)' })).toBe('avenir next');
expect(extractFindingIgnoreValue({ antipattern: 'overused-font', snippet: 'https://fonts.googleapis.com/css2?family=Alumni+Sans:wght@700' })).toBe('alumni sans');
expect(extractFindingIgnoreValue({ antipattern: 'overused-font', snippet: 'Google Fonts: space grotesk' })).toBe('space grotesk');
expect(extractFindingIgnoreValue({ antipattern: 'bounce-easing', snippet: 'animation: bounce-ball 1s infinite' })).toBe('bounce-ball');
});