Skip to main content

Crate cccc_cli

Crate cccc_cli 

Source
Expand description

Shared CLI machinery for cccc front-ends.

Everything common to every language front-end lives here: argument parsing, file discovery, parallel analysis, the threshold/--min/--top logic, and output rendering. A language-specific binary (e.g. cccc-es) supplies only two things via run: how to analyze one file into a FileReport, and the default set of file extensions. This keeps the per-language binaries tiny and the behaviour identical across languages.

§Exit codes

run returns a process exit code with a consistent meaning:

  • 0 — success (including an existing input path that simply contains no matching files: “nothing to analyze” is not an error).
  • 1 — a --max-cognitive/--max-cyclomatic threshold was exceeded (the CI gate).
  • 2 — unable to proceed: a given path does not exist, or the worker pool could not be created. (clap’s own usage errors also exit 2.)

Functions§

run
Run the CLI end to end and return a process exit code.

Type Aliases§

AnalyzeFn
Analyze one file’s source into a FileReport. Implemented per language by the relevant adapter (e.g. cccc_typescript::analyze_source).