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.3.070
Built: 2025-01-16 12:37:03 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.


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_repo, data_users, action = "preview")

Arguments

data_repo

Data on repository as returned from repometrics_data_repo function applied to one package.

data_users

Data on repository developers ("users" in GitHub terms), as returned from repometrics_data_user 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.

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

Collate 'repometrics' data for a local R package

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.


Extract and combine all user data

Description

Extract and combine all user data

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