Skip to main content

code_churn

Function code_churn 

Source
pub fn code_churn(
    lines_added: f64,
    lines_modified: f64,
    lines_deleted: f64,
) -> f64
Expand description

Code churn: lines added + lines modified + lines deleted over a window.

Churn on its own is a weak signal — pair it with a complexity measure via hotspot_score to identify genuine hotspots rather than merely actively developed files.

§Arguments

  • lines_added — lines added across the commits in the window.
  • lines_modified — lines modified across the commits in the window.
  • lines_deleted — lines deleted across the commits in the window.

§Returns

The total churn (sum of added, modified, and deleted lines).

§Examples

use software_engineering::code_churn::code_churn;

// "lines added, modified, and deleted across successive commits."
assert_eq!(code_churn(220.0, 140.0, 60.0), 420.0);