Skip to contents

default_scope() gives the files that each rule of general_rules() reads in the project folder path. It is the default scope of folder_findings().

Usage

default_scope(path, ignore = character(0))

Arguments

path

The project folder.

ignore

The top-level folders to leave out of entries, and so out of each element that comes from it.

Value

A named list with the elements entries, code, scripts, scripts_sorted, exempt_paths, changelog_code and frozen.

Details

The list has these elements:

  • entries: each file and folder of the project, as paths relative to path. In the top folder of a git repository, these are the files that git tracks or does not ignore, and their folders. Otherwise they are the files and folders on disk. The files and folders of an OS or an editor, such as .DS_Store and .git, are left out.

  • code, scripts and scripts_sorted: the .R files of entries under the folder R/. scripts_sorted has them in the C locale order.

  • exempt_paths: the paths of entries that lower_case_names passes. These are the files and folders named README.md, CHANGELOG.md, NEWS.md, AGENTS.md, CLAUDE.md, LICENSE, DESCRIPTION or NAMESPACE at any depth. So an R package passes on its standard files. The folder R at the top level holds the code, and it is exempt too. So is each file at the top level whose name starts with a dot or ends with .Rproj.

  • changelog_code: "^R/", so a change under R/ needs a change to CHANGELOG.md.

  • frozen: one element for each file of entries whose name ends with .frozen.md5. Its covers are the files on disk now in the folder of the manifest, at any depth and hidden files included. A file whose name ends with .frozen.md5 is not in covers. A file under a folder .git is not in covers either, because git changes these files. Its missing_detail is NULL, so no manifest is required.

Each path in a manifest is relative to path. So write a manifest with freeze(home = path), and put it in the folder that it freezes.

Examples

home <- file.path(tempdir(), "checkit_scope_example")
dir.create(file.path(home, "R"), recursive = TRUE)
dir.create(file.path(home, "data"))
writeLines("x <- 1", file.path(home, "R", "f.R"))
writeLines("a,b", file.path(home, "data", "raw.csv"))
checkit::freeze("data", "data/data.frozen.md5", home = home)
scope <- checkit::default_scope(home)
scope$code
#> [1] "R/f.R"
scope$frozen[[1]]$covers
#> [1] "data/raw.csv"
unlink(home, recursive = TRUE)