Code smells and quality attributes dataset
收藏DataCite Commons2025-06-01 更新2024-11-06 收录
下载链接:
https://figshare.com/articles/dataset/Code_smells_and_quality_attributes_dataset/24057336/2
下载链接
链接失效反馈官方服务:
资源简介:
<br>1 Code smell datasetIn order to create a high quality code smell datasets, we merged five different datasets. These datasets are among the largest and most accurate in our paper “Predicting Code Quality Attributes Based on Code Smells ”. Various software projects were analyzed automatically and manually to collect these labels. Table 1 shows the dataset details.Table 1. Merged datasets and their characteristics.DatasetSamplesProjectsCode smellsPalomba (2018) [1]40888395 versions of 30 open-source projectsLarge class, complex class, class data should be private, inappropriate intimacy, lazy class, middle man, refused equest, spaghetti code, speculative generality, comments, long method, long parameter list, feature envy, message chainsMadeyski [2]3291523 open-source and industrial projectsBlob, data classKhomh [3]_54 versions of 4 open-source projectsAnti-singleton, swiss army knifePecorelli [4]3419 open-source projectsBlobPalomba (2017) [5]_6 open-source projectsDispersed coupling, shotgun surgery<br>Code smell datasets have been prepared at two levels: class and method. The class level is 15 different smells as labels and 81 software metrics as features. As well, there are five smells and 31 metrics on the method level. This dataset contains samples of Java classes and methods. A sample can be identified by its longname, which contains the project-name, package-name, JavaFile-name, class-name, and method-name. The quantity of each smell ranges from 40 to 11000. The total number of samples is 37517, while the number of non-smells is nearly 3 million. As a result, our dataset is the largest in the study. You can see the details in Table 2.Table 2. The number of smells and non-smells at class and method levelsLevelMetricsSmellSamplesTotalClass81Complex class126523438Class data should be private1839Inappropriate intimacy780Large class990Lazy class774Middle man193Refused bequest1985Spaghetti code3203Speculative generality2723Blob988Data class938Anti-singleton2993Swiss army knife4601Dispersed coupling41Shotgun surgery125Non-smell40506 [3] +8334 [5] +296854 [1]+43862 [2] +55214 [4]444770Method31Comments10714079Feature envy525Long method11366Long parameter list1983Message chains98Non-smell24691762469176<br>2 Quality datasetThis dataset contains over 1000 Java project instances where for each instance the relative frequency of 20 code smells has been extracted along with the value of eight software quality attributes. The code quality dataset contains 20 smells as features and 8 quality attributes as labels: Coverageability, extendability, effectiveness, flexibility, functionality, reusability, testability, and understandability. The samples are Java projects identified by their name and version. Features are the ratio of smelly and non-smelly classes or methods in a software project. The quality attributes are a normalized score calculated by QMOOD metrics [6] and models extracted by [7], [8]. 1014 samples of small and large open-source and industrial projects are included in this dataset.The data samples are used to train machine learning models predicting software quality attributes based on code smells.References[1] F. Palomba, G. Bavota, M. Di Penta, F. Fasano, R. Oliveto, and A. De Lucia, “A large-scale empirical study on the lifecycle of code smell co-occurrences,” <i>Inf Softw Technol</i>, vol. 99, pp. 1–10, Jul. 2018, doi: 10.1016/J.INFSOF.2018.02.004.[2] L. Madeyski and T. Lewowski, “MLCQ: Industry-Relevant Code Smell Data Set,” in <i>ACM International Conference Proceeding Series</i>, Association for Computing Machinery, Apr. 2020, pp. 342–347. doi: 10.1145/3383219.3383264.[3] F. Khomh, M. Di Penta, Y. G. Guéhéneuc, and G. Antoniol, “An exploratory study of the impact of antipatterns on class change- and fault-proneness,” <i>Empir Softw Eng</i>, vol. 17, no. 3, pp. 243–275, Jun. 2012, doi: 10.1007/s10664-011-9171-y.[4] F. Pecorelli, F. Palomba, F. Khomh, and A. De Lucia, “Developer-Driven Code Smell Prioritization,” <i>Proceedings - 2020 IEEE/ACM 17th International Conference on Mining Software Repositories, MSR 2020</i>, pp. 220–231, 2020, doi: 10.1145/3379597.3387457.[5] F. Palomba, M. Zanoni, F. A. Fontana, A. De Lucia, and R. Oliveto, “Smells like teen spirit: Improving bug prediction performance using the intensity of code smells,” in <i>Proceedings - 2016 IEEE International Conference on Software Maintenance and Evolution, ICSME 2016</i>, Institute of Electrical and Electronics Engineers Inc., Jan. 2017, pp. 244–255. doi: 10.1109/ICSME.2016.27.[6] J. Bansiya and C. G. Davis, “A hierarchical model for object-oriented design quality assessment,” <i>IEEE Transactions on Software Engineering</i>, vol. 28, no. 1, pp. 4–17, Jan. 2002, doi: 10.1109/32.979986.[7] M. Zakeri-Nasrabadi and S. Parsa, “Learning to predict test effectiveness,” <i>International Journal of Intelligent Systems</i>, 2021, doi: 10.1002/INT.22722.[8] M. Zakeri-Nasrabadi and S. Parsa, “Testability Prediction Dataset,” Mar. 2021, doi: 10.5281/ZENODO.4650228.<br>
1 代码气味数据集(Code smell dataset)
为构建高质量的代码气味数据集,我们整合了5个不同的数据集。这些数据集是我们发表于论文《基于代码气味的软件质量属性预测》中规模最大且精度最高的数据集之一。我们通过自动化与人工分析相结合的方式处理各类软件项目,以收集对应的标签。表1展示了该数据集的详细信息。
表1 整合数据集及其特征
| 数据集 | 样本数 | 项目/版本 | 代码气味 |
| --- | --- | --- | --- |
| Palomba (2018) [1] | 40888 | 30个开源项目的8395个版本 | 复杂类(Complex class)、类数据应私有化(class data should be private)、不当亲密(inappropriate intimacy)、惰性类(lazy class)、中间人类(middle man)、拒绝继承(refused bequest)、意大利面条代码(spaghetti code)、推测性泛化(speculative generality)、注释(comments)、长方法(long method)、长参数列表(long parameter list)、特征嫉妒(feature envy)、消息链(message chains) |
| Madeyski [2] | 32915 | 23个开源与工业项目 | Blob型类(Blob)、数据类(data class) |
| Khomh [3] | | 4个开源项目的54个版本 | 反单例(Anti-singleton)、瑞士军刀类(swiss army knife) |
| Pecorelli [4] | 3419 | 39个开源项目 | Blob型类(Blob) |
| Palomba (2017) [5] | | 6个开源项目的版本 | 分散耦合(Dispersed coupling)、霰弹式修改(shotgun surgery) |
本代码气味数据集分为类与方法两个层级:类层级包含15种不同的代码气味作为标签,以及81个软件度量作为特征;方法层级则包含5种代码气味与31个软件度量作为特征。本数据集涵盖Java类与方法的样本,每个样本可通过其全名称(longname)进行唯一标识,该名称包含项目名、包名、Java文件名、类名与方法名。各类代码气味的样本数量介于40至11000之间。总样本量为37517,而非代码气味样本量则接近300万。综上,本数据集是当前相关研究中规模最大的代码气味数据集,详细信息可见表2。
表2 类与方法层级的代码气味与非代码气味样本数量
| 层级 | 度量数 | 代码气味/非代码气味 | 样本数 |
| --- | --- | --- | --- |
| 类层级 | 81 | 复杂类(Complex class) | 1265 |
| | | 类数据应私有化(class data should be private) | 1839 |
| | | 不当亲密(inappropriate intimacy) | 780 |
| | | 大类(Large class) | 990 |
| | | 惰性类(lazy class) | 774 |
| | | 中间人类(middle man) | 193 |
| | | 拒绝继承(refused bequest) | 1985 |
| | | 意大利面条代码(spaghetti code) | 3203 |
| | | 推测性泛化(speculative generality) | 2723 |
| | | Blob型类(Blob) | 988 |
| | | 数据类(data class) | 938 |
| | | 反单例(Anti-singleton) | 2993 |
| | | 瑞士军刀类(swiss army knife) | 4601 |
| | | 分散耦合(Dispersed coupling) | 41 |
| | | 霰弹式修改(shotgun surgery) | 125 |
| | | 非代码气味(Non-smell) | 40506 [3] + 8334 [5] + 296854 [1] + 43862 [2] + 55214 [4] = 444770 |
| 方法层级 | 31 | 注释(comments) | 107140 |
| | | 特征嫉妒(feature envy) | 79 |
| | | 长方法(long method) | 11366 |
| | | 长参数列表(long parameter list) | 1983 |
| | | 消息链(message chains) | 98 |
| | | 非代码气味(Non-smell) | 2469176 |
2 质量数据集(Quality dataset)
本数据集包含超过1000个Java项目实例,每个实例均提取了20种代码气味的相对频率,以及8个软件质量属性的取值。本代码质量数据集以20种代码气味作为特征,以8个质量属性作为标签:可覆盖性(Coverageability)、可扩展性(extendability)、有效性(effectiveness)、灵活性(flexibility)、功能性(functionality)、可复用性(reusability)、可测试性(testability)与可理解性(understandability)。样本为以名称与版本标识的Java项目,特征为软件项目中存在代码气味与无代码气味的类或方法的占比。质量属性为通过QMOOD度量(QMOOD metrics)计算得到的归一化得分,以及通过文献[7][8]提取得到的模型参数。本数据集涵盖1014个大小不一的开源与工业项目样本。本数据样本可用于训练基于代码气味预测软件质量属性的机器学习模型。
参考文献
[1] F. Palomba, G. Bavota, M. Di Penta, F. Fasano, R. Oliveto, 和 A. De Lucia. 一项关于代码气味共现生命周期的大规模实证研究[J]. 信息与软件技术(Inf Softw Technol), 2018, 99: 1–10. DOI: 10.1016/J.INFSOF.2018.02.004.
[2] L. Madeyski, T. Lewowski. MLCQ: 面向工业场景的代码气味数据集[C]//ACM国际会议论文集系列(ACM International Conference Proceeding Series). 美国计算机协会, 2020年4月: 342–347. DOI: 10.1145/3383219.3383264.
[3] F. Khomh, M. Di Penta, Y. G. Guéhéneuc, G. Antoniol. 反模式对类变更与故障倾向性影响的探索性研究[J]. 经验软件工程(Empir Softw Eng), 2012, 17(3): 243–275. DOI: 10.1007/s10664-011-9171-y.
[4] F. Pecorelli, F. Palomba, F. Khomh, A. De Lucia. 开发者导向的代码气味优先级排序[C]//2020年IEEE/ACM第17届软件仓库挖掘国际会议(MSR 2020)论文集. 2020: 220–231. DOI: 10.1145/3379597.3387457.
[5] F. Palomba, M. Zanoni, F. A. Fontana, A. De Lucia, R. Oliveto. 代码气味强度提升缺陷预测性能[C]//2016年IEEE软件维护与演化国际会议(ICSME 2016)论文集. 2017年1月: 244–255. DOI: 10.1109/ICSME.2016.27.
[6] J. Bansiya, C. G. Davis. 面向对象设计质量评估的分层模型[J]. IEEE软件工程汇刊(IEEE Transactions on Software Engineering), 2002, 28(1): 4–17. DOI: 10.1109/32.979986.
[7] M. Zakeri-Nasrabadi, S. Parsa. 学习预测测试有效性[J]. 国际智能系统期刊(International Journal of Intelligent Systems), 2021. DOI: 10.1002/INT.22722.
[8] M. Zakeri-Nasrabadi, S. Parsa. 可测试性预测数据集[EB/OL]. 2021年3月. DOI: 10.5281/ZENODO.4650228.
提供机构:
figshare创建时间:
2024-11-03
搜集汇总
数据集介绍

以上内容由遇见数据集搜集并总结生成



