pub struct JsFunctionMetrics {Show 19 fields
pub name: String,
pub file: PathBuf,
pub line: usize,
pub kind: FunctionKind,
pub cyclomatic: u32,
pub cognitive: u32,
pub nesting: u32,
pub length: usize,
pub is_test: bool,
pub is_async: bool,
pub async_patterns: Vec<AsyncPattern>,
pub parameter_count: u32,
pub is_exported: bool,
pub ts_patterns: Option<TypeScriptPatternResult>,
pub entropy_score: Option<EntropyScore>,
pub purity_level: Option<PurityLevel>,
pub purity_confidence: Option<f32>,
pub impurity_reasons: Vec<String>,
pub functional_chains: Vec<FunctionalChain>,
}Expand description
Function metrics specific to JavaScript/TypeScript
Fields§
§name: StringFunction name (may be empty for anonymous functions)
file: PathBufFile path
line: usizeLine number
kind: FunctionKindKind of function
cyclomatic: u32Cyclomatic complexity
cognitive: u32Cognitive complexity
nesting: u32Maximum nesting depth
length: usizeLines of code
is_test: boolIs this a test function
is_async: boolIs this an async function
async_patterns: Vec<AsyncPattern>Detected async patterns
parameter_count: u32Parameter count
is_exported: boolIs this function exported
ts_patterns: Option<TypeScriptPatternResult>TypeScript-specific patterns
entropy_score: Option<EntropyScore>Entropy-based complexity score
purity_level: Option<PurityLevel>Purity level classification
purity_confidence: Option<f32>Confidence in purity analysis (0.0 to 1.0)
impurity_reasons: Vec<String>Reasons for impurity (if any)
functional_chains: Vec<FunctionalChain>Functional map/filter/reduce style chains detected for this function
Implementations§
Source§impl JsFunctionMetrics
impl JsFunctionMetrics
Sourcepub fn new(name: String, file: PathBuf, line: usize, kind: FunctionKind) -> Self
pub fn new(name: String, file: PathBuf, line: usize, kind: FunctionKind) -> Self
Create a new JsFunctionMetrics
Sourcepub fn is_complex(&self, threshold: u32) -> bool
pub fn is_complex(&self, threshold: u32) -> bool
Check if function complexity exceeds threshold
Trait Implementations§
Source§impl Clone for JsFunctionMetrics
impl Clone for JsFunctionMetrics
Source§fn clone(&self) -> JsFunctionMetrics
fn clone(&self) -> JsFunctionMetrics
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for JsFunctionMetrics
impl Debug for JsFunctionMetrics
Source§impl<'de> Deserialize<'de> for JsFunctionMetrics
impl<'de> Deserialize<'de> for JsFunctionMetrics
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
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 Freeze for JsFunctionMetrics
impl RefUnwindSafe for JsFunctionMetrics
impl Send for JsFunctionMetrics
impl Sync for JsFunctionMetrics
impl Unpin for JsFunctionMetrics
impl UnsafeUnpin for JsFunctionMetrics
impl UnwindSafe for JsFunctionMetrics
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> EnsureExt<T> for T
impl<T> EnsureExt<T> for T
Source§fn ensure<P, E>(self, predicate: P, error: E) -> Validation<T, NonEmptyVec<E>>where
P: Predicate<T>,
fn ensure<P, E>(self, predicate: P, error: E) -> Validation<T, NonEmptyVec<E>>where
P: Predicate<T>,
Validate that this value satisfies the given predicate. Read more
Source§fn ensure_with<P, E, F>(
self,
predicate: P,
error_fn: F,
) -> Validation<T, NonEmptyVec<E>>
fn ensure_with<P, E, F>( self, predicate: P, error_fn: F, ) -> Validation<T, NonEmptyVec<E>>
Validate with an error-generating function. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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