Chalmers University of Technology
The Impact of Compiler Warnings on Code Quality in C++ Projects
Abstract
dc:description.abstractThe usage of compiler warnings has widely been assumed to have a positive effect on code quality, but this notion has little evidence in research. This study investigated the relationship between the usage of compiler warnings and overall code quality in C++ projects. A purposive sampling approach was used to collect 127 C++ projects, which were subsequently analyzed with SonarCloud. Bayesian data analysis was utilized to investigate the correlation between compiler warning usage and measured code quality. The results indicated a correlation between stricter compiler warning usage and improved code quality for some code quality metrics, such as bugs, code smells, and technical debt. Projects that used compiler warnings generally performed better than projects with no warnings enabled, even for code quality metrics that were deemed unlikely to be affected by compiler warnings, such as the number of security hotspots and duplicated lines. Notably, projects that treated warnings as errors performed substantially better than similar projects that did not treat their warnings as errors. One proposed explanation was that this could be caused by a tendency among developers to ignore compiler warnings. It was concluded that the usage of stricter compiler warnings and improved code quality are correlated, while external factors such as engineering culture also likely contributed to the results.
Degree
thesis:*- Level thesis:degree_level
- H
- Department dc:contributor.department
- Chalmers tekniska högskola / Institutionen för data och informationsteknik
- Year dc:date.issued
- 2023
Author and committee
dc:creator, dc:contributor.*- Authors dc:creator
-
- Johansson, Albin
- Holmberg, Carl
- Advisor dc:contributor.supervisor
-
- Leitner, Philipp
- Committee member dc:contributor.committeemember
-
- Gren, Lucas
Subjects
dc:subject × 4Rights
- Language dc:language.iso
- eng
Identifiers
dc:identifier.*- Dc Identifier Coursecode
- DATX05