Skip to main content

Config

Struct Config 

Source
pub struct Config {
Show 16 fields pub format: Option<Format>, pub table: Option<bool>, pub ext: Option<BTreeMap<String, Vec<String>>>, pub exclude: Option<Vec<String>>, pub languages: Option<Vec<String>>, pub exclude_languages: Option<Vec<String>>, pub max_cognitive: Option<u32>, pub max_cyclomatic: Option<u32>, pub min: Option<u32>, pub violations: Option<bool>, pub no_ignore: Option<bool>, pub jobs: Option<u32>, pub pretty: Option<bool>, pub cache: Option<bool>, pub cache_file: Option<PathBuf>, pub source_dir: Option<PathBuf>,
}
Expand description

The deserialized cccc.toml. Every field is optional; an absent field means “defer to the CLI flag or the built-in default”. Unknown keys are rejected so typos surface as errors instead of being silently ignored.

Fields§

§format: Option<Format>

Output format (json, table or simple). Takes precedence over table when both are set.

§table: Option<bool>

Deprecated: use format = "table". Print a human-readable table instead of JSON.

§ext: Option<BTreeMap<String, Vec<String>>>

Per-language file-extension overrides, e.g. [ext] with es = ["ts"]. Each entry replaces that language’s default extensions (and so also routes those extensions to it). Keyed by a language’s canonical name or an alias. Languages without an entry keep their defaults.

§exclude: Option<Vec<String>>

Glob patterns of files to exclude.

§languages: Option<Vec<String>>

Languages to analyze (canonical names or aliases).

§exclude_languages: Option<Vec<String>>

Languages to exclude from analysis (the inverse of languages).

§max_cognitive: Option<u32>

Fail if any function’s cognitive complexity exceeds this.

§max_cyclomatic: Option<u32>

Fail if any function’s cyclomatic complexity exceeds this.

§min: Option<u32>

Only report functions whose complexity is >= this.

§violations: Option<bool>

Only report functions over max-cognitive / max-cyclomatic.

§no_ignore: Option<bool>

Do not respect .gitignore / ignore files.

§jobs: Option<u32>

Number of files to analyze in parallel.

§pretty: Option<bool>

Pretty-print the JSON output (the default is compact, one line).

§cache: Option<bool>

Cache results and reuse them for files unchanged since the last run.

§cache_file: Option<PathBuf>

Where to keep the results cache (default: .cccc.cache next to this config file). Does not enable caching by itself.

§source_dir: Option<PathBuf>

Directory containing the loaded config file. Not a config key — filled in at load time so the default cache location can sit beside the file.

Implementations§

Source§

impl Config

Source

pub fn resolve( explicit: Option<&Path>, no_config: bool, ) -> Result<Config, String>

Resolve the config for this run, honoring --config / --no-config.

  • --no-config (no_config = true): always returns an empty config.
  • --config <path> (explicit = Some): loads exactly that file; a missing or malformed file is an error.
  • neither: discovers a file by walking up from the current directory, returning the empty config if none is found.

Trait Implementations§

Source§

impl Debug for Config

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Config

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for Config

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more

Auto Trait Implementations§

§

impl Forget for Config

§

impl Freeze for Config

§

impl Move for Config

§

impl RefUnwindSafe for Config

§

impl Send for Config

§

impl Sync for Config

§

impl Unpin for Config

§

impl UnsafeUnpin for Config

§

impl UnwindSafe for Config

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<'a, T> FromIn<'a, T> for T

Source§

fn from_in(t: T, _: &'a Allocator) -> T

Converts to this type from the input type within the given allocator.
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<'a, T, U> IntoIn<'a, U> for T
where U: FromIn<'a, T>,

Source§

fn into_in(self, allocator: &'a Allocator) -> U

Converts this type into the (usually inferred) input type within the given allocator.
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.