файл пакета→ .shtukbase/packages/std-keep-a-changelog/checks/cl03_sections.ts
checks/cl03_sections.ts
16 строк, 889 Б.
Файл как есть в пакете: код и комментарии в нём не переводятся.
- // CL-R03: changes are grouped under the six types of the standard (Added, Changed, Deprecated, Removed, Fixed,
- // Security; setting `types`); a group is not empty.
- import { config, logs, PKG } from './kaclib.ts';
- import { finish, norm } from './lib/std.ts';
- const n = norm(PKG, 'CL-R03', 'enforce');
- const cfg = config();
- const out: string[] = [];
- if (n.active)
- for (const l of logs(cfg).logs)
- for (const r of l.releases)
- for (const s of r.sections) {
- if (!cfg.types.includes(s.name)) out.push(`${l.file}:${s.line}: the group "${s.name}" in ${r.unreleased ? 'Unreleased' : r.version} is not from the standard (${cfg.types.join(', ')})`);
- else if (!s.items && !cfg.allowEmptySections) out.push(`${l.file}:${s.line}: the empty group "${s.name}" in ${r.unreleased ? 'Unreleased' : r.version} — remove the heading or write the change`);
- }
- finish(n, out);