Skip to content

Commit

Permalink
Add additional columns to commit-interactions
Browse files Browse the repository at this point in the history
columns 'base.author' and 'interacting.author' are initialized as NA and
will be overwritten in 'update.commit.interactions'.
Also, introduce check for correctness of returned data frame at the end
of 'read.commit.interactions'.

Signed-off-by: Leo Sendelbach <[email protected]>
  • Loading branch information
Leo-Send committed Feb 27, 2024
1 parent 8148614 commit aed2216
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions util-read.R
Original file line number Diff line number Diff line change
Expand Up @@ -850,13 +850,15 @@ create.empty.pasta.list = function() {
## column names of a dataframe containing commit interaction data (see function \code{read.commit.interactions})
COMMIT.INTERACTION.LIST.COLUMNS = c(
"func", "commit.hash", "file",
"base.hash", "base.func", "base.file"
"base.hash", "base.func", "base.file",
"base.author", "interacting.author"
)

## declare the datatype for each column in the constant 'COMMIT.INTERACTION.LIST.COLUMNS'
COMMIT.INTERACTION.LIST.DATA.TYPES = c(
"character", "character", "character",
"character", "character", "character"
"character", "character", "character",
"character", "character"
)

#' Read and parse the commit-interaction data. This data is present in a `.yaml` file which
Expand Down Expand Up @@ -918,11 +920,14 @@ read.commit.interactions = function(data.path = NULL) {
interacting.hashes.df$base.file = file.name.map$get(function.name)
return(interacting.hashes.df)
})))
interactions["base.author"] = NA_character_
interactions["interacting.author"] = NA_character_
return(interactions)
})))

## remove all duplicate entries from the resulting dataframe
commit.interaction.data = commit.interaction.data[!duplicated(commit.interaction.data), ]
verify.data.frame.columns(commit.interaction.data, COMMIT.INTERACTION.LIST.COLUMNS, COMMIT.INTERACTION.LIST.DATA.TYPES)
return(commit.interaction.data)
}

Expand Down

0 comments on commit aed2216

Please sign in to comment.