fix(policy): allow Jira keys in commit subjects

This commit is contained in:
Adam Moussa 2026-08-10 16:51:57 -04:00
parent 0d802eae33
commit 521d5bc6eb
No known key found for this signature in database
2 changed files with 6 additions and 10 deletions

View file

@ -181,7 +181,6 @@ jobs:
const desc = m[4];
if (!/^[a-z]/.test(desc)) errs.push('Commit description must start with a lowercase letter');
if (desc.endsWith('.')) errs.push('Commit description must not end with a period');
if (/\s+\((DEV|PLAT|SEC|AP)-\d+\)$/i.test(subject)) errs.push('Commit subject must not carry a Jira key suffix — only the PR title does');
return errs;
}

View file

@ -370,19 +370,16 @@ describe('validateCommitSubject', () => {
assert.deepEqual(v.validateCommitSubject('feat!: remove deprecated api'), []);
});
it('rejects subject with Jira key suffix', () => {
const errs = v.validateCommitSubject('fix: patch (DEV-123)');
assert.ok(errs.some(e => e.includes('Jira')), 'should reject Jira suffix: ' + errs.join('; '));
it('accepts subject with DEV Jira key suffix', () => {
assert.deepEqual(v.validateCommitSubject('fix: patch (DEV-123)'), []);
});
it('rejects subject with lowercase Jira key suffix (case-insensitive)', () => {
const errs = v.validateCommitSubject('fix: patch (dev-123)');
assert.ok(errs.some(e => e.includes('Jira')), 'lowercase Jira suffix should also be rejected: ' + errs.join('; '));
it('accepts subject with AP Jira key suffix', () => {
assert.deepEqual(v.validateCommitSubject('feat(frontend): scaffold vite spa and ci (AP-4)'), []);
});
it('rejects subject with plat Jira key suffix', () => {
const errs = v.validateCommitSubject('chore: update config (plat-5)');
assert.ok(errs.some(e => e.includes('Jira')), 'plat Jira suffix should be rejected: ' + errs.join('; '));
it('accepts subject with PLAT Jira key suffix', () => {
assert.deepEqual(v.validateCommitSubject('chore: update config (PLAT-5)'), []);
});
it('rejects non-conventional subject', () => {