chore: format with prettier

Signed-off-by: NotAShelf <raf@notashelf.dev>
Change-Id: Ib25c8bc022433f1dff87e9f6aeff4a726a6a6964
This commit is contained in:
raf 2026-02-07 16:14:47 +03:00
commit cfb114e529
Signed by: NotAShelf
GPG key ID: 29D95B64378DB4BF
12 changed files with 437 additions and 462 deletions

View file

@ -28,15 +28,27 @@ export class QualityBackend implements EngineBackend {
if (title.length < 10) {
signals.push({ name: 'very short title', positive: false, weight: 1.2 });
} else if (title.length > 200) {
signals.push({ name: 'excessively long title', positive: false, weight: 0.5 });
signals.push({
name: 'excessively long title',
positive: false,
weight: 0.5,
});
}
if (CONVENTIONAL_COMMIT.test(title)) {
signals.push({ name: 'conventional commit format', positive: true, weight: 1 });
signals.push({
name: 'conventional commit format',
positive: true,
weight: 1,
});
}
if (WIP_PATTERN.test(title) || WIP_PATTERN.test(body)) {
signals.push({ name: 'marked as work-in-progress', positive: false, weight: 1.5 });
signals.push({
name: 'marked as work-in-progress',
positive: false,
weight: 1.5,
});
}
// --- Body analysis ---
@ -52,7 +64,11 @@ export class QualityBackend implements EngineBackend {
} else if (body.length >= this.config.minBodyLength) {
signals.push({ name: 'adequate description', positive: true, weight: 1 });
if (body.length > 300) {
signals.push({ name: 'thorough description', positive: true, weight: 0.5 });
signals.push({
name: 'thorough description',
positive: true,
weight: 0.5,
});
}
}
@ -61,7 +77,11 @@ export class QualityBackend implements EngineBackend {
}
if (/^#{1,6}\s/m.test(body)) {
signals.push({ name: 'has section headers', positive: true, weight: 0.8 });
signals.push({
name: 'has section headers',
positive: true,
weight: 0.8,
});
}
// Checklists
@ -70,7 +90,11 @@ export class QualityBackend implements EngineBackend {
const checked = checklistItems.filter((i) => /\[x\]/i.test(i)).length;
const total = checklistItems.length;
if (total > 0 && checked === total) {
signals.push({ name: `checklist complete (${total}/${total})`, positive: true, weight: 1 });
signals.push({
name: `checklist complete (${total}/${total})`,
positive: true,
weight: 1,
});
} else if (total > 0) {
signals.push({
name: `checklist incomplete (${checked}/${total})`,
@ -85,7 +109,11 @@ export class QualityBackend implements EngineBackend {
// Not inherently positive or negative, but we flag it for visibility.
// If there's a description of the breaking change, it's better.
if (body.length > 100 && BREAKING_PATTERN.test(body)) {
signals.push({ name: 'breaking change documented', positive: true, weight: 0.8 });
signals.push({
name: 'breaking change documented',
positive: true,
weight: 0.8,
});
} else {
signals.push({
name: 'breaking change mentioned but not detailed',
@ -109,26 +137,46 @@ export class QualityBackend implements EngineBackend {
if (event.type === 'issue') {
if (/\b(steps?\s+to\s+reproduce|reproduction|repro\s+steps?)\b/i.test(body)) {
signals.push({ name: 'has reproduction steps', positive: true, weight: 1.3 });
signals.push({
name: 'has reproduction steps',
positive: true,
weight: 1.3,
});
}
if (/\b(expected|actual)\s+(behavior|behaviour|result|output)\b/i.test(body)) {
signals.push({ name: 'has expected/actual behavior', positive: true, weight: 1.2 });
signals.push({
name: 'has expected/actual behavior',
positive: true,
weight: 1.2,
});
}
if (
/\b(version|environment|os|platform|browser|node|python|java|rust|go)\s*[:\d]/i.test(body)
) {
signals.push({ name: 'has environment details', positive: true, weight: 1 });
signals.push({
name: 'has environment details',
positive: true,
weight: 1,
});
}
if (/\b(stack\s*trace|traceback|error|exception|panic)\b/i.test(body)) {
signals.push({ name: 'includes error output', positive: true, weight: 0.8 });
signals.push({
name: 'includes error output',
positive: true,
weight: 0.8,
});
}
// Template usage detection (common issue template markers)
if (/\b(describe the bug|feature request|is your feature request related to)\b/i.test(body)) {
signals.push({ name: 'uses issue template', positive: true, weight: 0.6 });
signals.push({
name: 'uses issue template',
positive: true,
weight: 0.6,
});
}
}
@ -143,14 +191,22 @@ export class QualityBackend implements EngineBackend {
// Migration or upgrade guide
if (/\b(migration|upgrade|breaking).*(guide|instruction|step)/i.test(body)) {
signals.push({ name: 'has migration guide', positive: true, weight: 1 });
signals.push({
name: 'has migration guide',
positive: true,
weight: 1,
});
}
// Before/after comparison
if (/\b(before|after)\b/i.test(body) && /\b(before|after)\b/gi.test(body)) {
const beforeAfter = body.match(/\b(before|after)\b/gi);
if (beforeAfter && beforeAfter.length >= 2) {
signals.push({ name: 'has before/after comparison', positive: true, weight: 0.7 });
signals.push({
name: 'has before/after comparison',
positive: true,
weight: 0.7,
});
}
}
}
@ -167,13 +223,21 @@ export class QualityBackend implements EngineBackend {
// Screenshots or images
if (/!\[.*\]\(.*\)/.test(body) || /<img\s/i.test(body)) {
signals.push({ name: 'has images/screenshots', positive: true, weight: 0.8 });
signals.push({
name: 'has images/screenshots',
positive: true,
weight: 0.8,
});
}
// --- Weighted scoring ---
if (signals.length === 0) {
return { impact: 'neutral', confidence: 0.1, reasoning: 'No quality signals detected.' };
return {
impact: 'neutral',
confidence: 0.1,
reasoning: 'No quality signals detected.',
};
}
const positiveWeight = signals.filter((s) => s.positive).reduce((s, x) => s + x.weight, 0);