Skip to content

Commit

Permalink
Fix typos and change data frame access
Browse files Browse the repository at this point in the history
Read method now exclusively uses names to access data frame

Signed-off-by: Leo Sendelbach <[email protected]>
  • Loading branch information
Leo-Send committed Apr 17, 2024
1 parent 8ce1f07 commit 7c92b72
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 14 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion tests/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`
Expand Down
12 changes: 6 additions & 6 deletions util-networks.R
Original file line number Diff line number Diff line change
Expand Up @@ -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")
)

Expand Down Expand Up @@ -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"]],
Expand All @@ -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
Expand Down
10 changes: 5 additions & 5 deletions util-read.R
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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
Expand Down

0 comments on commit 7c92b72

Please sign in to comment.