From 7c92b723056e1851d88791bf8c10ece44a474f27 Mon Sep 17 00:00:00 2001 From: Leo Sendelbach Date: Wed, 10 Apr 2024 12:38:16 +0200 Subject: [PATCH] Fix typos and change data frame access Read method now exclusively uses names to access data frame Signed-off-by: Leo Sendelbach --- README.md | 4 ++-- tests/README.md | 2 +- util-networks.R | 12 ++++++------ util-read.R | 10 +++++----- 4 files changed, 14 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index 0595555d..3fb9d44f 100644 --- a/README.md +++ b/README.md @@ -268,7 +268,7 @@ Relations determine which information is used to construct edges among the verti - `commit.interaction` * For author networks (configured via `author.relation` in the [`NetworkConf`](#networkconf)), authors who contribute to interacting commits are connected with an edge. - * For artifact networks (configured via `artifact.relation` in the [`NetworkConf`](#networkconf)), artifacts are connected when there is a interacting between two commits that occur in the artifacts. + * For artifact networks (configured via `artifact.relation` in the [`NetworkConf`](#networkconf)), artifacts are connected when there is an interaction between two commits that occur in the artifacts. * This relation does not apply for bipartite networks. #### Edge-construction algorithms for author networks @@ -605,7 +605,7 @@ There is no way to update the entries, except for the revision-based parameters. * Lock custom event timestamps to prevent them from being read if empty or not yet present when calling the getter. * [`TRUE`, *`FALSE`*] - `commit.interactions`: - * Alloow construction of author and artifact networks using commit interaction data + * Allow construction of author and artifact networks using commit-interaction data * [`TRUE`, *`FALSE`*] ### NetworkConf diff --git a/tests/README.md b/tests/README.md index cfe453fb..b6558dc1 100644 --- a/tests/README.md +++ b/tests/README.md @@ -16,7 +16,7 @@ We have two test projects you can use when writing your tests: * Commit messages * Pasta * Synchronicity - * Commit Interactions + * Commit interactions * Custom event timestamps in `custom-events.list` * Revisions 2. - Casestudy: `test_empty` diff --git a/util-networks.R b/util-networks.R index bfe7a998..aa9511b2 100644 --- a/util-networks.R +++ b/util-networks.R @@ -134,10 +134,10 @@ NetworkBuilder = R6::R6Class("NetworkBuilder", get.vertex.kind.for.relation = function(relation) { vertex.kind = switch(relation, - cochange = private$proj.data$get.project.conf.entry("artifact.codeface"), - callgraph = private$proj.data$get.project.conf.entry("artifact.codeface"), - mail = "MailThread", - issue = "Issue", + cochange = private$proj.data$get.project.conf.entry("artifact.codeface"), + callgraph = private$proj.data$get.project.conf.entry("artifact.codeface"), + mail = "MailThread", + issue = "Issue", commit.interaction = private$proj.data$get.project.conf.entry("artifact.codeface") ) @@ -398,7 +398,7 @@ NetworkBuilder = R6::R6Class("NetworkBuilder", edges = edges[, c("file", "base.file", "func", "commit.hash", "base.hash", "base.func", "base.author", "interacting.author")] - colnames(edges)[colnames(edges)=="commit.hash"] = "hash" + colnames(edges)[colnames(edges) == "commit.hash"] = "hash" } else if (proj.conf.artifact == "function") { ## change the vertices to the functions from the commit-interaction data vertices = unique(c(private$proj.data$get.commit.interactions()[["base.func"]], @@ -407,7 +407,7 @@ NetworkBuilder = R6::R6Class("NetworkBuilder", edges = edges[, c("func", "base.func", "commit.hash", "file", "base.hash", "base.file", "base.author", "interacting.author")] - colnames(edges)[colnames(edges)=="commit.hash"] = "hash" + colnames(edges)[colnames(edges) == "commit.hash"] = "hash" } else { ## If neither 'function' nor 'file' was configured, send a warning ## and return an empty network diff --git a/util-read.R b/util-read.R index fa0bbff1..892c59cd 100644 --- a/util-read.R +++ b/util-read.R @@ -898,8 +898,8 @@ read.commit.interactions = function(data.path = NULL) { ## 1) create an empty map file.name.map = fastmap::fastmap() ## 2) create a mapping between functions and files as a named list - ## which can be directly converted to a map - function.file.list = purrr::map(result.map, 2) + ## which can be directly converted to a map + function.file.list = purrr::map(result.map, "file") ## 3) set the map using the list file.name.map$mset(.list = function.file.list) list.names = names(result.map) @@ -911,10 +911,10 @@ read.commit.interactions = function(data.path = NULL) { SIMPLIFY = FALSE, FUN = function(current.interaction, function.name) { ## get all commits that interact with the current one - insts = current.interaction[[4]] + insts = current.interaction[["insts"]] interactions = data.table::setDF(data.table::rbindlist(lapply(insts, function(current.inst) { - base.hash = current.inst[[1]][["commit"]] - interacting.hashes = current.inst[[2]] + base.hash = current.inst[["base-hash"]][["commit"]] + interacting.hashes = current.inst[["interacting-hashes"]] interacting.hashes.df = data.table::setDF(data.table::rbindlist(lapply(interacting.hashes, function(hash) { ## if there is no function name in the current interaction, we set the function name to 'GLOBAL' ## as this is most likely code outside of functions, else we set the function name