How do I see the code quality report?

← Code Quality · Ref: Q321

EK9 generates a comprehensive HTML quality dashboard using the -t6 flag. This combines test results, coverage data, and code quality metrics in a single page.

GENERATING THE REPORT

  ek9 -t6 myproject.ek9

This runs all tests, collects coverage, calculates quality metrics, and generates an HTML dashboard.

FOUR QUALITY DIALS

The dashboard header shows four gauges:
1. Average cyclomatic complexity across all functions.
2. Maximum cyclomatic complexity (the worst function).
3. Average cognitive complexity across all functions.
4. Maximum cognitive complexity (the worst function).
Green zone means healthy. Yellow means approaching thresholds. Red means at risk.

MODULE BREAKDOWN

Each module shows:
- Number of types, functions, and programs.
- Module coupling count (how many external modules referenced).
- Module cohesion score.
- Per-type LCOM4 and efferent coupling.

FUNCTION-LEVEL DETAIL

Each function in the source view shows complexity badges:
- Cyclomatic complexity number.
- Cognitive complexity number.
- Nesting depth indicator.
- Coverage percentage (if tests were run with coverage).

ADDING PROFILING (-t6p)
Append 'p' to include profiling data:

  ek9 -t6p myproject.ek9

This adds call counts and timing badges to each function in the source view.

COVERAGE AND QUALITY ON ONE PAGE

The -t6 report combines coverage heatmaps with quality metrics. You can see which functions are both poorly tested AND highly complex, the highest risk areas in your codebase.

See Q206 for test coverage. See Q157 for running tests. See Q312 for complexity metrics. See Q322 for profiling data. See Q207 for test output formats. See Q629 for reading flame graphs.

Example

defines module qa.codequality.report

  defines function

    <?-
      Simple functions to demonstrate code that appears in a quality report.
      Each function would show its own complexity badge.
    -?>
    addTax() as pure
      ->
        netPrice as Float
        taxRate as Float
      <-
        grossPrice as Float: netPrice * (1.0 + taxRate)

    applyDiscount() as pure
      ->
        price as Float
        discountFraction as Float
      <-
        rtn as Float: price * (1.0 - discountFraction)

  defines program

    QualityReportDemo()
      stdout <- Stdout()

      basePrice <- 100.0
      standardTaxRate <- 0.20
      memberDiscount <- 0.10

      withTax <- addTax(basePrice, standardTaxRate)
      finalPrice <- applyDiscount(withTax, memberDiscount)

      stdout.println(`Base: ${basePrice}`)
      stdout.println(`With tax: ${withTax}`)
      stdout.println(`After discount: ${finalPrice}`)

      luxuryThreshold <- 500.0
      stdout.println(`Threshold: ${luxuryThreshold}`)
      isLuxury <- finalPrice > luxuryThreshold
      stdout.println(`Luxury: ${isLuxury}`)

Common mistakes

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

Incorrect:

addTax(basePrice, standardTaxRate)

Correct:

withTax <- addTax(basePrice, standardTaxRate)

E11064 — Comparing against a raw literal 500.0 hides the intent behind a 'magic number' and triggers E11064. Extract it to a named constant (luxuryThreshold <- 500.0) so the threshold documents itself. See ek9 -h E11064 for details.

Incorrect:

finalPrice > 500.0

Correct:

finalPrice > luxuryThreshold
Other ways to ask this
  • How do I get an EK9 quality dashboard?
  • What does the -t6 HTML report show?
  • How do I view complexity and coverage together?

Coming from another language?

Java: separate tools generate separate reports. JaCoCo for coverage HTML, SonarQube for quality dashboard, JMH for profiling. No single unified view. Python: coverage.py generates HTML, pylint generates text/JSON, no unified dashboard. Rust: tarpaulin for coverage, no quality dashboard. Go: go tool cover for coverage HTML, no quality dashboard. EK9: single -t6 flag generates unified HTML dashboard with coverage, complexity, cohesion, coupling, and profiling all on one page.

Keywords: dashboard, HTML, report, dials, t6, coverage, badge, clean-code, metric, quality, complexity, module