I'm trying to figure out a way to analyze code longevity in open source projects: that is, how long a specific line of code is active and in use.
My current thinking is that a line of code's lifespan begins when it is first committed, and ends when one of the following occurs:
- It's edited or deleted,
- Excluded from builds,
- No code within its build is maintained for some period of time (say, a year).
NOTE: As clarification on why an "edit" is being counted as "death", edited lines would be counted as a "new" generation, or line of code. Also, unless there's an easy way to do this, there would be no accounting for the longevity of a lineage, or descent from an ancestor.
What else would determine a line of code's lifespan?