Skip to content

Commit

Permalink
Merge pull request #264 from MaLoefUDS/dev
Browse files Browse the repository at this point in the history
Fix igraph deprecation warnings as well as a bug in issue network construction

Reviewed-by: Thomas Bock <bockthom@cs.uni-saarland.de>
Reviewed-by: Christian Hechtl <hechtl@cs.uni-saarland.de>
  • Loading branch information
bockthom authored Jul 8, 2024
2 parents a87ff24 + 3c2f910 commit 74ebe0b
Show file tree
Hide file tree
Showing 30 changed files with 539 additions and 413 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
## with this program; if not, write to the Free Software Foundation, Inc.,
## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
##
## Copyright 2023-2024 by Maximilian Löffler <s8maloef@cs.uni-saarland.de>
## Copyright 2023-2024 by Maximilian Löffler <s8maloef@stud.uni-saarland.de>
## Copyright 2024 by Thomas Bock <bockthom@cs.uni-saarland.de>
## All Rights Reserved.

Expand All @@ -37,7 +37,7 @@ jobs:
strategy:
fail-fast: false
matrix:
r-version: ['3.6', '4.0', '4.1', '4.2', '4.3', 'latest']
r-version: ['4.0', '4.1', '4.2', '4.3', '4.4', 'latest']

steps:
- name: Checkout Repo
Expand Down
8 changes: 7 additions & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,18 @@
- Add helper function for prefixing function names with file names in `util-read.R` (PR #252, f8ea987b138173cf0509c7910e0572d8ee1b3f1f)
- Add line-based code coverage reports into CI pipeline. Coverage reports are generated by `coverage.R` (PR #262, 10cac49d005e87c3964cc61711e7f5acef749626, b3b9f4ac7a9911bd00293c68fac88e0f9033bdfb, c815d18dc6266d620a7a145493417b87ac08679e, e8093525fdaf46e54f2f7fcc6358ca7892e795e5, 32d04823e2007c63d2a43ce59bea3057327c19a7)
- Add the possibility to split data time-based by multiple data sources (PR #261, 1088395f46b84028c8d7c463ca86b5dc38500c26, e1f79fc9e40cd6f41c946be42db364b2101cfe10, 0bb187fec0fd801d7634bf8d5180525770f6ab0b, 371a97ac6ebf3de4fe9360dea79d62e2ed3ef585)
- Add tests for uncovered functionality in `util-misc.R` and `util-networks.R` (PR #264, ff30f3238b1bf2539280d0d055a5d925c197c271, af80551d0615a49b86e45ff596bd75941ee88f91)

### Changed/Improved

- Change the default value for the `issues.from.source` configuration parameter. Instead of reading JIRA and GitHub issues together, which was the previous default, the new default value causes only GitHub issue data to be read. To restore the previous default behavior and read data from both issue sources, this now needs to be manually configured when needed. (PR #264, 5ff83c364f6bfc1e6ff95e9c5f1087e031c48a5d, 8c8080cb9caf115f19d9f145ad6e6c108b131a67, 8bcbc81db521877908d2e5c2989082ed672f2a3b)
- Replace deprecated `igraph` functions by their preferred alternatives (PR #264, 0df9d5bf6bafbb5d440f4c47db4ec901cf11f037)
- Deprecate support for R version 3.6 (PR #264, c8e6f45111e487fadbe7f0a13c7595eb23f3af6e, fb3f5474259d4a88f4ff545691cca9d1ccde90e3)
- Explicitly add R version 4.4 to the CI test pipeline (c8e6f45111e487fadbe7f0a13c7595eb23f3af6e)

### Fixed

- Ensure the correct installation of a compatible `Matrix` version for R 3.6 (PR #262, cb1cf42b2136f35b7e85239d36d5f91ff05d8cd7)
- Fix the creation of edgelists for issue-based artifact-networks by correctly iterating over the issue data (PR #264, 321d85043112971c04998249c14a0677a32c9004)

## 4.4

Expand Down
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,14 +59,14 @@ While using the package, we require the following infrastructure.

#### [`R`](https://www.r-project.org/)

Minimum requirement is `R` version `3.4.4`. Hence, later `R` versions also work. (Earlier `R` versions beginning from version `3.3.1` on should also work, but some packages are not available any more for these versions, so we do not test them any more in our CI pipeline.)
Minimum requirement is `R` version `4.0.5`. Hence, later `R` versions also work. (Earlier `R` versions beginning from version `3.3.1` on should also work, but some packages are not available any more for these versions, so we do not test them any more in our CI pipeline.)

We currently *recommend* `R` version `4.1.1` or `3.6.3` for reliability reasons and `packrat` compatibility, but also later `R` versions should work (and are tested using our CI script).
We currently *recommend* `R` version `4.1.1` or `4.3.0` for reliability reasons and `packrat` compatibility, but also later `R` versions should work (and are tested using our CI script).

#### [`packrat`](http://rstudio.github.io/packrat/) (recommended)

The local package manager of `R` enables the user to store all needed `R` packages for this repository inside the repository itself.
All `R` tools and IDEs should provide a more sophisticated interface for the interaction with `packrat`([RStudio](https://www.rstudio.com/) does).
All `R` tools and IDEs should provide a more sophisticated interface for the interaction with `packrat`([RStudio](https://www.rstudio.com/) does).

#### Folder structure of the input data

Expand Down Expand Up @@ -141,9 +141,9 @@ Alternatively, you can run `Rscript install.R` to install the packages.
- `viridis`: For plotting of networks with nice colors
- `jsonlite`: For parsing the issue data
- `rTensor`: For calculating EDCPTD centrality
- `Matrix`: For sparse matrix representation of large adjacency matrices
- `Matrix`: For sparse matrix representation of large adjacency matrices (package version `1.3.0` or higher is mandatory)
- `fastmap`: For fast implementation of a map
- `purrr`: For fast implementtion of a mapping function
- `purrr`: For fast implementation of a mapping function

### Submodule

Expand Down Expand Up @@ -574,7 +574,7 @@ There is no way to update the entries, except for the revision-based parameters.
* [*`TRUE`*, `FALSE`]
- `issues.from.source`
* Choose from which sources the issue data on disk is read in. Multiple sources can be chosen.
* [*`github`, `jira`*]
* [*`github`*, `jira`]
- `issues.locked`
* Lock issues to prevent them from being read if not yet present when calling the getter.
* [`TRUE`, *`FALSE`*]
Expand Down
4 changes: 1 addition & 3 deletions install.R
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,7 @@ if (length(p) > 0) {
Matrix.version = installed.packages()[rownames(installed.packages()) == "Matrix", "Version"]
if (compareVersion(Matrix.version, "1.3.0") == -1) {
print("WARNING: Matrix version 1.3.0 or higher is necessary for using coronet. Re-install package Matrix...")
#install.packages("Matrix", dependencies = NA, verbose = TRUE, quiet = TRUE)
matrix.1.3.4.url = "https://cran.r-project.org/src/contrib/Archive/Matrix/Matrix_1.3-4.tar.gz"
install.packages(matrix.1.3.4.url, repos = NULL, dependencies = NA, verbose = TRUE, quiet = TRUE)
install.packages("Matrix", dependencies = NA, verbose = TRUE, quiet = TRUE)
Matrix.version = installed.packages()[rownames(installed.packages()) == "Matrix", "Version"]
if (compareVersion(Matrix.version, "1.3.0") == -1) {
print("WARNING: Re-installation of package Matrix did not end up in the necessary package version.")
Expand Down
2 changes: 1 addition & 1 deletion showcase.R
Original file line number Diff line number Diff line change
Expand Up @@ -407,7 +407,7 @@ plot.print.network(g, labels = TRUE)
lay = matrix(c( 20, 179, 693, 552, 956, 1091, 124, 317, 516, 615, 803, 1038,
245, 175, 255, 185, 253, 225, 73, 8, 75, 0, 96, 86),
nrow = 12, byrow = FALSE) # for sample graph
g = igraph::set.graph.attribute(g, "layout", lay)
g = igraph::set_graph_attr(g, "layout", lay)
plot.print.network(g, labels = TRUE)

## get the plot object and modify it before plotting
Expand Down
7 changes: 4 additions & 3 deletions tests/test-core-peripheral.R
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
## Copyright 2022 by Thomas Bock <bockthom@cs.uni-saarland.de>
## Copyright 2019 by Christian Hechtl <hechtl@fim.uni-passau.de>
## Copyright 2021 by Christian Hechtl <hechtl@cs.uni-saarland.de>
## Copyright 2023 by Maximilian Löffler <s8maloef@stud.uni-saarland.de>
## Copyright 2023-2024 by Maximilian Löffler <s8maloef@stud.uni-saarland.de>
## All Rights Reserved.


Expand All @@ -37,6 +37,7 @@ if (!dir.exists(CF.DATA)) CF.DATA = file.path(".", "tests", "codeface-data")

## Prepare global setting
proj.conf = ProjectConf$new(CF.DATA, CF.SELECTION.PROCESS, CASESTUDY, ARTIFACT)
proj.conf$update.value("issues.from.source", c("jira", "github"))
proj.conf$update.value("issues.only.comments", FALSE)
proj.data = ProjectData$new(proj.conf)

Expand Down Expand Up @@ -301,7 +302,7 @@ test_that("Core classification of cochange author networks with vertices but no
## create network with one author and no edges
authors = data.frame(author.name = "A", kind = TYPE.AUTHOR, type = TYPE.AUTHOR)
edges = create.empty.edge.list()
network = igraph::graph.data.frame(edges, directed = TRUE, vertices = authors)
network = igraph::graph_from_data_frame(edges, directed = TRUE, vertices = authors)

## classify the authors into core/peripheral
classification = get.author.class.by.type(network, type = "network.eigen")
Expand All @@ -311,7 +312,7 @@ test_that("Core classification of cochange author networks with vertices but no
## create network with several authors and no edges
authors = data.frame(author.name = LETTERS[1:5], kind = TYPE.AUTHOR, type = TYPE.AUTHOR)
edges = create.empty.edge.list()
network = igraph::graph.data.frame(edges, directed = TRUE, vertices = authors)
network = igraph::graph_from_data_frame(edges, directed = TRUE, vertices = authors)

## classify the authors into core/peripheral
classification = get.author.class.by.type(network, type = "network.eigen")
Expand Down
1 change: 1 addition & 0 deletions tests/test-data.R
Original file line number Diff line number Diff line change
Expand Up @@ -402,6 +402,7 @@ test_that("Filter bots from commit data", {

test_that("Filter bots from issue data", {
proj.conf = ProjectConf$new(CF.DATA, CF.SELECTION.PROCESS, CASESTUDY, ARTIFACT)
proj.conf$update.value("issues.from.source", c("jira", "github"))
proj.conf$update.value("filter.bots", TRUE)
## disable all other filterings
proj.conf$update.value("issues.only.comments", FALSE)
Expand Down
29 changes: 29 additions & 0 deletions tests/test-misc.R
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,35 @@
## All Rights Reserved.


## / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / /
## Network data ------------------------------------------------------------

test_that("Get edgelist augmented with timestamps", {

## construct network
edges = list(list("A", "A"), list("D", "C"), list("C", "A"), list("B", "C"))
timestamps = c("2016-12-07 15:30:02", "2016-08-07 15:37:02", "2016-07-12 15:59:25", "2016-07-12 15:59:59")
network =
igraph::make_empty_graph(n = 0, directed = TRUE) +
igraph::vertices("A", "B", "C", "D") +
igraph::edges(edges, relation = "mail", date = timestamps)


## get edgelist augmented with timestamps
edgelist = get.edgelist.with.timestamps(network)

## check correctness
expect_equal(names(edgelist), c("from", "to", "date"))
expect_equal(nrow(edgelist), 4)
lapply(1:4, function(i) {
actual = edgelist[i, ]
expect_equal(actual[["from"]], edges[[i]][[1]])
expect_equal(actual[["to"]], edges[[i]][[2]])
expect_equal(actual[["date"]], timestamps[i])
})
})


## / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / /
## Parameter verification --------------------------------------------------

Expand Down
12 changes: 7 additions & 5 deletions tests/test-networks-artifact.R
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ test_that("Network construction of the undirected artifact-cochange network", {
relation = "cochange"
)
## 3) build expected network
network.expected = igraph::graph.data.frame(edges, directed = FALSE, vertices = vertices)
network.expected = igraph::graph_from_data_frame(edges, directed = FALSE, vertices = vertices)


##
Expand Down Expand Up @@ -147,6 +147,7 @@ patrick::with_parameters_test_that("Network construction of an issue-based artif

## configurations
proj.conf = ProjectConf$new(CF.DATA, CF.SELECTION.PROCESS, CASESTUDY, ARTIFACT)
proj.conf$update.value("issues.from.source", c("jira", "github"))
proj.conf$update.value("issues.only.comments", FALSE)
net.conf = NetworkConf$new()
net.conf$update.values(updated.values = list(artifact.relation = "issue", artifact.directed = test.directed))
Expand All @@ -156,7 +157,7 @@ patrick::with_parameters_test_that("Network construction of an issue-based artif
network.builder = NetworkBuilder$new(project.data = proj.data, network.conf = net.conf)

## build expected network
network.expected = igraph::graph.data.frame(edges, directed = test.directed, vertices = vertices)
network.expected = igraph::graph_from_data_frame(edges, directed = test.directed, vertices = vertices)

## build network
network.built = network.builder$get.artifact.network()
Expand All @@ -176,6 +177,7 @@ patrick::with_parameters_test_that("Network construction of an empty 'comments-o

## configurations
proj.conf = ProjectConf$new(CF.DATA, CF.SELECTION.PROCESS, CASESTUDY, ARTIFACT)
proj.conf$update.value("issues.from.source", c("jira", "github"))
net.conf = NetworkConf$new()
net.conf$update.values(updated.values = list(artifact.relation = "issue", artifact.directed = test.directed))

Expand Down Expand Up @@ -204,7 +206,7 @@ patrick::with_parameters_test_that("Network construction of an empty 'comments-o
)

## build expected network
network.expected = igraph::graph.data.frame(edges, directed = test.directed, vertices = vertices)
network.expected = igraph::graph_from_data_frame(edges, directed = test.directed, vertices = vertices)

## test
assert.networks.equal(network.built, network.expected)
Expand Down Expand Up @@ -254,7 +256,7 @@ patrick::with_parameters_test_that("Network construction with commit-interaction
type = c(TYPE.EDGES.INTRA, TYPE.EDGES.INTRA, TYPE.EDGES.INTRA, TYPE.EDGES.INTRA),
relation = c("commit.interaction", "commit.interaction", "commit.interaction", "commit.interaction")
)
network = igraph::graph.data.frame(edges, directed = test.directed, vertices = vertices)
network = igraph::graph_from_data_frame(edges, directed = test.directed, vertices = vertices)

expect_true(igraph::identical_graphs(network.built, network))
}, patrick::cases(
Expand Down Expand Up @@ -303,7 +305,7 @@ patrick::with_parameters_test_that("Network construction with commit-interaction
type = c(TYPE.EDGES.INTRA, TYPE.EDGES.INTRA, TYPE.EDGES.INTRA, TYPE.EDGES.INTRA),
relation = c("commit.interaction", "commit.interaction", "commit.interaction", "commit.interaction")
)
network = igraph::graph.data.frame(edges, directed = test.directed, vertices = vertices)
network = igraph::graph_from_data_frame(edges, directed = test.directed, vertices = vertices)

expect_true(igraph::identical_graphs(network.built, network))
}, patrick::cases(
Expand Down
25 changes: 14 additions & 11 deletions tests/test-networks-author.R
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ test_that("Amount of authors (author.all.authors, author.only.committers).", {

## configurations
proj.conf = ProjectConf$new(CF.DATA, CF.SELECTION.PROCESS, CASESTUDY, ARTIFACT)
proj.conf$update.value("issues.from.source", c("jira", "github"))
proj.conf$update.value("commits.filter.base.artifact", FALSE)
proj.conf$update.value("commits.filter.untracked.files", TRUE)
net.conf = NetworkConf$new()
Expand Down Expand Up @@ -230,7 +231,7 @@ test_that("Network construction of the undirected author-cochange network", {
relation = "cochange"
)
## 3) build expected network
network.expected = igraph::graph.data.frame(data, directed = FALSE, vertices = authors)
network.expected = igraph::graph_from_data_frame(data, directed = FALSE, vertices = authors)


##
Expand Down Expand Up @@ -314,7 +315,7 @@ test_that("Network construction of the undirected but temorally ordered author-c
)

## build expected network
network.expected = igraph::graph.data.frame(data, directed = FALSE, vertices = authors)
network.expected = igraph::graph_from_data_frame(data, directed = FALSE, vertices = authors)

expect_true(igraph::identical_graphs(network.built, network.expected))
})
Expand Down Expand Up @@ -355,7 +356,7 @@ test_that("Network construction of the directed author-cochange network", {
)

## build expected network
network.expected = igraph::graph.data.frame(data, directed = TRUE, vertices = authors)
network.expected = igraph::graph_from_data_frame(data, directed = TRUE, vertices = authors)

expect_true(igraph::identical_graphs(network.built, network.expected))
})
Expand Down Expand Up @@ -401,7 +402,7 @@ test_that("Network construction of the directed author-cochange network without
)

## build expected network
network.expected = igraph::graph.data.frame(data, directed = TRUE, vertices = authors)
network.expected = igraph::graph_from_data_frame(data, directed = TRUE, vertices = authors)

expect_true(igraph::identical_graphs(network.built, network.expected))
})
Expand All @@ -427,7 +428,7 @@ test_that("Network construction of the undirected simplified author-cochange net
type = TYPE.AUTHOR)

## make test independent of igraph version
date.attr = igraph::get.edge.attribute(network.built, "date")
date.attr = igraph::edge_attr(network.built, "date")
date.conversion.function = ifelse(all(sapply(date.attr, lubridate::is.POSIXct)),
get.date.from.unix.timestamp, identity)

Expand Down Expand Up @@ -462,7 +463,7 @@ test_that("Network construction of the undirected simplified author-cochange net
data[["artifact"]] = unclass(data[["artifact"]])

## build expected network
network.expected = igraph::graph.data.frame(data, directed = FALSE, vertices = authors)
network.expected = igraph::graph_from_data_frame(data, directed = FALSE, vertices = authors)

expect_true(igraph::identical_graphs(network.built, network.expected))
})
Expand All @@ -472,6 +473,7 @@ test_that("Network construction of the undirected author-issue network with all

## configurations
proj.conf = ProjectConf$new(CF.DATA, CF.SELECTION.PROCESS, CASESTUDY, ARTIFACT)
proj.conf$update.value("issues.from.source", c("jira", "github"))
proj.conf$update.value("commits.filter.base.artifact", FALSE)
proj.conf$update.value("issues.only.comments", FALSE)
net.conf = NetworkConf$new()
Expand Down Expand Up @@ -586,7 +588,7 @@ test_that("Network construction of the undirected author-issue network with all
)

## build expected network
network.expected = igraph::graph.data.frame(edges, directed = FALSE, vertices = vertices)
network.expected = igraph::graph_from_data_frame(edges, directed = FALSE, vertices = vertices)

expect_true(igraph::identical_graphs(network.built, network.expected))
})
Expand All @@ -595,6 +597,7 @@ test_that("Network construction of the undirected author-issue network with just

## configurations
proj.conf = ProjectConf$new(CF.DATA, CF.SELECTION.PROCESS, CASESTUDY, ARTIFACT)
proj.conf$update.value("issues.from.source", c("jira", "github"))
proj.conf$update.value("commits.filter.base.artifact", FALSE)
net.conf = NetworkConf$new()
net.conf$update.values(updated.values = list(author.relation = "issue"))
Expand Down Expand Up @@ -645,7 +648,7 @@ test_that("Network construction of the undirected author-issue network with just
relation = "issue")

## build expected network
network.expected = igraph::graph.data.frame(edges, directed = FALSE, vertices = vertices)
network.expected = igraph::graph_from_data_frame(edges, directed = FALSE, vertices = vertices)

expect_true(igraph::identical_graphs(network.built, network.expected))
})
Expand Down Expand Up @@ -673,7 +676,7 @@ test_that("Network construction with only untracked files (no edges expected)",
## build expected network (two vertices, no edges)
vertices = list(name = c("Karl", "Thomas"), kind = TYPE.AUTHOR, type = TYPE.AUTHOR)
network.expected = create.empty.network(directed = FALSE, add.attributes = TRUE)
network.expected = igraph::add.vertices(network.expected, nv = max(lengths(vertices)), attr = vertices)
network.expected = igraph::add_vertices(network.expected, nv = max(lengths(vertices)), attr = vertices)

## test
expect_true(igraph::identical_graphs(network.built, network.expected))
Expand Down Expand Up @@ -721,10 +724,10 @@ patrick::with_parameters_test_that("Network construction with commit-interaction
type = c(TYPE.EDGES.INTRA, TYPE.EDGES.INTRA, TYPE.EDGES.INTRA, TYPE.EDGES.INTRA),
relation = c("commit.interaction", "commit.interaction", "commit.interaction", "commit.interaction")
)
network = igraph::graph.data.frame(edges, directed = test.directed, vertices = vertices)
network = igraph::graph_from_data_frame(edges, directed = test.directed, vertices = vertices)

expect_true(igraph::identical_graphs(network.built, network))
}, patrick::cases(
"directed: FALSE" = list(test.directed = FALSE),
"directed: TRUE" = list(test.directed = TRUE)
))
))
Loading

0 comments on commit 74ebe0b

Please sign in to comment.