ShtukbaseStandard
archivo del paquete→ .shtukbase/packages/quality/checks/q04_contract.ts

checks/q04_contract.ts

16 líneas, 1023 B.

El archivo tal como está en el paquete: el código y sus comentarios no se traducen.

  1. // QLT-R04. An indicator under the contract (scope: contract) that is not retired names the acceptance criterion
  2. // its threshold comes from (acceptance) and has a target.
  3. import type { Project, Result } from '../../collections/checks/lib/speclib.ts';
  4. import { main } from '../../collections/checks/lib/runner.ts';
  5. import { checkFields } from './lib/qlib.ts';
  6. export const RULE = { id: 'qlt-r04', title: 'A contract indicator refers to an acceptance criterion', scope: 'contract indicators, except derived ones' };
  7. export function check(p: Project, res: Result): void {
  8. checkFields(p, res, 'IND', [
  9. { when: (r) => String(r.fm.scope ?? '') === 'contract' && p.category(r, 'IND') !== 'dropped', fields: ['acceptance', 'target'],
  10. why: 'a contract indicator without an acceptance criterion or a target', fix: 'refer to an acceptance criterion (acceptance) and write the threshold in target, or make the indicator ours (scope: ours)', code: 'no-acceptance' },
  11. ]);
  12. }
  13. if (import.meta.main) main({ RULE, check });