How does EK9 enforce code quality at compile time?

← Code Quality · Ref: Q310

EK9 enforces code quality as a mandatory compilation step. If your code compiles, it has passed ALL quality gates. There is no separate linting, SAST scanning, or code review tool needed.

THE QUALITY PYRAMID (5 LAYERS)

Layer 1 - Grammar: dangerous constructs (break, continue, return, null, goto) removed from the language entirely.
Layer 2 - Type system: null safety, type coercion, operator correctness, purity enforcement.
Layer 3 - Code flow: unreachable code, uninitialised variables, guard completeness.
Layer 4 - Security: sanitized parameters, injection detection, purity for data integrity.
Layer 5 - Code quality: complexity, cohesion, coupling, naming, code smells, magic literals.

NO-WARNINGS PHILOSOPHY

EK9 has no warnings. Every check either passes or produces an error. This eliminates the industry pattern of accumulating thousands of ignored warnings. If the compiler is silent, every quality dimension has been satisfied.

VERTICAL INTEGRATION

Traditional projects use 15-20 separate tools: compiler, linter, SAST scanner, coverage tool, style checker, complexity analyser, dependency checker, and more. Each is optional, each has different configuration. EK9 collapses ALL of these into the compiler. One tool, absolute enforcement, no bypass.

WHY THIS MATTERS FOR TEAMS

Code review arguments about style, complexity, and naming disappear. The compiler has already decided. Teams focus on architecture and design instead of bikeshedding over formatting.

See Q311 for the full catalog of quality checks. See Q312 for complexity metrics. See Q313 for code smell detection. See Q321 for the quality report dashboard. See Q144 for how eliminating break/continue/return is part of the quality pyramid. See Q625 for why EK9 enforces a standard code format.
See Q693 for captured operator returns. See Q695 for named constants. See Q696 for complexity limits.
See Q728 for nesting depth boundary. See Q730 for data clump boundary. See Q731 for type traversal boundary. See Q756 for the fuzzing quality loop.

Example

defines module qa.codequality.compiletime

  defines function

    <?-
      A pure function that demonstrates passing all quality gates.
      If this compiles, it satisfies naming, complexity, coupling,
      and every other quality check automatically.
    -?>
    calculateDiscount() as pure
      ->
        originalPrice as Float
        discountPercent as Float
      <-
        discountedPrice as Float: originalPrice

      minimumDiscount <- 0.0
      maximumDiscount <- 100.0

      if discountPercent > minimumDiscount and discountPercent <= maximumDiscount
        reduction <- originalPrice * discountPercent / maximumDiscount
        discountedPrice: originalPrice - reduction

  defines program

    QualityAtCompileTimeDemo()
      stdout <- Stdout()

      fullPrice <- 99.99
      tenPercent <- 10.0
      salePrice <- calculateDiscount(fullPrice, tenPercent)

      stdout.println(`Original: ${fullPrice}`)
      stdout.println(`Discounted: ${salePrice}`)

Common mistakes

E50001 — Renaming the variable means later references to 'salePrice' become unresolved, triggering E50001. See ek9 -h E50001 for details.

Incorrect:

salePriceXYZ <- calculateDiscount(fullPrice, tenPercent)

Correct:

salePrice <- calculateDiscount(fullPrice, tenPercent)

E50001 — Removing the variable declaration means later references to the variable become unresolved, triggering E50001. See ek9 -h E50001 for details.

Incorrect:

calculateDiscount(fullPrice, tenPercent)

Correct:

salePrice <- calculateDiscount(fullPrice, tenPercent)
Other ways to ask this
  • Does EK9 replace SonarQube?
  • How does EK9 enforce quality without external tools?
  • What quality gates does the EK9 compiler check?

Coming from another language?

Java: SonarQube, Checkstyle, PMD, SpotBugs, JaCoCo, ErrorProne (all separate, all optional). Python: pylint, flake8, mypy, bandit, radon (all separate, all optional). Rust: clippy (built-in but warnings only, can be ignored). Go: go vet + staticcheck (some built-in, still separate tools). JavaScript: ESLint, TypeScript, SonarJS (all separate, all optional). EK9: ALL quality checks in the compiler, mandatory, no external tools, no configuration, no bypass.

Keywords: sonarqube, mandatory, pyramid, gate, enforce, compile, quality, clean-code, metric, warnings, vertical, integration