Skip to content

Exclude vendored and generated files from git line-count metrics #1798

Description

@aleksdotbar

Problem

Git line-count metrics (e.g. "Code lines added", "Lines added") sum every
added line reported by the commit diff. Files are bucketed only by
extension (code / docs / config), with no consideration of whether the
file is authored or machine-produced. As a result, content that a person did
not write by hand is counted as their contribution:

  • vendored dependencies checked into the repo (e.g. .venv / site-packages,
    node_modules, vendor/)
  • build/generated output (e.g. dist/, build/, minified bundles, generated
    code or data files)
  • lockfiles and other machine-managed artifacts

A single commit that adds such a directory can contribute hundreds of
thousands of lines under a code extension (e.g. vendored .py/.js), which
are then attributed as authored code.

Impact

  • Per-person distortion: individuals whose repos happen to include
    vendored/generated content show wildly inflated line counts that do not
    reflect real output. This correlates with role and repo hygiene rather than
    contribution.
  • Peer-pool distortion: because peer standing is computed against a
    cohort (e.g. department) median/quartiles, one such outlier skews the
    benchmark for everyone in that cohort, degrading every peer comparison in
    the group.
  • Line-count metrics are currently untrustworthy wherever a repo does not
    perfectly gitignore generated/vendored content — which is common.

Root cause

File classification keys on file extension only. There is no path-based
exclusion for vendored/generated content, so such files pass through the same
as authored source.

Proposed direction

Add a path-based exclusion applied before line-count aggregation, so
vendored/generated files are not counted toward authored line metrics:

  • Maintain an exclusion list of well-known vendored/generated path patterns
    (dependency directories, build output, minified assets, lockfiles). Treat it
    as configuration so it can evolve without code changes.
  • Apply the exclusion in the git file-change classification / observation
    layer so it flows consistently to every downstream line-count metric and to
    peer aggregation.
  • Consider a separate "generated/vendored" category rather than a hard drop,
    so the signal is auditable and could be surfaced distinctly later.

Acceptance criteria

  • Vendored/generated files are excluded from authored line-count metrics.
  • Exclusion patterns are configurable, not hard-coded per call site.
  • Exclusion is applied once, upstream, and reflected in every line-count
    metric and in peer/cohort aggregation.
  • Coverage for representative vendored/generated path patterns.

Scope

Independent of the metric-family migrations; affects the git domain only.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Fields

    No fields configured for Feature.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions