ShtukbaseStandard
archivo del paquete→ .shtukbase/packages/hooks/hooks/one-project.ts

hooks/one-project.ts

14 líneas, 631 B.

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

  1. import { BLOCK, fileOwners, normHead } from '../lib/hooklib.ts';
  2. const { mode, except } = normHead(process.cwd(), '/norms/rules/hooks/HK-R03.md');
  3. const owners = Object.values(fileOwners()).filter((owner): owner is string =>
  4. typeof owner === 'string' && owner !== '' && !(Array.isArray(except) && except.includes(owner)));
  5. const projects = [...new Set(owners)].sort();
  6. if (projects.length > 1) {
  7. const finding = `HK-R03: one commit touches one project. Split the staged files by project (${projects.join(', ')}).`;
  8. if (mode === 'enforce') {
  9. console.error(finding);
  10. process.exit(BLOCK);
  11. }
  12. console.log(finding);
  13. }