Codebase metrics¶
A measured snapshot of the Audit Trail codebase and its submodules,
counted with cloc. Charts show code lines
(blank and comment lines excluded) unless stated otherwise.
Snapshot
Measured on the 1.x branch, 2026-09-30, with cloc 2.08. 389 files,
60,898 lines of code, 49,969 comment lines,
9,182 blank (120,049 lines in total). See
Methodology to reproduce.
At a glance¶
| Code | Comment | Blank | Files | Production | Test |
|---|---|---|---|---|---|
| 60,898 | 49,969 | 9,182 | 389 | 30,639 | 30,259 |
Production vs test¶
Audit Trail ships 30,259 lines of test code backing 30,639 lines of production code, a 99% test-to-production ratio.
Lines by language¶
| Language | Code | Comment | Blank | Files |
|---|---|---|---|---|
| PHP | 52,777 | 49,064 | 8,073 | 309 |
| Markdown | 5,865 | 0 | 967 | 16 |
| YAML | 1,771 | 635 | 98 | 51 |
| JavaScript | 202 | 162 | 12 | 3 |
| CSS | 144 | 108 | 28 | 4 |
| Text | 97 | 0 | 4 | 2 |
| JSON | 41 | 0 | 0 | 3 |
| SVG | 1 | 0 | 0 | 1 |
Composition¶
Across all languages, code is 51% of the lines, comments 42%, and blank lines 8%. The comment share reflects Drupal's docblock conventions.
By submodule¶
Production (brass) and test (steel) code per submodule, largest first.
| Submodule | Production | Test | Total |
|---|---|---|---|
| audit_trail (core) | 25,262 | 24,740 | 50,002 |
| audit_trail_tsa | 2,846 | 2,494 | 5,340 |
| audit_trail_entity | 1,327 | 1,384 | 2,711 |
| audit_trail_user_auth | 544 | 703 | 1,247 |
| audit_trail_file | 464 | 660 | 1,124 |
| audit_trail_entity_paragraphs | 196 | 278 | 474 |
Test suite¶
Audit Trail ships 124 automated test classes (1,294 test methods), counted by type below.
| Test type | Classes | Methods |
|---|---|---|
| Kernel | 83 | 1,106 |
| Unit | 32 | 149 |
| Functional | 9 | 39 |
| FunctionalJavascript | 0 | 0 |
| Total | 124 | 1,294 |
Architecture surface¶
What the module contains, counted across Audit Trail and its submodules: the Drupal building blocks (services, plugins, hooks, routes, entities) that make up its public and internal API.
| Element | Count |
|---|---|
| Services | 45 |
| Event subscribers | 0 |
| Hook implementations | 38 |
| Routes | 28 |
| Permissions | 4 |
| Forms | 34 |
| Controllers | 5 |
| Content entity types | 0 |
| Config entity types | 3 |
| Config schema types | 17 |
| Plugins | 4 |
Plugins break down by type as follows, largest first:
Methodology¶
This page is generated by
scripts/generate-metrics.php,
run from the module root after a change worth reflecting:
php scripts/generate-metrics.php
It measures the files git ls-files reports, so a checkout that has
installed vendor/, previewed the docs into site/ or pulled a
node_modules/ counts the same as the archive a release ships. This page is
left out of that list: the script writes it, and a page that counts itself
changes the tree it just measured, so no two regenerations agree. The
snapshot above names the cloc version,
because cloc counts differently from one version to the next; that is the
version to run to reproduce this page, and the version the pipeline installs.
Each file is attributed to the nearest
enclosing module (a directory with a *.info.yml); test-support modules under
a tests/ path count as their parent's test code. A file is test code when its
path contains a tests/ segment, production otherwise.
Test classes are counted by their directory under tests/src (Unit, Kernel,
Functional, FunctionalJavascript); the method column counts each test-prefixed
method, and each further one annotated @test or #[Test]. The architecture surface counts
service definitions in *.services.yml (excluding aliases), route and permission
keys in *.routing.yml and *.permissions.yml, #[Hook] attributes, plugin
classes under src/Plugin/, forms and controllers under src/Form and
src/Controller, entity-type attributes in src/Entity, and top-level types in
config/schema/*.yml, all summed across the module and its submodules.
The charts are static inline SVG generated from the measured data, so they need
no JavaScript or charting plugin. They are decorative and marked
aria-hidden: every figure one of them draws is also in the table or the
sentence beside it, so a screen reader gets the numbers rather than an image
with no name. An img role carrying no accessible name is worse than no role
at all, because it hides the labels inside the chart as well.