Coverage

Coverage shows how much of the code is specified. For each code symbol it counts the anchors of each artifact type that point to it. Links between specs do not count, see Two views on the same data.

Which symbols count

Coverage counts symbols that carry behaviour: functions, methods, classes and components. Constants, variables, type declarations, interfaces, re-exports and test code are not counted, also when they carry anchors. In the Weatherreport demo this leaves 153 of 243 symbols.

An anchor counts when it resolves (ok) and its spec has a counting status. The reviewer checkbox in the Specs view toolbar switches between the two views:

ViewCounts specs with status
Auditor (checkbox off)approved
Reviewer (checkbox on)draft, review, approved

Each symbol gets one of these states:

StateMeaning
uncoveredNo counting anchor.
partialCounting anchors, but not of every type in the trace chain.
coveredAnchors of every type in the chain, at least one of them suspect.
trace completeAnchors of every type in the chain, none suspect.

Read the coverage tile

The toolbar of the Specs view shows the coverage of the project, for example 3.3 % anchored · 5/153 · strict 0.7 %.

PartMeaning
anchoredShare of symbols with at least one counting anchor.
5/153Anchored symbols of all symbols that count.
strictShare of symbols that are covered or trace complete.
URS FS TCShare of symbols with at least one anchor of this type.
⚠ N suspectSymbols with a suspect counting anchor. A click opens the gap list with the suspect filter.

A click on the tile opens Coverage Drill-Down:

Coverage Drill-Down with the counts and the five worst and best covered clusters

The first line repeats the counts, with the number of partial symbols. Bottom 5 — worst coverage and Top 5 — best coverage list clusters of the graph with their share of anchored symbols. A click on a cluster opens the Graph view with the coverage colouring and limits the spec list to the specs anchored in that cluster.

List the gaps

  1. In the Specs view toolbar, click Gaps, or choose View › Coverage Gaps.
  2. Choose a filter.
  3. Optional: in the scope menu choose cluster, file or module and enter the cluster ID, the file path or a path prefix.
  4. Click a symbol to open it in the code view.

Coverage Gaps with the partial filter: each symbol with its file, state and the missing types

FilterLists
uncoveredSymbols without a counting anchor.
partialSymbols with anchors, but not of every chain type.
no testSymbols with anchors, but none of the last chain type (TC).
suspectSymbols with a suspect counting anchor.

Each row shows the symbol, its file and line, the state and the types that are missing, for example missing: TC, URS. The drafts checkbox switches the list to the reviewer view and is on by default. Filter symbols… narrows the list by text. The list shows at most 200 symbols, the most severe first.

Colour the graph

The Graph view can colour symbol nodes by their spec coverage. The colouring applies to the graph that is shown, so first open a graph, for example with the query callees of get_current_weather depth 2.

Coverage colouring in the Graph view: get_current_weather trace complete, cache_key uncovered

Menu entryColouringCounts
View › Coverage Heatmap (Auditor)by stateapproved
View › Coverage Heatmap (Reviewer)by statedraft, review, approved
View › Coverage Trace Depthby number of chain types covereddraft, review, approved
View › Coverage Densityby anchors per 1000 lines of the filedraft, review, approved
View › Coverage Overlay Offnone–

The heatmap button in the Specs view toolbar opens the Graph view with the colouring by state. In the Graph view toolbar, the coverage menu chooses the colouring and the drafts checkbox switches between auditor and reviewer view.

The legend in the lower right corner names the profile and the view, counts the nodes per state and has an off button.

ColouringLegend
Statered uncovered, orange partial, light green covered, green trace complete, yellow outline suspect
Trace depthgrey depth 0, blue depth 1, teal depth 2, green full chain
Densityred cold spot (0 per 1000 lines), orange up to 2, yellow 2 to 5, light green 5 to 15, green above 15

Density is computed per file. A large file with a single anchor shows as a cold spot even though one of its symbols is covered.

Close the gaps

  1. Open Coverage Drill-Down and pick a cluster from Bottom 5 — worst coverage.
  2. Open Gaps, set the scope to cluster with that cluster ID and the filter to uncovered.
  3. Write specs for the important symbols, by hand or generated from the code. See Write and maintain specs and Generate specs from code.
  4. Switch the reviewer checkbox on to see the effect of the new specs while they are still in draft or review.

Generated drafts in specs/_drafts/ do not count in either view until they are accepted.