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

checks/q01_indicator_method.ts

19 líneas, 1.3 KB.

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

  1. // QLT-R01. A live indicator says how it is measured: formula, unit and method; from «instrumented» on (category
  2. // working) also direction, cadence and owner. A retired indicator (category dropped) is not checked.
  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-r01', title: 'An indicator has a way of measuring', scope: 'indicators, except derived ones' };
  7. export function check(p: Project, res: Result): void {
  8. const c = (r: Parameters<typeof p.category>[0]) => p.category(r, 'IND');
  9. checkFields(p, res, 'IND', [
  10. { when: (r) => c(r) !== 'dropped', fields: ['formula', 'unit', 'method'], why: 'it is not said how to measure',
  11. fix: 'write the formula, the unit and the way of measuring (method) or derive the indicator', code: 'no-method' },
  12. { when: (r) => c(r) === 'working' || c(r) === 'done', fields: ['direction', 'cadence', 'owner'], why: 'the indicator is instrumented, but the measuring is not arranged',
  13. fix: 'write when it is better (direction), how often to measure (cadence) and who is responsible (owner), or return it to "Defined"', code: 'not-instrumented' },
  14. ]);
  15. }
  16. if (import.meta.main) main({ RULE, check });