Package 'repometrics'

Title: Metrics for Your Code Repository
Description: Metrics for your code repository. Call one function to generate an interactive dashboard displaying the state of your code.
Authors: Mark Padgham [aut, cre]
Maintainer: Mark Padgham <[email protected]>
License: GPL-3
Version: 0.1.6.079
Built: 2025-02-21 12:37:56 UTC
Source: https://github.com/ropensci-review-tools/repometrics

Help Index


Apply pkgstats across the git history of a package

Description

Apply pkgstats across the git history of a package

Usage

repo_pkgstats_history(path, step_days = 1L, num_cores = -1L)

Arguments

path

Path to local repository containing an R package.

step_days

Analyse package at intervals of this number of days. The last commit for each day is chosen. For example, step_days = 7L will return weekly statistics. Values of zero or less will analyse all commits, including potentially multiple daily commits.

num_cores

Number of cores to use in multi-core processing. Has no effect on Windows operating systems, on which calculations are always single-core only. Negative values are subtracted from number of available cores, determined as parallel::detectCores(), so default of num_cores = -1L uses detectCores() - 1L. Positive values use precisely that number, restricted to maximum available cores, and a value of zero will use all available cores.

Value

NULL if path is not an R package, or if no pkgstats results are able to be extracted. Otherwise, a list of three items:

  • desc_data Containing data from DESCRIPTION files, along with data on numbers of functions.

  • loc Containing data on "lines-of-code" for all languages and sub-directories within package.

  • stats Containing statistics on (mean, medium, and sum) of various properties of each function in package.

See Also

Other data: repometrics_data(), repometrics_data_repo(), repometrics_data_user()


Start quarto dashboard with results of main repometrics_data_repo function.

Description

Start quarto dashboard with results of main repometrics_data_repo function.

Usage

repometrics_dashboard(
  data,
  action = "preview",
  ctb_threshold = NULL,
  max_ctbs = NULL
)

Arguments

data

Data on repository and all contributors as returned from repometrics_data function applied to one package.

action

One of "preview", to start and open a live preview of the dashboard website, or "render" to render a static version without previewing or opening.

ctb_threshold

An optional single numeric value between 0 and 1. If specified, contributions are arranged in cumulative order, and the contributor data reduced to only those who contribute to this proportion of all contributions.

max_ctbs

Optional maximum number of contributors to be included. This is an alternative way to reduce number of contributors presented in dashboard, and may only be specified if ctb_threshold is left at default value of NULL.

Value

(Invisibly) Path to main "index.html" document of quarto site. Note that the site must be served with action = "preview", and will not work by simply opening this "index.html" file.


Collate 'repometrics' data for a local R package.

Description

This function collates all data for a local R package or repository needed to create a dashboard with the repometrics_dashboard function. It combines data from both the repometrics_data_repo and repometrics_data_user functions.

Usage

repometrics_data(
  path,
  step_days = 1L,
  num_cores = -1L,
  ended_at = Sys.time(),
  nyears = 1
)

Arguments

path

Path to local repository containing an R package.

step_days

Analyse package at intervals of this number of days. The last commit for each day is chosen. For example, step_days = 7L will return weekly statistics. Values of zero or less will analyse all commits, including potentially multiple daily commits.

num_cores

Number of cores to use in multi-core processing. Has no effect on Windows operating systems, on which calculations are always single-core only. Negative values are subtracted from number of available cores, determined as parallel::detectCores(), so default of num_cores = -1L uses detectCores() - 1L. Positive values use precisely that number, restricted to maximum available cores, and a value of zero will use all available cores.

ended_at

Parameter used in some aspects of resultant data to limit the end date of data collection. Defaults to Sys.time().

nyears

Parameter <= 1 determining fraction of a year over which data up until end_date are collected.

Value

A list of three forms of data:

  1. "pkgstats" containing statistics on the historical development of package code, derived from the pkgstats package;

  2. "rm" containing data from GitHub on the repository, including data on contributors, issues, pull requests, and people watching and starring the repository.

  3. "contributors" as a named list of data on every individual contributor to the repository, whether by code contributions or GitHub issues or discussions.

See Also

Other data: repo_pkgstats_history(), repometrics_data_repo(), repometrics_data_user()


Collate 'repometrics' data for a local R package.

Description

This forms part of the data collated by the main repometrics_data function, along with detailed data on individual contributors extracted by the repometrics_data_user function.

Usage

repometrics_data_repo(path, step_days = 1L, num_cores = -1L)

Arguments

path

Path to local repository containing an R package.

step_days

Analyse package at intervals of this number of days. The last commit for each day is chosen. For example, step_days = 7L will return weekly statistics. Values of zero or less will analyse all commits, including potentially multiple daily commits.

num_cores

Number of cores to use in multi-core processing. Has no effect on Windows operating systems, on which calculations are always single-core only. Negative values are subtracted from number of available cores, determined as parallel::detectCores(), so default of num_cores = -1L uses detectCores() - 1L. Positive values use precisely that number, restricted to maximum available cores, and a value of zero will use all available cores.

Value

A list with two main items:

  1. "pkgstats" Containing summary data from apply pkgstats routines across the git history of the repository.

  2. "cm" Containing data used to derive "CHAOSS metrics", primarily from GitHub data.

See Also

Other data: repo_pkgstats_history(), repometrics_data(), repometrics_data_user()


Extract and combine data on all contributors to a repository.

Description

This forms part of the data collated by the main repometrics_data function, along with data on repository structure and historical developed extracted by the repometrics_data_repo function.

Usage

repometrics_data_user(
  login,
  ended_at = Sys.time(),
  nyears = 1,
  n_per_page = 100
)

Arguments

login

GitHub login of user

ended_at

Parameter used in some aspects of resultant data to limit the end date of data collection. Defaults to Sys.time().

nyears

Parameter <= 1 determining fraction of a year over which data up until end_date are collected.

n_per_page

Number of items per page to pass to GitHub GraphQL API requests. This should never need to be changed.

Value

A list of the following data.frame objects:

  1. commit_cmt with details of commits made on commits

  2. commits with summaries of all repositories to which user made commits

  3. followers A list of followers of specified user

  4. following A list of other people who nominated user is following

  5. general with some general information about specified user

  6. issue_cmts with information on all issue comments made by user

  7. issues with information on all issues opened by user

See Also

Other data: repo_pkgstats_history(), repometrics_data(), repometrics_data_repo()