Skip to contents

Translates R-level options into the character vector of CLI flags passed to scc via processx::run(). The output always starts with c("--format", "json", "--sort", <sort>).

Usage

build_args(
  sort = "code",
  by_file = FALSE,
  no_complexity = FALSE,
  uloc = FALSE,
  dryness = FALSE,
  character = FALSE,
  percent = FALSE,
  size_unit = NULL,
  verbose = FALSE,
  debug = FALSE,
  no_duplicates = FALSE,
  binary = FALSE,
  gen = FALSE,
  no_gen = FALSE,
  min = FALSE,
  no_min = FALSE,
  min_gen = FALSE,
  no_min_gen = FALSE,
  min_gen_line_length = NULL,
  generated_markers = NULL,
  include_ext = NULL,
  exclude_ext = NULL,
  exclude_dir = NULL,
  exclude_file = NULL,
  not_match = NULL,
  count_as = NULL,
  remap_all = NULL,
  remap_unknown = NULL,
  include_symlinks = FALSE,
  no_large = FALSE,
  large_byte_count = NULL,
  large_line_count = NULL,
  count_ignore = FALSE,
  no_gitignore = FALSE,
  no_gitmodule = FALSE,
  no_ignore = FALSE,
  no_scc_ignore = FALSE,
  no_hborder = FALSE,
  no_size = FALSE,
  no_cocomo = FALSE,
  avg_wage = NULL,
  cocomo_project_type = NULL,
  eaf = NULL,
  overhead = NULL,
  currency_symbol = NULL,
  sloccount_format = FALSE,
  directory_walker_job_workers = NULL,
  file_gc_count = NULL,
  file_list_queue_size = NULL,
  file_process_job_workers = NULL,
  file_summary_job_queue_size = NULL
)

Arguments

sort

Column to sort by. One of "name", "files", "lines", "code", "comments", "blanks", "complexity". Default "code".

by_file

Logical. Add --by-file flag when TRUE.

no_complexity

Logical. Skip complexity calculation (-c).

uloc

Logical. Calculate unique lines of code (-u).

dryness

Logical. Calculate project DRYness; implies uloc (-a).

character

Logical. Calculate max/mean characters per line (-m).

percent

Logical. Include percentage values in tabular output (-p). No effect on the returned tibble.

size_unit

Character. Set size unit for display. One of "si", "binary", "mixed", or an "xkcd-*" variant. Default NULL (scc default "si").

verbose

Logical. Verbose output (-v).

debug

Logical. Enable debug output.

no_duplicates

Logical. Remove duplicate files from stats (-d).

binary

Logical. Disable binary-file detection.

gen

Logical. Identify generated files.

no_gen

Logical. Ignore generated files; implies gen.

min

Logical. Identify minified files.

no_min

Logical. Ignore minified files; implies min.

min_gen

Logical. Identify minified or generated files (-z).

no_min_gen

Logical. Ignore minified or generated files; implies min_gen.

min_gen_line_length

Integer. Bytes per average line threshold for minified/generated detection. Default NULL (scc default 255).

generated_markers

Character vector. Strings in the head of a file that mark it as generated. Passed comma-separated. Default NULL (scc defaults: c("do not edit", "<auto-generated />")).

include_ext

Character vector. Limit to these file extensions (comma-separated in one flag, e.g. c("go", "java")) (-i).

exclude_ext

Character vector. Ignore these file extensions; overrides include_ext (-x).

exclude_dir

Character vector. Directories to exclude. Default NULL (scc defaults: .git, .hg, .svn).

exclude_file

Character vector. Ignore files with matching names (-n). Default NULL (scc defaults: lock files).

not_match

Character vector. Ignore files/directories whose path matches any regex pattern. Each element becomes its own --not-match flag (-M).

count_as

Character. Map extensions to languages, e.g. "jsp:htm,chead:C Header".

remap_all

Character. Inspect every file and remap by string match, e.g. "-*- C++ -*-:C Header".

remap_unknown

Character. Like remap_all but only for unknown-type files.

Logical. Count symlinked files.

no_large

Logical. Ignore files exceeding large_byte_count / large_line_count.

large_byte_count

Integer. Byte threshold for large-file removal. Default NULL (scc default 1000000).

large_line_count

Integer. Line threshold for large-file removal. Default NULL (scc default 40000).

count_ignore

Logical. Count .gitignore / .ignore files.

no_gitignore

Logical. Disable .gitignore logic.

no_gitmodule

Logical. Disable .gitmodules logic.

no_ignore

Logical. Disable .ignore logic.

no_scc_ignore

Logical. Disable .sccignore logic.

no_hborder

Logical. Remove horizontal borders from tabular output. No effect on the returned tibble.

no_size

Logical. Remove size-calculation line from tabular output. No effect on the returned tibble.

no_cocomo

Logical. Remove COCOMO output from tabular display.

avg_wage

Integer. Average annual wage for COCOMO calculation. Default NULL (scc default 56286).

cocomo_project_type

Character. COCOMO model type: "organic", "semi-detached", "embedded", or "custom,a,b,c,d". Default NULL (scc default "organic").

eaf

Numeric. Effort adjustment factor for COCOMO. Default NULL (scc default 1).

overhead

Numeric. Corporate overhead multiplier for COCOMO. Default NULL (scc default 2.4).

currency_symbol

Character. Symbol used in COCOMO cost display. Default NULL (scc default "$").

sloccount_format

Logical. Print SLOCCount-style COCOMO output.

directory_walker_job_workers

Integer. Workers for directory walking. Default NULL (scc default 8).

file_gc_count

Integer. Files parsed before GC is enabled. Default NULL (scc default 10000).

file_list_queue_size

Integer. Queue size for discovered files. Default NULL (scc default 12).

file_process_job_workers

Integer. Workers for file-stat collection. Default NULL (scc default 12).

file_summary_job_queue_size

Integer. Queue size for processed-file stats. Default NULL (scc default 12).

Value

Character vector of CLI arguments.

Details

Flags that only affect scc's tabular display (--no-hborder, --no-size, --percent, COCOMO formatting) are accepted and forwarded but do not change the returned tibble, because the wrapper always requests JSON output.

Examples

if (FALSE) { # \dontrun{
build_args("code", by_file = FALSE)
build_args("lines", no_complexity = TRUE, include_ext = "r", by_file = TRUE)
build_args("code", uloc = TRUE, exclude_dir = c("tests", "vignettes"))
} # }