Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/signals/engine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4980,7 +4980,8 @@ export function hasClearNoIssueRationale(pr: Pick<PullRequestRecord, "title" | "
// `tests?[\s-]+only` extends the same rule to test-only PRs (regression/coverage-only diffs) — parallel
// to the docs-only hyphenation fix merged in #1905 and the test-only follow-up in #1993.
// `ci[\s-]+only` covers CI/workflow-only PRs using the same Conventional Commits spelling.
return /\b(?:no issue\s*(?:because\b|:)|no linked issue\s*(?:because\b|:)|no ticket\s*(?:because\b|:)|(?:maintenance|docs?[\s-]+only|tests?[\s-]+only|ci[\s-]+only|typo|chore|cleanup)\b)/i.test([pr.title, pr.body ?? ""].join(" "));
// `refactor[\s-]+only` covers internal refactors with no behavior change using the same spelling.
return /\b(?:no issue\s*(?:because\b|:)|no linked issue\s*(?:because\b|:)|no ticket\s*(?:because\b|:)|(?:maintenance|docs?[\s-]+only|tests?[\s-]+only|ci[\s-]+only|refactor[\s-]+only|typo|chore|cleanup)\b)/i.test([pr.title, pr.body ?? ""].join(" "));
}

function hasValidationNote(value: string): boolean {
Expand Down
13 changes: 13 additions & 0 deletions test/unit/signals-v2.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1787,6 +1787,19 @@ describe("hasClearNoIssueRationale ci-only spelling", () => {
});
});

describe("hasClearNoIssueRationale refactor-only spelling", () => {
it("recognizes hyphenated and spaced refactor-only rationales", () => {
expect(hasClearNoIssueRationale({ title: "refactor only: split helper", body: "" })).toBe(true);
expect(hasClearNoIssueRationale({ title: "refactor-only: split helper", body: "" })).toBe(true);
expect(hasClearNoIssueRationale({ title: "Rename queue module", body: "This is a refactor only rename." })).toBe(true);
});

it("still rejects unrelated PR text that mentions refactors without a rationale", () => {
expect(hasClearNoIssueRationale({ title: "Refactor queue processor", body: "Extracts shared helper." })).toBe(false);
expect(hasClearNoIssueRationale({ title: "Improve signal engine structure", body: "" })).toBe(false);
});
});

function snapshot(
id: string,
repositories: Array<{
Expand Down
Loading