Information-Theoretic Detection of Unusual Source Code Changes

Fuente: arXiv
Saved in:
Bibliographic Details
Main Authors: Torres, Adriano, Baltes, Sebastian, Treude, Christoph, Wagner, Markus
Format: Preprint
Published: 2025
Subjects:
Online Access:
Tags: Add Tag
No Tags, Be the first to tag this record!
_version_ 1866913882932510720
author Torres, Adriano
Baltes, Sebastian
Treude, Christoph
Wagner, Markus
author_facet Torres, Adriano
Baltes, Sebastian
Treude, Christoph
Wagner, Markus
contents The code base of software projects evolves essentially through inserting and removing information to and from the source code. We can measure this evolution via the elements of information - tokens, words, nodes - of the respective representation of the code. In this work, we approach the measurement of the information content of the source code of open-source projects from an information-theoretic standpoint. Our focus is on the entropy of two fundamental representations of code: tokens and abstract syntax tree nodes, from which we derive definitions of textual and structural entropy. We proceed with an empirical assessment where we evaluate the evolution patterns of the entropy of 95 actively maintained open source projects. We calculate the statistical relationships between our derived entropy metrics and classic methods of measuring code complexity and learn that entropy may capture different dimensions of complexity than classic metrics. Finally, we conduct entropy-based anomaly detection of unusual changes to demonstrate that our approach may effectively recognise unusual source code change events with over 60% precision, and lay the groundwork for improvements to information-theoretic measurement of source code evolution, thus paving the way for a new approach to statically gauging program complexity throughout its development.
format Preprint
id arxiv_https___arxiv_org_abs_2506_06508
institution arXiv
publishDate 2025
record_format arxiv
spellingShingle Information-Theoretic Detection of Unusual Source Code Changes
Torres, Adriano
Baltes, Sebastian
Treude, Christoph
Wagner, Markus
Software Engineering
The code base of software projects evolves essentially through inserting and removing information to and from the source code. We can measure this evolution via the elements of information - tokens, words, nodes - of the respective representation of the code. In this work, we approach the measurement of the information content of the source code of open-source projects from an information-theoretic standpoint. Our focus is on the entropy of two fundamental representations of code: tokens and abstract syntax tree nodes, from which we derive definitions of textual and structural entropy. We proceed with an empirical assessment where we evaluate the evolution patterns of the entropy of 95 actively maintained open source projects. We calculate the statistical relationships between our derived entropy metrics and classic methods of measuring code complexity and learn that entropy may capture different dimensions of complexity than classic metrics. Finally, we conduct entropy-based anomaly detection of unusual changes to demonstrate that our approach may effectively recognise unusual source code change events with over 60% precision, and lay the groundwork for improvements to information-theoretic measurement of source code evolution, thus paving the way for a new approach to statically gauging program complexity throughout its development.
title Information-Theoretic Detection of Unusual Source Code Changes
topic Software Engineering
url https://arxiv.org/abs/2506.06508