22 lines
1.0 KiB
Python
22 lines
1.0 KiB
Python
"""round-title: print the opening of a round commit's title, counted from the round's report."""
|
|
import pathlib
|
|
|
|
from larv_review.reviewer_header import branch_summaries, unanswered_round
|
|
from failure import Failure
|
|
from review_rules.review_folder import findings_in, review_folder, standing_report
|
|
from review_rules.round_titles import round_prefix
|
|
from git_cli.git_repo import top
|
|
|
|
|
|
def round_title(default: str, pass_: str, home: pathlib.Path) -> str | Failure:
|
|
"""The title prefix of pass_'s unanswered round, counted from that round's report in the chunk's review folder."""
|
|
summaries = branch_summaries(default, home)
|
|
round_ = summaries if isinstance(summaries, Failure) else unanswered_round(summaries, pass_)
|
|
if isinstance(round_, Failure):
|
|
return round_
|
|
worktree = top()
|
|
if isinstance(worktree, Failure):
|
|
return worktree
|
|
findings = findings_in(standing_report(pathlib.Path(review_folder(str(home), worktree)), pass_, round_))
|
|
return findings if isinstance(findings, Failure) else round_prefix(pass_, round_, findings)
|