diff --git a/R/EngineRestGitLab.R b/R/EngineRestGitLab.R index fba40f85..85ac17f9 100644 --- a/R/EngineRestGitLab.R +++ b/R/EngineRestGitLab.R @@ -68,10 +68,13 @@ EngineRestGitLab <- R6::R6Class("EngineRestGitLab", repos_table <- private$pull_repos_from_org(org) %>% private$tailor_repos_info() %>% private$prepare_repos_table() %>% - private$add_repos_issues() %>% - self$add_repos_contributors() %>% + private$add_repos_issues() + suppressMessages({ + repos_table <- self$add_repos_contributors( + repos_table = repos_table + ) %>% private$filter_repos_by_team(team = settings$team) - repos_table$contributors <- NULL + }) } else { repos_table <- NULL } diff --git a/R/GitHost.R b/R/GitHost.R index f52b55c8..884e2816 100644 --- a/R/GitHost.R +++ b/R/GitHost.R @@ -76,6 +76,10 @@ GitHost <- R6::R6Class("GitHost", }) %>% purrr::list_rbind() + if (settings$search_param == "team") { + add_contributors <- TRUE + } + if (add_contributors) { repos_table <- self$add_repos_contributors(repos_table) } diff --git a/R/gitstats_functions.R b/R/gitstats_functions.R index b112e2a6..817fc18c 100644 --- a/R/gitstats_functions.R +++ b/R/gitstats_functions.R @@ -111,7 +111,20 @@ add_team_member <- function(gitstats_obj, #' @description List all repositories for an organization, a team or by a #' keyword. #' @param gitstats_obj A GitStats object. -#' @param add_contributors A boolean to decide whether to add contributors information to repositories. +#' @param add_contributors A logical parameter to decide whether to add +#' information about repositories' contributors to the repositories output +#' (table) when pulling them by organizations (`orgs`) or `phrase`. By default +#' it is set to `FALSE` which makes function run faster as, in the case of +#' `orgs` search parameter, it reaches only `GraphQL` endpoint with a query on +#' repositories, and in the case of `phrase` search parameter it reaches only +#' `repositories REST API` endpoint. However, the pitfall is that the result +#' does not convey information on contributors. \cr\cr When set to `TRUE`, +#' `GitStats` iterates additionally over pulled repositories and reaches to +#' the `contributors APIs`, which makes it slower, but gives additional +#' information. The same may be achieved with running separately function +#' `add_repos_contributors()` on the `GitStats` object with the `repositories` +#' output. \cr\cr When pulling repositories by \bold{`team`} the parameter +#' always turns to `TRUE` and pulls information on `contributors`. #' @return A `GitStats` class object with updated `$repos` field. #' @examples #' \dontrun{ diff --git a/devel/example_workflow.R b/devel/example_workflow.R index dc833d1f..c9fb966c 100644 --- a/devel/example_workflow.R +++ b/devel/example_workflow.R @@ -46,6 +46,7 @@ setup(git_stats, # now pull repos by default by team get_repos(git_stats) +git_stats$show_repos() get_commits(git_stats, date_from = "2020-01-01") # Change your settings to searches by phrase: diff --git a/man/EngineGraphQLGitHub.Rd b/man/EngineGraphQLGitHub.Rd index c8acd2ce..1b23ccd2 100644 --- a/man/EngineGraphQLGitHub.Rd +++ b/man/EngineGraphQLGitHub.Rd @@ -16,6 +16,7 @@ A class for methods wrapping GitHub's GraphQL API responses. \item \href{#method-get_repos}{\code{EngineGraphQLGitHub$get_repos()}} \item \href{#method-get_repos_supportive}{\code{EngineGraphQLGitHub$get_repos_supportive()}} \item \href{#method-get_commits}{\code{EngineGraphQLGitHub$get_commits()}} +\item \href{#method-get_commits_supportive}{\code{EngineGraphQLGitHub$get_commits_supportive()}} \item \href{#method-clone}{\code{EngineGraphQLGitHub$clone()}} } } @@ -114,6 +115,42 @@ filtered by team members. } \if{html}{\out{}} } +\subsection{Returns}{ +A table of commits. +} +} +\if{html}{\out{
}} +\if{html}{\out{}} +\if{latex}{\out{\hypertarget{method-get_commits_supportive}{}}} +\subsection{Method \code{get_commits_supportive()}}{ +Method to get commits. +\subsection{Usage}{ +\if{html}{\out{
}}\preformatted{EngineGraphQLGitHub$get_commits_supportive( + org, + date_from, + date_until = Sys.date(), + settings +)}\if{html}{\out{
}} +} + +\subsection{Arguments}{ +\if{html}{\out{
}} +\describe{ +\item{\code{org}}{An organization.} + +\item{\code{date_from}}{A starting date to look commits for.} + +\item{\code{date_until}}{An end date to look commits for.} + +\item{\code{settings}}{A list of \code{GitStats} settings.} +} +\if{html}{\out{
}} +} +\subsection{Details}{ +This method must exist as it is called from the GitHost wrapper +above. +} + \subsection{Returns}{ A table of commits. } diff --git a/man/get_repos.Rd b/man/get_repos.Rd index 8beb61de..16ce72a2 100644 --- a/man/get_repos.Rd +++ b/man/get_repos.Rd @@ -9,7 +9,20 @@ get_repos(gitstats_obj, add_contributors = FALSE) \arguments{ \item{gitstats_obj}{A GitStats object.} -\item{add_contributors}{A boolean to decide whether to add contributors information to repositories.} +\item{add_contributors}{A logical parameter to decide whether to add +information about repositories' contributors to the repositories output +(table) when pulling them by organizations (\code{orgs}) or \code{phrase}. By default +it is set to \code{FALSE} which makes function run faster as, in the case of +\code{orgs} search parameter, it reaches only \code{GraphQL} endpoint with a query on +repositories, and in the case of \code{phrase} search parameter it reaches only +\verb{repositories REST API} endpoint. However, the pitfall is that the result +does not convey information on contributors. \cr\cr When set to \code{TRUE}, +\code{GitStats} iterates additionally over pulled repositories and reaches to +the \verb{contributors APIs}, which makes it slower, but gives additional +information. The same may be achieved with running separately function +\code{add_repos_contributors()} on the \code{GitStats} object with the \code{repositories} +output. \cr\cr When pulling repositories by \bold{\code{team}} the parameter +always turns to \code{TRUE} and pulls information on \code{contributors}.} } \value{ A \code{GitStats} class object with updated \verb{$repos} field.