Skip to content

Commit 83c672a

Browse files
committed
Limit the length of names to 80 characters
1 parent db6dba3 commit 83c672a

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

index.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ import { unified } from 'unified';
1414

1515
import { BASELINE_LOW_TO_HIGH_DURATION } from 'compute-baseline';
1616

17+
// The longest name allowed, to allow for compact display.
18+
const nameMaxLength = 80;
19+
1720
// The longest description allowed, to avoid them growing into documentation.
1821
const descriptionMaxLength = 300;
1922

@@ -127,9 +130,12 @@ for (const [key, data] of yamlEntries('feature-group-definitions')) {
127130
data.status.baseline_high_date = String(highDate);
128131
}
129132

130-
// Ensure description is not too long.
133+
// Ensure name and description are not too long.
134+
if (data.name?.length > nameMaxLength) {
135+
throw new Error(`name in ${key}.yml is too long, ${data.name.length} characters. The maximum allowed length is ${nameMaxLength}.`);
136+
}
131137
if (data.description?.length > descriptionMaxLength) {
132-
throw new Error(`description in ${key}.yml is too long, ${data.description.length} characters. The maximum allowed length is ${descriptionMaxLength}.`)
138+
throw new Error(`description in ${key}.yml is too long, ${data.description.length} characters. The maximum allowed length is ${descriptionMaxLength}.`);
133139
}
134140

135141
// Ensure that only known group and snapshot identifiers are used.

0 commit comments

Comments
 (0)