pub struct StyleIr {Show 24 fields
pub language: Language,
pub line_count: usize,
pub functions: Vec<FunctionNode>,
pub panic_call_count: usize,
pub naming_violation_count: usize,
pub deeply_nested_block_count: usize,
pub debug_call_count: usize,
pub excessive_param_count: usize,
pub unsafe_block_count: usize,
pub magic_number_count: usize,
pub commented_out_lines: usize,
pub todo_count: usize,
pub goroutine_spawn_count: usize,
pub defer_in_loop_count: usize,
pub go_convention_count: usize,
pub python_issue_count: usize,
pub java_issue_count: usize,
pub ruby_issue_count: usize,
pub c_issue_count: usize,
pub ts_issue_count: usize,
pub js_issue_count: usize,
pub swift_issue_count: usize,
pub dead_code_count: usize,
pub duplicate_import_count: usize,
}Expand description
Language-neutral style facts for one parsed source file.
Style IR stores observed facts, not user-facing interpretation. Detector methods may combine facts into weighted signals, but the public fields stay close to adapter-extracted source evidence.
Fields§
§language: LanguageSource language used by the adapter that produced this IR.
line_count: usizePhysical source line count measured from the original file content.
functions: Vec<FunctionNode>Function facts required by structure-level style detectors.
panic_call_count: usizeCount of panic-prone calls or macros such as unwrap, expect, and panic.
naming_violation_count: usizeCount of adapter-defined naming violations such as unclear identifiers.
deeply_nested_block_count: usizeCount of block nodes that cross the nesting threshold.
debug_call_count: usizeCount of debug or temporary-output calls such as println and dbg.
excessive_param_count: usizeCount of functions whose parameter count exceeds the stable threshold.
unsafe_block_count: usizeCount of explicit unsafe blocks observed in the source file.
magic_number_count: usizeCount of literal numbers that adapters classify as magic numbers.
commented_out_lines: usizeCount of commented-out code lines (blocks of 3+ consecutive comment lines).
todo_count: usizeCount of TODO/FIXME/BUG/HACK markers in comments.
goroutine_spawn_count: usizeCount of goroutine go statement spawns (Go-specific).
defer_in_loop_count: usizeCount of defer statements inside for loops (Go-specific).
go_convention_count: usizeCount of Go convention violations (error string case, context order, else-return).
python_issue_count: usizeCount of Python-specific code issues (wildcard imports, bool comparisons, identity violations, type:ignore, legacy formatting, custom dunders, import order).
java_issue_count: usizeCount of Java-specific code issues (empty catch, missing javadoc, try-finally close, string concat in loop, wildcard imports).
ruby_issue_count: usizeCount of Ruby-specific code issues (global variables, bare rescue, frozen_string_literal, negated if, predicate naming, indent).
c_issue_count: usizeCount of C/C++ code issues (goto, new-expression, sizeof-type, etc.).
ts_issue_count: usizeCount of TypeScript code issues (any-type, prefer-interface, no-enum).
js_issue_count: usizeCount of JavaScript code issues (eval, with, ==, var, alert).
swift_issue_count: usizeCount of Swift code issues (force-unwrap, try!, implicitly unwrapped optionals).
dead_code_count: usizeCount of dead code blocks — unreachable code after return/break/continue/panic.
duplicate_import_count: usizeCount of duplicate import statements.
Implementations§
Source§impl StyleIr
impl StyleIr
Sourcepub fn from_parsed(file: &ParsedFile) -> Option<Self>
pub fn from_parsed(file: &ParsedFile) -> Option<Self>
Build Style IR from a tree-sitter parsed file.
Returns None when a language has no semantic adapter yet. Callers can
keep using legacy rule logic while individual detectors migrate to IR.
Sourcepub fn god_function_count(&self) -> usize
pub fn god_function_count(&self) -> usize
Count functions that exceed the project-level god-function threshold.
Sourcepub fn over_engineering_count(&self) -> usize
pub fn over_engineering_count(&self) -> usize
Count the combined over-engineering signal violations.
Sourcepub fn code_smell_count(&self) -> usize
pub fn code_smell_count(&self) -> usize
Count the combined code-smell signal violations.
Sourcepub fn summary(&self) -> StyleIrSummary
pub fn summary(&self) -> StyleIrSummary
Build a stable, JSON-ready summary for downstream consumers.
Sourcepub fn is_clean_signal_baseline(&self) -> bool
pub fn is_clean_signal_baseline(&self) -> bool
Return true when the IR has no extracted style signals.