Skip to main content

Crate cccc_cli

Crate cccc_cli 

Source
Expand description

The unified cccc CLI.

One binary measures Cognitive Complexity and Cyclomatic Complexity across every bundled language. A file is routed to the right front-end by its extension (see lang), so a single run can analyze a mixed-language tree. Recurring options can be baked into a cccc.toml config file (see config); CLI flags always take precedence over it.

Everything common to the languages lives here: argument parsing, config resolution, file discovery, the results cache (see [cache]), parallel analysis, the threshold/--min/--top logic, and output rendering. Each language supplies only how to analyze one file and its default extensions, via the lang::LANGUAGES registry.

§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, a config/--lang value was invalid, or the worker pool could not be created. (clap’s own usage errors also exit 2.)

Modules§

config
Optional cccc.toml configuration file.
lang
The compiled-in registry of supported languages.

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_es::analyze_source).