Description Usage Arguments Value
Reads or gets as input two versions of source codes, a new and an old, and returns the info about the alerts and the combination between the alerts. The main output are the features related to combinations of an alerts: an alert from the new version and an alert from the old version. All the combinations between an old alert and a new alert are considered. The main goal is to differentiate between Fixed, Old and New alerts. If a combination of alerts from the new and the old versions have many features that indicate they have the same role in the code, the alert in the new version may be considered an old alert.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | calculate_features_from_versions(
code_file_new = "",
code_file_old = "",
code_new = "",
code_old = "",
pmd_path,
rule_path = "rulesets/java/quickstart.xml",
blockrules_location = "data/blockrules/blockrules.xml",
mostra_new = c(10, 43, 17, 15, 18, 16, 45, 44),
mostra_old = c(10, 42, 41, 15, 16, 43),
glue_string = "",
optimize_feature_calculation = TRUE,
alerts_new = NA,
alerts_old = NA,
ast_new = NA,
ast_old = NA,
diff = NA,
only_categorised = FALSE
)
|
code_file_new |
file containing the source code of the new version. If this parameter is empty, the parameter code_new is used |
code_file_old |
file containing the source code of the old version. If this parameter is empty, the parameter code_old is used |
code_new |
source code of the new version. If this parameter is empty, the parameter code_file_new is used |
code_old |
source code of the old version. If this parameter is empty, the parameter code_file_old is used |
pmd_path |
complete path to pmd.bat including the name of the file |
rule_path |
path to the rules used for the PMD alerts |
blockrules_location |
path to the rules for the Abstract Syntax Tree |
mostra_new |
which nodes of the new version must appear? |
mostra_old |
which nodes of the old version must appear? |
glue_string |
template of a string that will be passed to str_glue and will be available in the returned info |
optimize_feature_calculation |
if true, the features are not calculated for all the combinations of new and old alerts if there is a perfect match |
a list with information about the comparison between old and new versions. The list contains the following items:
versions_executed: a dataframe containing the PMD alerts generated for each version
versions_crossed: a dataframe containing information about the combination of versions including a map between the lines of code in the new and in the old version
graph_old_with_alert: a tidygraph containing the abstract syntax tree of the old version and information about PMD alerts
graph_new_with_alert: a tidygraph containing the abstract syntax tree of the new version and information about PMD alerts
graph_old_with_group: a tidygraph containing the abstract syntax tree of the old version and information about PMD alerts. Here, the nodes of the new and the old versions are categorized in groups
graph_new_with_group: a tidygraph containing the abstract syntax tree of the new version and information about PMD alerts. Here, the nodes of the new and the old versions are categorized in groups
graphs_from_alerts_old: a dataframe containing, for each alert of the old version, the path from the node related to the alert to the root node (compilation unit), in a tidygraph
graphs_from_alerts_new: a dataframe containing, for each alert of the new version, the path from the node related to the alert to the root node (compilation unit), in a tidygraph
features: a dataframe containing, for each combination of old and new alert, the features related to the combinations
categorised_alerts: dataframe with old and new alerts categorised in fixed, open and new
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.