Have larv-review round-title print a round commit's counts from its report, and rule-hook refuse a title that differs
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
"""round-title: print the opening of a round commit's title, counted from the round's report."""
|
||||
import pathlib
|
||||
|
||||
from failure import Failure
|
||||
from git_cli.git_repo import branch_titles, top
|
||||
from larv_review.reviewer_header import unanswered_round
|
||||
from project_config.main import title_templates
|
||||
from review_rules.review_folder import findings_in, review_folder, standing_report
|
||||
from review_rules.round_titles import round_prefix
|
||||
|
||||
|
||||
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."""
|
||||
titles = branch_titles(default)
|
||||
if isinstance(titles, Failure):
|
||||
return titles
|
||||
templates = title_templates(None, home)
|
||||
if isinstance(templates, Failure):
|
||||
return templates
|
||||
round_ = unanswered_round([templates.summary(title) for title in titles], 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)
|
||||
Reference in New Issue
Block a user