fix: Exempt ADR Links fields from the paragraph length rule (no-changelog) (#39384)

Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
Danny Martini 2026-09-23 11:33:35 +00:00 committed by GitHub
parent 98f012e268
commit dbc822ba8b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 35 additions and 2 deletions

View File

@ -532,6 +532,36 @@ describe('AdrConventionsRule', () => {
).toBe(true);
});
it('allows Links field lines longer than 100 characters', async () => {
addTestFile(
tmpDir,
'docs/adr/ADR-20260828-obtain-trigger-output-before-creating-the-execution.md',
validAdr({
title: 'Obtain trigger output before creating the execution',
date: '2026-08-28',
}),
);
addTestFile(
tmpDir,
'docs/adr/ADR-20260904-store-the-workflow-revision-that-ran-with-the-execution.md',
validAdr({
title: 'Store the workflow revision that ran with the execution',
date: '2026-09-04',
}),
);
addTestFile(
tmpDir,
'docs/adr/ADR-20260922-adopt-a-stable-interface.md',
validAdr({
relatedAdrs:
'ADR-20260828-obtain-trigger-output-before-creating-the-execution, ' +
'ADR-20260904-store-the-workflow-revision-that-ran-with-the-execution',
}),
);
await expect(rule.analyze(context())).resolves.toEqual([]);
});
it.each([
{
name: 'a missing Links field',

View File

@ -38,7 +38,7 @@ const MAX_PARAGRAPH_LINE_LENGTH = 100;
* - Use full ADR IDs in supersession metadata.
* - Add the required RFC, Documentation, and Related ADRs link fields.
* - Resolve local ADR references and allow references in external URLs.
* - Limit paragraph lines to 100 characters.
* - Limit paragraph lines before the Links section to 100 characters.
* - Apply structural rules to the root ADR template.
*/
export class AdrConventionsRule extends BaseRule<CodeHealthContext> {
@ -92,8 +92,12 @@ export class AdrConventionsRule extends BaseRule<CodeHealthContext> {
const violations: Violation[] = [];
const { filePath, relativePath, fileName } = file;
const isTemplate = relativePath === 'docs/ADR_TEMPLATE.md';
const headingResult = validateHeadings(file.tokens);
// Links fields hold ADR IDs and URLs, not prose. Their length is not limited.
const linksLine = headingResult.valid ? headingResult.indexes.at(-1)! : Infinity;
for (const { line, length } of findLongParagraphLines(file, MAX_PARAGRAPH_LINE_LENGTH)) {
if (line > linksLine) continue;
violations.push(
this.createViolation(
filePath,
@ -168,7 +172,6 @@ export class AdrConventionsRule extends BaseRule<CodeHealthContext> {
);
}
const headingResult = validateHeadings(file.tokens);
if (!headingResult.valid) {
violations.push(
this.createViolation(