-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add possibility of editor definition to add.vertex.attribute.artifact.editor.count #169
Conversation
The function add.vertex.attribute.artifact.editor.count now counts authors and committers as editors (before, only authors were considered). For example, if an artifact has been changed by one commit which was authored by Author1 and committed by Author2, the vertex attribute editor.count now equals 2 (instead of 1). Signed-off-by: Klara Schlueter <[email protected]>
Add a parameter "editor.definition" to the function add.vertex.attribute.artifact.editor.count. The new parameter should be a subset of "author" and "committer" and decides who is counted as editor while computing the attribute values. Signed-off-by: Klara Schlueter <[email protected]>
Signed-off-by: Klara Schlueter <[email protected]>
Signed-off-by: Klara Schlueter <[email protected]
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your PR, @klaraschlueter! And congrats on opening the first PR in the new coronet
repository! 🎉
To increase code readability, I have two suggestions for your code. 🙂
Ah, another comment because I forgot to look at the changelog 🤦♂️: Can you please add the corresponding issue to the changelog entry? Also, please use backticks ( |
util-networks-covariates.R
Outdated
@@ -666,22 +666,28 @@ add.vertex.attribute.author.role = function(list.of.networks, classification.res | |||
#' \code{"project.cumulative"}, \code{"project.all.ranges"}, and | |||
#' \code{"complete"}. See \code{split.data.by.networks} for | |||
#' more details. [default: "range"] | |||
#' @param editor.definition Determines, who is counted as editor of an artifact. [default: c("author", "committer")] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not sure if c("author", "committer")
is the default value we want to have here. I would go for just "author"
as default value, as in most cases we are interested in the author of a commit and currently we only rely on the author in many other functions.
@clhunsen @klaraschlueter What do you think about that?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As the integration of committer data is not completely rolled out yet (see also #84), using "author"
as default value would be reasonable... 🤔
I looked at the function match.arg.or.default
, and it does not work properly for the current use case (due to restrictions on the parameter default
). Consequently, we need some implementation work for this to run. For now, I would like to propose the following snippet to solve the current situation:
if (missing(editor.definition)) {
editor.definition = "author"
} else {
editor.definition = match.arg.or.default(editor.definition, default = "author", several.ok = TRUE)
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
match.arg.or.default
does not return unexpected results (as they are properly documented), but ignores the default parameter if several.ok = TRUE
and returns the complete vector of allowed values.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, I see. I ran some tests with your snippet, @clhunsen , (with one small change: I added the parameter choices = c("author", "committer")
to the call to match.arg.or.default
, since we decided for "author"
as default).
I think, we do not need your if-case: if no editor.definition is given, the default value is inserted during the call to add.vertex.attribute.artifact.editor.count
and match.arg.or.default
returns the expected result "author"
. A problem seems to arise if I call the function with a nonsense editor definition, for example: editor.definition = nonsense
: The call to add.vertex.attribute.artifact.editor.count
and the if-case are "satisfied" since there is something and do not insert the default value, and match.arg.or.default
throws an error: 'arg' should be one of “author”, “committer”
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for this PR, @klaraschlueter. As already mentioned in a personal meeting, could you please cherry-pick the following commit from my fork and add it to this pull request: 3a203cb Thanks a lot in advance. |
Signed-off-by: Klara Schlueter <[email protected]>
Reported-by: Christian Hechtl <[email protected]> Signed-off-by: Thomas Bock <[email protected]>
12876ec
to
400400e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the changes, @klaraschlueter! I will merge in a moment. 😀
Prerequisites
dev
.Description
Add a parameter 'editor.definition' to the function 'add.vertex.attribute.artifact.editor.count' which can be used to define, if author or committer or both count as editors when computing the attribute values.
Changelog
Add a parameter 'editor.definition' to the function 'add.vertex.attribute.artifact.editor.count' which can be used to define, if author or committer or both count as editors when computing the attribute values. (ff1e147)