Dries Buytaert: Measuring Drupal core code complexity

A laptop open on a small table inside a van, showing code on the screen, with a bowl of cereal and a mug of coffee beside it.




By tracking these metrics publicly, I hope to inform decisions about both code quality and developer experience. When we refactor complex code, we can measure the impact. We can set goals and track progress.
The dashboard updates automatically and is available at https://dbuytaert.github.io/drupal-core-metrics/.
The charts tell a clear story of steady, hard-won progress. A story to be proud of and worth sharing. Code quality is dramatically better than it was in Drupal 7: lower complexity, easier to maintain, fewer anti-patterns, and dramatically better test coverage. Drupal now has nearly twice as much test code as production code!
Special thanks to catch for multiple rounds of feedback. As the most active Core Committer over the past 12 months, his input was invaluable.
Drupal Core’s API surface has modernized too. As Drupal shifted from procedural to object-oriented patterns, global procedural functions gave way to classes implementing interface methods, services, plugins, and events.
I built a dashboard that tracks Drupal Core’s code quality over time, across major releases from Drupal 7 through Drupal 11. It measures lines of code, cyclomatic complexity, maintainability index, anti-patterns, and API surface area. Think of it as a health report for Drupal’s codebase.
All charts use static code analysis. Static analysis measures the code as written, not what it feels like to work with it or to learn Drupal as a new developer. As a next step, I’d love to measure developer experience more directly. Dynamic analysis might help, for example by tracking call stack depth, or how many files and APIs you have to touch to make a simple change.
The dashboard is open source, and contributions are welcome at https://github.com/dbuytaert/drupal-core-metrics.

Similar Posts