Authors: Elin Skånlund Berntsen & Simona-Ioana Culachi
This is our code for the course "Software Analytics" at University of Groningen in Spring 2026. Our goal was to analyze open-source repositories and see how AI usage impacts code quality. In order to do this, we used a pre-exsisting data set, which covers self-admitted AI-usage in Open Source enviroments. Our results, including our genereated csv files and plots of the different metrics, can be seen in csv/.
Our chosen metrics are insertions, deletions, lines, files, cyclomatic complexity, number of reverted commits, number of failed pipelines, changes in same function after 30 days and duplication percentage.
Before running the code, it is crucial to set up the proper enviroment. In order to do this, you must first set up a virtual enviroment then run:
pip install -r requirements.txtIt is also required to have a Personal Access Token from GitHub to run the code properly. To this, you must create a personal access token and add in a .env file under the name GITHUB_TOKEN.
The code is created to be relatively modular and easy to run.
In order to get the data from the repositories, you only need to run:
python3 data_extraction.pyThis code reads the AI commits from the pre-exsiting data set, get the start/end date of said commits and then gets all commits in this time frame. After this, it retrives all of the metrics mentioned.
It is important to note that this takes a while, especially for repositories that are relatively large. The code is set up in a way so that it also removes the outliers automatically. The final result will be saved in a file called cleaned_dataset_AI.csv and cleaned_dataset_nonAI.csv. Both of these will be automatically placed in cvs/{language}/{repo_name}/.
To change which repository/repositories are analyzed, simply change the list on line 16 in data_extraction.py and the language on line 14.
In order to get the cyclomatic complexities, simply run
python3 cyclomatic_complexity.pyIt is important to note that this should be ran after you've ran the data extraction, as it builds on the produced data sets. Here you need to change the path at the top if you want to anallyze other repositories.
To get the result of all of the metrics, run
python3 plots.py
This automatically scans the csv directory and retrives the plots and averages. These are saved in the repositories own results folder, along a summary file that saves data (such as mean of the different values).
To run the statistical tests just run
python3 stats_complexity.py
and
python3 stats_maintainablilty.py