Skip to content

Update showcase.R and add minor bug fixes#207

Merged
hechtlC merged 21 commits intose-sic:devfrom
bockthom:thomas-updates
Jul 21, 2021
Merged

Update showcase.R and add minor bug fixes#207
hechtlC merged 21 commits intose-sic:devfrom
bockthom:thomas-updates

Conversation

@bockthom
Copy link
Collaborator

@bockthom bockthom commented Jul 19, 2021

Prerequisites

  • I adhere to the coding conventions (described here) in my code.
  • I have updated the copyright headers of the files I have modified.
  • I have written appropriate commit messages, i.e., I have recorded the goal, the need, the needed changes, and the location of my code modifications for each commit. This includes also, e.g., referencing to relevant issues.
  • I have put signed-off tags in all commits.
  • I have updated the changelog file NEWS.md appropriately.
  • The pull request is opened against the branch dev.

Description

The showcase file showcase.R is not up to date any more. This PR updates the showcase file and adds a couple of bug fixes for bugs which I stumbled over while updating the showcase file. (Some of the outdated statements in the showcase file date back to version 3.5 or even 3.0 of coronet, whereas some other bug fixes are related to the recently merged pull requests #194 and #201.)

Changelog

  • Updates to showcase.R: 473c094, 287fbfa, 0a5cce4, 3393cae, 03aadac
  • Update for the pull-request template: Add hint to update showcase file: 5e54399
  • CI pipeline: Add second pipeline to run showcase file: 3eb31d8, 719a4f0
  • Bug fixes:
    • Fix logging statement when printing a Conf object: 2077e6e
    • Fix generation of Codeface range directory names: 5c90d1c
    • Fix plotting an empty network: 03f986d
    • Reset environment when setting a network configuration entry: fc4c086
    • Fix bug in issue-related add.vertex.attribute.issue.* functions: 5eb7161
    • Fix erroneous function calls in the ProjectData class: f146e9b
    • Reduce amount of multiple calls to update.synchronicity.data(): bba7376
    • Fix erroneous function call to update commit-message data: 19792cd
    • Fix corner-case in function 'construct.ranges': 000314b
    • Add package reshape2, which is used for quite a while but has never been added to the install.R: 7bb4e7b
    • Fix lots of bugs in the recently introduced function metrics.vertex.centralities: e7182e7

bockthom added 13 commits July 19, 2021 23:00
- There is no function `get.network.conf.variable` in the NetworkBuilder class.
  Instead, use `get.network.conf.entry`.

- The functions `get.author.class.activity` and
`get.author.class.activity.overview` have already been removed from coronet a
long time ago (in version 3.5, see 61b344a).

- The parameter `data` of function `get.author.class.by.type` has already been
  renamed to `proj.data` a long time ago (in version 3.5, see
  587ef99).

- When updating edge attributes in the NetworkConf, the edge attributes are
  specified as a vector, not as a list.

Signed-off-by: Thomas Bock <bockthom@cs.uni-saarland.de>
The `motifs.count` function takes a `motifs` parameter containing a list of
motifs instead of separate parameters for different motifs. This has already
been changed in version 3.0 of coronet (see
f3876dc). Fix the outdated function call in the
showcase.R file.

In addition, as the specified motifs are defined on undirected networks, the
network `g` which is passed to the `motifs.count` function needs to undirected,
too. Therefore, update the network configuration accordingly before building the
multi-network `g`.

Signed-off-by: Thomas Bock <bockthom@cs.uni-saarland.de>
Add example statements on how to retrieve commit messages or synchronicity data
on ProjectData or RangeData objects.

Signed-off-by: Thomas Bock <bockthom@cs.uni-saarland.de>
Fix inconsistent function documentation which I stumbled over while updating the
showcase file.

In addition, as all the optional example statements in the showcase.R are stated
as a comment, also do this for EDCPTD-related example statements, for
consistency reasons.

Signed-off-by: Thomas Bock <bockthom@cs.uni-saarland.de>
When printing a Conf object, the info "Network configuration:" was printed in
the first line. However, this is actually wrong as this print function is used
from both the `NetworkConf` and the `ProjectConf` object, as well as the `Conf`
class itself. To avoid printing wrong information and also to avoid code
duplication, just print "Configuration:" from now on, as the `Conf` class does
not know which actual class the object at which this function is called belongs
to.

Signed-off-by: Thomas Bock <bockthom@cs.uni-saarland.de>
Directory names for Codeface ranges can be generated via revision names or
commit hashes. If commit hashes are used (which are 40 characters long),
Codeface only uses the first 6 characters in the directory names. This was
already implemented correctly, but the check has used the wrong function: To
check if the revision name is 40 characters long, use the `nchar` function
instead of the `length` function (as the latter always returns 1 in this case).
This is a follow-up commit for b3e2947, which
has already been introduced with version 3.5 of coronet.

Signed-off-by: Thomas Bock <bockthom@cs.uni-saarland.de>
If an empty network is passed to the plot function `plot.network`, vertex
attributes `kind` and `vertex.type` have not been present in the created empty
network. As both attributes are used during the plotting function, this lets
plotting an empty network fail. This commit adjusts the plotting function such
that we can plot empty networks without any errors.

In addition, fix a wrong comment in function `add.attributes.to.network`.

Signed-off-by: Thomas Bock <bockthom@cs.uni-saarland.de>
The description of the function `set.network.conf.entry` in the NetworkBuilder
class already stated that the environment will be reset. However, the function
actually did not perform the reset.
Therefore, this commit adds the missing function call to reset the environment.

Signed-off-by: Thomas Bock <bockthom@cs.uni-saarland.de>
When not passing a specific value for parameter `issue.type` to all the
`add.vertex.attribute.issue.*` functions, the vector `c("all", "pull.requests",
"issues")` is automatically used as default. However, as only one of the
vector's elements is allowed, this leads to problems when passing this parameter
to other functions in turn. To fix this, add some missing `match.arg` calls that
make sure that only one value (the actual default "all") is used for the
`issue.type` parameter.

This is a follow-up commit for PR se-sic#194 and commit
eb4f649.

Signed-off-by: Thomas Bock <bockthom@cs.uni-saarland.de>
Within functions `set.project.conf.entry` and `update.project.conf`, the
synchronicity data is updated via calling the setter and the getter for the
synchronicity data. As both getter and setter are public functions onf the
ProjectData class, calling `private$...` does not work. Instead, we have to use
`self$...`, which holds for public functions.

This is a follow-up commit for PR se-sic#201 and commit
73009d9.

Signed-off-by: Thomas Bock <bockthom@cs.uni-saarland.de>
When resetting a ProjectConf entry that is related to the synchronicity data,
the corresponding update function is called. However, sometimes, the update
function is called multiple times when synchronicity data is already cached:
- The setter calls the update function (if synchronicity is configured).
- The getter calls the update function (if synchronicity is configured).
- The update function is called manually.
So, the manual function call is not necessary if the getter was already called
before (and both synchronicity data is configured and cached).

This is another follow-up commit for PR se-sic#201 and commit
73009d9.

Signed-off-by: Thomas Bock <bockthom@cs.uni-saarland.de>
Signed-off-by: Thomas Bock <bockthom@cs.uni-saarland.de>
…e file

Also add a corresponding statement to the contribution guide.

Signed-off-by: Thomas Bock <bockthom@cs.uni-saarland.de>
@bockthom bockthom added this to the v4.0 milestone Jul 19, 2021
@bockthom bockthom requested a review from hechtlC July 19, 2021 22:31
bockthom added 8 commits July 20, 2021 21:03
As `update.commit.message.data()` is a private function, we need to call
`private$update.commit.message.data()`.

This is another follow-up commit for PR se-sic#201.

Signed-off-by: Thomas Bock <bockthom@cs.uni-saarland.de>
When only 2 revisions are provided to the function `construct.ranges`
via parameter `revs` and `sliding.window` was `TRUE`, then `offset + 1`
exceeds the number of elements in `revs`, resulting in choosing elements
`3:2` as end elements of ranges. Instead of just constructing one range,
two ranges are constructed, which is obviously wrong. To prevent this, a
check is added whether `offset + 1` exceeds the length of `revs` and if
so, just return the last element to just construct one range.

In addition, as we are already handling corner cases, add a check at the
beginning of the function for checking whether, at least, two revisions
are specified. If there is only one revision given, no range can be
constructed, and therefore throw an error in this situation.

Signed-off-by: Thomas Bock <bockthom@cs.uni-saarland.de>
As module `util-plot-evolution.R` uses the `melt` function from package
`reshape2`, we need to add this package to the install script in order
to install this package properly.

This has been overlooked in PR se-sic#175.

Signed-off-by: Thomas Bock <bockthom@cs.uni-saarland.de>
The function `metrics.vertex.centralities` contained a lot of bugs since
it has been introduced in PR se-sic#195.

- `get.authors.by.data.source` is a public function of `ProjectData`
  and, therefore, needs to be called on a data object instead of providing
  the data object as parameter.
- `get.artifacts` also needs to be called on a data object.
- If both network and data are provided, but the network has either no
  vertex or no edge, the previous implementation caused errors. Therefore,
  add a check whether the network is empty before accessing vertex
  information.
- When ordering the centrality values, use the constant
  `VERTEX.CENTRALITIES.COLUMN.NAMES` instead of accessing columns by using
  outdated column names.
- Fix inconsistent indentation.

Signed-off-by: Thomas Bock <bockthom@cs.uni-saarland.de>
As already done in commit 98c5671 for test
suite initializiation, we also need to remove the warning assignment from the
showcase file, as results in an error from R version 4.1 on.
For more details on that, see 98c5671.

Signed-off-by: Thomas Bock <bockthom@cs.uni-saarland.de>
To be able to use the showcase file in our CI pipeline, the following
changes to the showcase file are done:

(1) Uncomment all the statements to execute them automatically.

(2) Use project "test" from the test data as default, as the test data
    is part of the repository and, therefore, acessible within the CI
    pipeline. (The recommendation to use project BusyBox still is part
    of the showcase file, but commented out.)

(3) Adjust some of the statements which relied on certain
    characteristics of BusyBox such that they are executed differently
    for projects BusyBox and test data.

Signed-off-by: Thomas Bock <bockthom@cs.uni-saarland.de>
Now we have two pipelines, one for the test suite and one for running
the showcase file. Each of these pipelines has a separate step for each
of the supported R versions.

Signed-off-by: Thomas Bock <bockthom@cs.uni-saarland.de>
Signed-off-by: Thomas Bock <bockthom@cs.uni-saarland.de>
Copy link
Contributor

@hechtlC hechtlC left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the enhancements and fixes @bockthom. I didn't find any issues so I will merge this right away.

@hechtlC hechtlC merged commit 699b38e into se-sic:dev Jul 21, 2021
@bockthom bockthom mentioned this pull request Sep 1, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants