Skip to content

Codebase metrics

A measured snapshot of the Kessai 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-11-12, with cloc 2.08. 364 files, 34,887 lines of code, 31,522 comment lines, 7,102 blank (73,511 lines in total). See Methodology to reproduce.

At a glance

Code Comment Blank Files Production Test
34,887 31,522 7,102 364 18,626 16,261

Production vs test

Kessai ships 16,261 lines of test code backing 18,626 lines of production code, an 87% test-to-production ratio.

Lines by language

Language Code Comment Blank Files
PHP 28,124 30,923 5,836 276
Markdown 3,375 0 739 11
YAML 2,237 455 90 58
PO File 930 8 427 8
Text 147 0 4 4
JSON 37 0 0 3
CSS 21 135 6 2
SVG 16 1 0 2

Composition

Across all languages, code is 47% of the lines, comments 43%, and blank lines 10%. The comment share reflects Drupal's docblock conventions.

By submodule

Production (brass) and test (steel) code per submodule, largest first.

Submodule Production Test Total
kessai_engine 4,991 7,256 12,247
kessai (core) 6,226 1,280 7,506
kessai_worldline 2,093 2,655 4,748
kessai_server 1,741 2,770 4,511
kessai_client 1,873 1,264 3,137
kessai_views 1,195 245 1,440
kessai_simulator 355 359 714
kessai_audit_trail 152 432 584

Test suite

Kessai ships 86 automated test classes (904 test methods), counted by type below.

Test type Classes Methods
Kernel 63 816
Unit 15 40
Functional 8 48
FunctionalJavascript 0 0
Total 86 904

Architecture surface

What the module contains, counted across Kessai and its submodules: the Drupal building blocks (services, plugins, hooks, routes, entities) that make up its public and internal API.

Element Count
Services 43
Event subscribers 2
Hook implementations 33
Routes 21
Permissions 6
Forms 8
Controllers 5
Content entity types 5
Config entity types 2
Config schema types 17
Plugins 11

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.