package file→ .shtukbase/packages/quality/checks/q01_indicator_method.ts
checks/q01_indicator_method.ts
19 lines, 1.3 KB.
- // QLT-R01. A live indicator says how it is measured: formula, unit and method; from «instrumented» on (category
- // working) also direction, cadence and owner. A retired indicator (category dropped) is not checked.
- import type { Project, Result } from '../../collections/checks/lib/speclib.ts';
- import { main } from '../../collections/checks/lib/runner.ts';
- import { checkFields } from './lib/qlib.ts';
- export const RULE = { id: 'qlt-r01', title: 'An indicator has a way of measuring', scope: 'indicators, except derived ones' };
- export function check(p: Project, res: Result): void {
- const c = (r: Parameters<typeof p.category>[0]) => p.category(r, 'IND');
- checkFields(p, res, 'IND', [
- { when: (r) => c(r) !== 'dropped', fields: ['formula', 'unit', 'method'], why: 'it is not said how to measure',
- fix: 'write the formula, the unit and the way of measuring (method) or derive the indicator', code: 'no-method' },
- { when: (r) => c(r) === 'working' || c(r) === 'done', fields: ['direction', 'cadence', 'owner'], why: 'the indicator is instrumented, but the measuring is not arranged',
- 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' },
- ]);
- }
- if (import.meta.main) main({ RULE, check });