Packages

Elixir coverage diffing by code block, not by line number. Certitudo snapshots test coverage and compares snapshots block by block, separating real coverage changes from ordinary source movement.

Current section

Files

Jump to
certitudo lib certitudo conspectus fingerprint.ex
Raw

lib/certitudo/conspectus/fingerprint.ex

defmodule Certitudo.Conspectus.Fingerprint do
@moduledoc """
Semantic fingerprint for coverage conspectus.
"""
@stable_keys ["schema_version", "filter", "modules", "totals"]
@spec calculate(map()) :: binary()
def calculate(snapshot) when is_map(snapshot) do
snapshot
|> Map.take(@stable_keys)
|> :erlang.term_to_binary()
|> then(&:crypto.hash(:sha256, &1))
|> Base.encode16(case: :lower)
end
end