Tags: Flow

Hunk aware lines of code (HALOC) is the metric Flow uses to assess how much code is being changed. This metric is used in the calculations for all metrics that refer to lines of code, including Rework, Help others, Legacy refactor, tt100, and more.

Every commit is made of hunks. These hunks represent sections of changed code in the commit, separated by unchanged lines. The locations and sizes of these hunks are determined using git diff.

In each hunk, lines are either added (insertions) or deleted (deletions). Because Flow’s ingestion engine uses the unified diff view to determine changes, a changed line of code counts as both an insertion and a deletion. 

In each hunk, Flow looks at the number of insertions and the number of deletions, then takes the higher number as the HALOC for the hunk. If a hunk has 3 insertions and 4 deletions, the HALOC for the hunk is 4.

Note: Because a changed line of code counts as both an insertion and a deletion, it will always count toward HALOC for a hunk, regardless of whether there are more insertions or deletions overall.

The HALOC for a commit is the sum of the HALOCs for each hunk in the commit.

Calculating HALOC this way allows Flow to more closely represent the actual amount of code changed rather than what the git diff initially displays, which can often double-count work. Consider a commit where two lines of code were modified. Because a changed line counts for both an insertion and a deletion, the git diff says four lines of code were changed. But Flow’s HALOC measurement correctly represents that only two lines of code were changed.

back to top

If you need help, please contact Pluralsight Support.