Skip to content
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

Simplifying GitStats: removing set_params() function #390

Merged
merged 3 commits into from
Apr 18, 2024

Conversation

maciekbanas
Copy link
Member

  • Remove set_params() function
  • Rename get_repos() paremeter from code to with_code. Defining this parameter in the function call will suffice to launch search mode when pulling repositories.
  • Move verbose and use_storage parameters directly to user functions.

@maciekbanas maciekbanas linked an issue Apr 12, 2024 that may be closed by this pull request
@maciekbanas maciekbanas changed the base branch from master to devel April 12, 2024 14:49
@maciekbanas maciekbanas self-assigned this Apr 12, 2024
Copy link
Collaborator

@marcinkowskak marcinkowskak left a comment

Choose a reason for hiding this comment

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

Couple of minor remarks:

  • For set_*_host() functions when we have messages, I would change this one:
    Your searching scope set to [org]. to Searching scope set to [org]. It will be more consistent with the rest messages inside those functions.

  • When user wants to kill get_*() function they have to press ESC button couple of times before function is exited completely, see screenshot. I'm not sure if it's something we can easily fix, but in longer run this may be inconvenient.

image

  • get_R_package_usage() - I would add an example in vignette/function documentation how to check for more than one package. To the function you can pass only one package name. If you think a second, the code is pretty straightforward, but a pre-ready code snippet may be pretty useful.

  • When you pass repos parameter to set_*_host() functions it would be better if the result will referring only to the repos passed (especially, when you call get_commits() or get_release_logs() on the git_stats_repos object, the result refers only to the repos defined in it).

> git_stats_repos <- create_gitstats() %>%
+   set_github_host(
+     repos = c("r-world-devs/GitStats", "openpharma/DataFakeR")
+   ) %>%
+   set_gitlab_host(
+     host = "code.roche.com",
+     repos = c("RWDInsightsEngineering/RocheTemplates")
+   )
ℹ Using PAT from GITHUB_PAT envar.
ℹ Your searching scope set to [repo].
✔ Set connection to GitHub.
ℹ Using PAT from GITLAB_PAT envar.
ℹ Your searching scope set to [repo].
✔ Set connection to GitLab.
> get_repos(git_stats_repos)
ℹ [GitHub][Engine:GraphQL][org:r-world-devs] Pulling repositories...
ℹ [GitHub][Engine:GraphQL][org:openpharma] Pulling repositories...
ℹ [GitHub][Engine:REST][org:r-world-devs and openpharma] Pulling contributors...
ℹ [GitLab][Engine:GraphQL][org:RWDInsightsEngineering] Pulling repositories...
ℹ [GitLab][Engine:REST][org:RWDInsightsEngineering] Pulling contributors...
Rows: 129
Columns: 18
$ repo_id          <chr> "R_kgDOHNMr2w", "R_kgDOHYNOFQ", "R_kgDOHYNrJw", "R_kgDOHYNxtw", "R_kgDOIvtxsg", "R_kgDOJAtHJA", "R_kgDOJKQ8Lg…
$ repo_name        <chr> "shinyGizmo", "cohortBuilder", "shinyCohortBuilder", "cohortBuilder.db", "GitStats", "shinyTimelines", "ROhds…
$ organization     <chr> "r-world-devs", "r-world-devs", "r-world-devs", "r-world-devs", "r-world-devs", "r-world-devs", "r-world-devs…
$ fullname         <chr> "r-world-devs/shinyGizmo", "r-world-devs/cohortBuilder", "r-world-devs/shinyCohortBuilder", "r-world-devs/coh…
$ platform         <chr> "github", "github", "github", "github", "github", "github", "github", "github", "github", "github", "github",…
$ repo_url         <chr> "https://github.com/r-world-devs/shinyGizmo", "https://github.com/r-world-devs/cohortBuilder", "https://githu…
$ api_url          <chr> "https://api.github.com/repos/r-world-devs/shinyGizmo", "https://api.github.com/repos/r-world-devs/cohortBuil…
$ created_at       <dttm> 2022-04-20 10:04:32, 2022-05-22 18:31:55, 2022-05-22 19:04:12, 2022-05-22 19:11:32, 2023-01-09 14:02:20, 202…
$ last_activity_at <dttm> 2023-05-08, 2023-05-05, 2023-12-21, 2022-07-29, 2024-04-14, 2023-09-29, 2023-03-16, 2023-12-21, 2024-04-14, …
$ last_activity    <drtn> 343.31 days, 346.31 days, 116.31 days, 626.31 days, 1.31 days, 199.31 days, 396.31 days, 116.31 days, 1.31 d…
$ default_branch   <chr> "dev", "dev", "dev", "master", "master", "master", "main", "master", "master", "main", "develop", "master", "…
$ stars            <int> 19, 4, 6, 0, 1, 3, 0, 2, 8, 178, 4, 10, 1, 21, 0, 1, 0, 4, 2, 3, 0, 0, 0, 9, 0, 5, 0, 0, 0, 0, 0, 0, 28, 0, 1…
$ forks            <int> 0, 2, 1, 0, 1, 0, 0, 1, 5, 32, 1, 1, 0, 5, 1, 1, 0, 0, 2, 1, 0, 0, 0, 3, 0, 3, 0, 0, 0, 0, 0, 0, 5, 0, 7, 0, …
$ languages        <chr> "R, CSS, JavaScript", "R", "R, CSS, JavaScript, SCSS", "R", "R", "R, CSS", "Shell, Perl, R", "R, JavaScript",…
$ issues_open      <int> 6, 23, 34, 3, 80, 0, 0, 3, 6, 17, 0, 0, 0, 4, 0, 0, 0, 1, 2, 0, 0, 0, 0, 28, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 34…
$ issues_closed    <int> 12, 1, 5, 0, 181, 0, 0, 0, 1, 170, 0, 0, 0, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 84, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, …
$ contributors     <chr> "krystian8207, stla, galachad, stlagsk", "krystian8207, galachad", "krystian8207, galachad", "krystian8207", …
$ contributors_n   <int> 4, 2, 2, 1, 2, 1, 7, 2, 5, 20, 1, 1, 1, 2, 3, 7, 2, 1, 1, 1, 1, 1, 1, 9, 1, 1, 1, 1, 1, 1, 1, 1, 3, 1, 13, 2,…

…dd verbose_on() and verbose_off() functions, add new user messages, update NEWS.
@maciekbanas maciekbanas marked this pull request as ready for review April 17, 2024 14:08
@maciekbanas
Copy link
Member Author

@marcinkowskak thank you for the review!
With regard to your comments:

@maciekbanas
Copy link
Member Author

maciekbanas commented Apr 18, 2024

@marcinkowskak also: apart from setting verbose in function, I added also verbose_on(), verbose_off() and is_verbose().

Copy link
Collaborator

@marcinkowskak marcinkowskak left a comment

Choose a reason for hiding this comment

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

Thanks @maciekbanas , looks much better! I'm leaving one more remark regarding verbose functionality:

Running below semi-code chunk shows that turning off messages globally and then turning them on for specific function call, changes settings globally. It's not probably desired effect and needs to be addressed (probably in a separate issue).

gitstats <- create_gitstats() %>% set_*_host()
verbose_off()
get_repos(git_stats) #no messages, 
get_repos(git_stats, until = "2023-12-12", verbose = TRUE)  #messages on
get_repos(git_stats) #messages on

@maciekbanas maciekbanas mentioned this pull request Apr 18, 2024
2 tasks
@maciekbanas maciekbanas merged commit 97ae677 into devel Apr 18, 2024
2 checks passed
@maciekbanas maciekbanas deleted the 386-remove-set_params-function branch April 18, 2024 11:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Remove set_params() function
2 participants