Skip to main content

HealthConfig

Struct HealthConfig 

Source
pub struct HealthConfig {
    pub max_cyclomatic: u16,
    pub max_cognitive: u16,
    pub max_crap: f64,
    pub crap_refactor_band: u16,
    pub max_unit_size: u32,
    pub coverage: Option<PathBuf>,
    pub coverage_root: Option<PathBuf>,
    pub ignore: Vec<String>,
    pub threshold_overrides: Vec<HealthThresholdOverride>,
    pub ownership: OwnershipConfig,
    pub suggest_inline_suppression: bool,
}
Expand description

Configuration for complexity health metrics (fallow health).

Fields§

§max_cyclomatic: u16

Maximum allowed cyclomatic complexity per function (default: 20). Functions exceeding this threshold are reported. Governs findings only; the health score’s complexity penalties use fixed calibration (use health.ignore to remove a file from the score).

§max_cognitive: u16

Maximum allowed cognitive complexity per function (default: 15). Functions exceeding this threshold are reported. Governs findings only, never the health score.

§max_crap: f64

Maximum allowed CRAP (Change Risk Anti-Patterns) score per function (default: 30.0). CRAP combines cyclomatic complexity with test coverage: high complexity plus low coverage produces a high CRAP score. Functions meeting or exceeding this threshold are reported. Use --coverage with Istanbul data for accurate per-function CRAP; otherwise fallow estimates coverage from the module graph. Governs findings and the threshold-relative file-score signals (crap_above_threshold, the risk triage tag, and the add_test_coverage refactoring target); measured values such as crap_max and the overall health score never move with it. Set to 0 to disable CRAP enforcement entirely: no findings, nothing counts above threshold, and file-score rows disclose baseline breaches as exempt instead. The complexity-crap rule is different: it decides if a finding fails the run, and off hides the findings but keeps the file-score signals.

§crap_refactor_band: u16

Band below maxCyclomatic where CRAP-only findings also receive a secondary refactor-function action (default: 5). Set to 0 to only suggest refactoring when cyclomatic already meets the configured threshold.

§max_unit_size: u32

Maximum function length in lines of code before it is reported as an oversized “large function” (default: 60). Raise it globally, or per file via thresholdOverrides[].maxUnitSize, to relax the bar for generated or test files (where a describe() block spans hundreds of lines) without disabling complexity checks on those files. This filters the reported large-functions list only; the descriptive unit-size profile and the health score still reflect raw sizes against fixed calibration (the unit_size penalty keeps its >60 LOC very-high-risk edge so grades stay comparable across projects; use health.ignore to remove a file from the score entirely).

§coverage: Option<PathBuf>

Path to Istanbul coverage data (coverage-final.json) or raw V8 coverage (a NODE_V8_COVERAGE directory or one V8 JSON file) for accurate per-function CRAP scores. Relative paths resolve against the project root. The CLI --coverage flag and FALLOW_COVERAGE environment variable override this value. Consulted by fallow health, bare fallow, fallow audit, fallow viz, and the MCP audit / check_health tools.

§coverage_root: Option<PathBuf>

Absolute prefix to strip from Istanbul file paths before CRAP matching. Use when coverage was generated under a different checkout root in CI or Docker. The CLI --coverage-root flag and FALLOW_COVERAGE_ROOT environment variable override this value. Consulted by fallow health, bare fallow, fallow audit, fallow viz, and the MCP audit / check_health tools.

§ignore: Vec<String>

Glob patterns to exclude from complexity analysis.

§threshold_overrides: Vec<HealthThresholdOverride>

Per-file or per-function threshold overrides. These keep exceptional functions visible as configured numeric ceilings instead of hiding them behind binary suppressions.

§ownership: OwnershipConfig

Ownership analysis configuration. Controls bot filtering and email privacy mode for --ownership output.

§suggest_inline_suppression: bool

Whether health JSON output emits suppress-line action hints alongside complexity findings (default: true). Set to false to opt out across the project: useful for teams that manage suppressions exclusively through // fallow-ignore-* comments authored by hand or through the fallow.suppress LSP code action, but who do not want CI-driven suppress-line action hints in their JSON output. --baseline activates auto-omission regardless of this setting, since baseline files are a separate suppression mechanism.

Implementations§

Source§

impl HealthConfig

Source

pub fn threshold_override_errors(&self) -> Vec<String>

Validate semantic constraints that serde cannot express.

Trait Implementations§

Source§

impl Clone for HealthConfig

Source§

fn clone(&self) -> HealthConfig

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for HealthConfig

Source§

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

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

impl Default for HealthConfig

Source§

fn default() -> HealthConfig

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

impl<'de> Deserialize<'de> for HealthConfig

Source§

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

Deserialize this value from the given Serde deserializer. Read more
Source§

impl JsonSchema for HealthConfig

Source§

fn schema_name() -> Cow<'static, str>

The name of the generated JSON Schema. Read more
Source§

fn schema_id() -> Cow<'static, str>

Returns a string that uniquely identifies the schema produced by this type. Read more
Source§

fn json_schema(generator: &mut SchemaGenerator) -> Schema

Generates a JSON Schema for this type. Read more
Source§

fn inline_schema() -> bool

Whether JSON Schemas generated for this type should be included directly in parent schemas, rather than being re-used where possible using the $ref keyword. Read more
Source§

impl Serialize for HealthConfig

Source§

fn serialize<__S>( &self, __serializer: __S, ) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

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

Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

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> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. 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.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more