Skip to main content

analyze_function_responsibility

Function analyze_function_responsibility 

Source
pub fn analyze_function_responsibility(function_name: &str) -> Option<String>
Expand description

Pure function: analyzes function name and returns primary responsibility category.

Reuses existing behavioral categorization infrastructure to provide uniform responsibility analysis across all debt items (not just god objects).

§Arguments

  • function_name - Name of the function to analyze

§Returns

  • Some(category) - If behavioral category can be inferred with high confidence (>= 0.7)
  • None - If function name doesn’t clearly indicate a behavioral pattern

§Examples

use debtmap::organization::god_object::classifier::analyze_function_responsibility;

assert_eq!(analyze_function_responsibility("validate_email"), Some("Validation".to_string()));
assert_eq!(analyze_function_responsibility("parse_json"), Some("Parsing".to_string()));
assert_eq!(analyze_function_responsibility("get_user"), Some("Data Access".to_string()));
assert_eq!(analyze_function_responsibility("do_stuff"), None); // Low confidence

§Stillwater Principle: Pure Core

This function is pure - same input always gives same output, no side effects. Responsibility inference happens once during analysis, not during rendering.