band-aider-pub/band_aider/judgement/coverage_strategy.py
2026-07-16 18:38:58 -07:00

50 lines
1.2 KiB
Python

# SPDX-FileCopyrightText: 2026 Art Sea LLC
#
# SPDX-License-Identifier: AGPL-3.0-only
from __future__ import annotations
from pathlib import Path
from typing import Protocol
from band_aider.context.class_meta import ClassMeta
class CoverageStrategy(Protocol):
"""CoverageStrategy reports whether source coverage is sufficient for stabilization to stop."""
def corresponding_tests_for(
self,
source_file: ClassMeta,
test_files: list[ClassMeta],
repo_root: Path,
src_root: Path,
test_root: Path,
) -> list[ClassMeta]:
"""Return tests that correspond to one source file."""
...
def coverage_is_sufficient(
self,
source_files: list[ClassMeta],
test_files: list[ClassMeta],
repo_root: Path,
src_root: Path,
test_root: Path,
) -> bool:
"""Return whether branch coverage is sufficient for stabilization acceptance."""
...
def branch_coverage_for(
self,
source_files: list[ClassMeta],
test_files: list[ClassMeta],
repo_root: Path,
src_root: Path,
test_root: Path,
) -> float:
"""Return branch coverage as a value from 0.0 through 1.0."""
...