Issue #3622851: Measure the codebase on a tag

Closes [#3622851].

What changes

A metrics job, gated rules: - if: $CI_COMMIT_TAG and allow_failure: true, ported from audit_trail. It re-measures the tagged tree and prints a diff against the committed docs/metrics.md for a maintainer to read. It gates nothing.

Two details come with it, both load-bearing:

  • It measures from git archive into /tmp, because the pipeline builds a whole Drupal underneath the project directory and cloc run in place would count core as well.
  • The diff is not evidence of staleness on its own. The page counts the file it writes, so a page a maintainer correctly regenerated and committed does not reproduce byte for byte from a regeneration of that commit. The comment in .gitlab-ci.yml says so, because a check on that diff fires on a correct page, which is worse than not checking.

generate-metrics gains METRICS_DATE, which audit_trail's generator already had: the date is the one part of the page that moves on its own, so without pinning it the re-measurement reports the day it ran as the only difference.

Why this is not a test

kessai had a unit test that read the published hook count back out of docs/metrics.md and compared it against the source. Any merge request adding a hook then had to regenerate the page or go red -- a once-per-release question charged to every contributor. That test is being removed there ([#3621929]).

The two metrics tests here are deliberately untouched: MetricsTestCountingTest and MetricsWriteTest exercise the generator -- how it counts a class's test methods, and that a refused write is reported non-zero -- rather than whether the published page is current. That is a different question and worth keeping.

Gate

phpcs (Drupal,DrupalPractice) over the project: no new findings; the one warning is pre-existing in orchestra_views.routing.yml and is a DrupalPractice sniff CI does not run. php -l clean on both generator files, and the YAML parses.

Merge request reports

Loading
Loading