Skip to main content
Documentation menu

Pillar — Code Quality & Validation

The Code Quality & Validation pillar (CQV-) measures linters, type checkers, formatters, pre-commit hooks, and escape-hatch policy.

Prefix: CQV- What it measures: automated checks that run before tests — linters, type checkers, formatters, pre-commit hooks, and the policy governing escape hatches like @ts-ignore.

Linters prevent whole classes of mistakes. Type checkers (TypeScript strict mode, mypy strict, Rust's borrow checker) catch bugs at author time. Formatters remove style debates from code review. Pre-commit hooks make all of the above automatic so nobody needs to remember.

Criteria in this pillar

CQV-010 — Linter configured and runnable

  • Level: 1 · Scope: application · Check: deterministic
  • A linter is configured for the primary language (ESLint, Ruff, golangci-lint, Clippy, etc.) and runs via pnpm lint (or equivalent) with a clean exit on current main.
  • Rationale: agents produce cleaner output when they can check their work locally before committing; without a linter, style drifts and review cost rises.
  • Evidence expected: config file present; package.json.scripts.lint (or equivalent) defined.

CQV-020 — Formatter configured with a single source of truth

  • Level: 2 · Scope: repository · Check: deterministic
  • A formatter (Prettier, Black, gofmt, rustfmt) has a project config and runs via a format / format:check command. .editorconfig present.
  • Rationale: style disputes consume review cycles agents cannot resolve. A formatter shifts the debate out of PR reviews.
  • Evidence expected: .prettierrc / pyproject.toml / rustfmt.toml; .editorconfig.

CQV-030 — TypeScript / typed language in strict mode

  • Level: 2 · Scope: application · Check: deterministic
  • For typed languages, strict mode is enabled (e.g., TypeScript strict: true, noUncheckedIndexedAccess: true; mypy strict = true). Type errors block CI.
  • Rationale: strict types catch 20% of bugs agents would otherwise ship — and provide a signal agents can use to ground refactors.
  • Evidence expected: tsconfig.json.compilerOptions.strict === true and related flags; mypy / ruff settings.

CQV-040 — Pre-commit hooks enforce formatter and linter

  • Level: 2 · Scope: repository · Check: deterministic
  • Husky + lint-staged (or pre-commit for Python) is configured to run format and lint on staged files.
  • Rationale: local enforcement prevents broken commits from reaching CI, shortening the feedback loop for agents.
  • Evidence expected: .husky/pre-commit or .pre-commit-config.yaml present and referenced in setup.

CQV-050 — No forbidden escape hatches in production code

  • Level: 3 · Scope: application · Check: deterministic
  • Source contains no @ts-ignore, @ts-nocheck, // eslint-disable-next-line (without rationale + tracking issue), # type: ignore, or equivalent silencers outside test fixtures.
  • Rationale: escape hatches accumulate into silent bugs agents cannot detect. A policy of "none without a tracked reason" keeps signal high.
  • Evidence expected: grep counts; flagged sites require inline rationale comment and ticket reference.

CQV-060 — No raw console.log / print in production paths

  • Level: 3 · Scope: application · Check: deterministic
  • Production code uses the project's logger; raw console.log / print / fmt.Println calls are absent or lint-gated.
  • Rationale: structured logs are queryable; ad-hoc prints are not. Agents debugging production incidents depend on structure.
  • Evidence expected: ESLint rule no-console configured; grep reports zero violations.

CQV-070 — Import ordering enforced

  • Level: 3 · Scope: application · Check: deterministic
  • Imports are grouped and ordered consistently (external → internal, alphabetical). Enforced by ESLint or equivalent.
  • Rationale: consistency reduces agent cognitive load on every read; diff noise shrinks.
  • Evidence expected: eslint-plugin-import or equivalent configured with ordering rules.

CQV-080 — Code complexity gates

  • Level: 4 · Scope: application · Check: deterministic
  • CI measures and fails on thresholds for cyclomatic complexity, file length, or cognitive complexity (e.g., SonarCloud, eslint-plugin-sonarjs, radon).
  • Rationale: complex functions are where agents introduce the most subtle bugs. Gating on complexity limits the blast radius.
  • Evidence expected: complexity config present in CI; at least one threshold defined and enforced.