Skip to content

Read every number phploc counts, not the two the report was built on - #44

Merged
chr-hertel merged 1 commit into
mainfrom
more-metrics
Aug 16, 2026
Merged

Read every number phploc counts, not the two the report was built on#44
chr-hertel merged 1 commit into
mainfrom
more-metrics

Conversation

@chr-hertel

Copy link
Copy Markdown
Owner

A measurement has sixty-two numbers in it and the report drew two of them; the other
sixty sat in the json blob a release carries and were a re-clone away from being read.
They are all in the chart now.

The catalog

Metric is 54 of those 62, each addressed by a slug (?metrics=complexity,loc)
rather than by the phploc key behind it, since the query string is a link people read -
plus what it is called, one line saying what it counts, the section phploc prints it
under, the whole it is partOf(), how far it is rounded, whether the report has an
opinion about its direction and whether it carries a risk band. Left out are the five
minimums (classCcnMin is 1 in 96% of twenty thousand releases), testClasses /
testMethods (always 0) and ccnMethods - all of them still in the measurement and
still in the raw output.

Measurement reads a stored blob through it, MetricSelection parses ?metrics= by
the rules the repositories of a chart already follow, and MetricCatalog hands the
whole thing to the browser so nothing about a metric is written down twice.

The blob stays a blob: the two promoted columns stay columns because the report is
sorted, ranked and trended by them in SQL, while the other sixty are read one release
or one line at a time and never ordered by.

A second metric is a tab

Not a second axis and not a second chart - colour already says which repository a line
belongs to and cannot also say which number it is, and two scales in one frame let a
crossing look like a statement when what crossed was the scaling
(Datawrapper,
Flourish; SonarQube caps a graph at
three measures for the same reason). Drawn one at a time in the same frame - same
place, same width, same years - two metrics are compared by switching between them, and
switching keeps the years the reader is in.

The tabs sit inside the chart panel, on the row under the repository chips, ending on
the hairline that closes the panel head - so the head answers the two questions about a
chart in the order they are asked: which repositories, and in which number. A single
metric is still a tab there; with nothing to switch to it is not a choice but the only
place the chart says what it is drawing.

Every metric of a chart travels with every release, so switching is a redraw and never
a request; adding one is the fetch, and a line already on the page is asked only for
the number it is missing.

Reading one release

The four figures over the release analysis are read in whichever metric the chart is
open on, so switching a tab re-reads the release. Under them the panel lists every
picked metric, and folded below it stands the rest of the measurement: all 54 numbers
in phploc's four sections, indented under the whole they are part of, with their share
and their change since the previous release, each name a button that draws it. That is
owner/repository/<tag>/metrics; the raw output next to it is the same measurement as
phploc printed it.

Rebased onto #43

The branch predates the editorial rework, so it was rebased onto it and the design
re-thought rather than merged hunk by hunk: the two-way segmented metric switch does
not survive 54 metrics, and the headline figures were hardcoded to complexity and LOC,
which say nothing when the chart is open on static method calls.

Carried along: the release rail keeps its tab for a single line too, a share written
under a figure that is itself a change now carries that change's sign, and
.tabs--series no longer reaches the one pixel past its row that gave a sideways
scrolling row a vertical scrollbar. CLAUDE.md catches up with #43 as well.

Checks

178 tests, phpstan level 8, php-cs-fixer, prettier, twig/yaml/container lint all green.
Driven end to end in a headless browser: tab switching keeps the years and drops the
y-zoom, adding from the box and from the measurement table both open the new tab, the
tab × removes, the query string round-trips, legacy ?metric=loc still opens what it
named, and the raw dialog still opens.

🤖 Generated with Claude Code

A measurement has sixty-two numbers in it and the report drew two of them; the
other sixty sat in the json blob a release carries and were a re-clone away from
being read. They are all in the chart now.

The catalog
- `Metric` is 54 of those 62, each addressed by a slug (`?metrics=complexity,loc`)
  rather than by the phploc key behind it, since the query string is a link people
  read - plus what it is called, one line saying what it counts, the section phploc
  prints it under, the whole it is `partOf()`, how far it is rounded, whether the
  report has an opinion about its direction and whether it carries a risk band.
  Left out are the five minimums (`classCcnMin` is 1 in 96% of twenty thousand
  releases), `testClasses`/`testMethods` (always 0) and `ccnMethods`; all of them
  are still in the measurement and still in the raw output.
- `Measurement` is the reading of a stored blob through it, `MetricSelection`
  parses `?metrics=` by the rules the repositories of a chart already follow, and
  `MetricCatalog` hands the whole thing to the browser so nothing about a metric is
  written down twice.
- The blob stays a blob. The two promoted columns stay columns because the report
  is sorted, ranked and trended by them in SQL; the other sixty are read one release
  or one line at a time and never ordered by, which is also why nothing here is
  `jsonb` yet.

A second metric is a tab
Not a second axis and not a second chart: colour already says which repository a
line belongs to and cannot also say which number it is, and two scales in one frame
let a crossing look like a statement when what crossed was the scaling. Drawn one at
a time in the same frame - same place, same width, same years - two metrics are
compared by switching between them, and switching keeps the years the reader is in.

The tabs sit inside the chart panel, on the row under the repository chips, ending
on the hairline that closes the panel head - so the head answers the two questions
about a chart in the order they are asked: which repositories, and in which number.
A single metric is still a tab there; with nothing to switch to it is not a choice
but the only place the chart says what it is drawing. The box next to them only ever
adds, because a tab is where a metric is taken out again. What the open number is
worth is the sentence on the panel foot.

Every metric of a chart travels with every release, so switching is a redraw and
never a request; adding one is the fetch, and a line already on the page is asked
only for the number it is missing.

Reading one release
The four figures over the release analysis are read in whichever metric the chart is
open on - the number, what it did against the release before it, what it did since
the first one - so switching a tab re-reads the release. Under them the panel lists
every picked metric, and folded below it stands the rest of the measurement: all 54
numbers in phploc's four sections, indented under the whole they are part of, with
their share and their change since the previous release, each name a button that
draws it. That is `owner/repository/<tag>/metrics`; the raw output next to it is the
same measurement as phploc printed it.

Also
- The release rail keeps its tab for a single line too, for the same reason the
  metric row does.
- A share written under a figure that is itself a change carries that change's sign,
  or it reads as a rise under a fall.
- `.tabs--series` scrolls sideways, and a row that scrolls sideways scrolls in both
  directions - its tabs no longer reach the one pixel past their row that made it.
- CLAUDE.md catches up with #43 as well, which never updated it.

Claude-Session: https://claude.ai/code/session_6cb2012e-9a9a-4b01-ac0c-542f5fb74b92

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@chr-hertel
chr-hertel merged commit 8ca2268 into main Aug 16, 2026
2 checks passed
@chr-hertel
chr-hertel deleted the more-metrics branch August 16, 2026 20:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant