Answer principles round 1: 1 🔴, 7 🟡 (0 misread); every effect is handed in as an argument, no test patches a global, and the traces principle scopes tools that run on their user's machine
CI / tests (pull_request) Successful in 3m43s
CI / tests (pull_request) Successful in 3m43s
This commit is contained in:
+12
-12
@@ -100,8 +100,8 @@ from failure import Failure
|
||||
from score_outcomes.results import file_lines, fixed_later, item_text, misreads, nearest, render, report, Result, results_of
|
||||
from plan.todo_table import item_details, LEVELS, risk, TOP_SCORE
|
||||
from text_files.markdown_text import listed
|
||||
from project_config.main import located, title_templates
|
||||
from plan.named_paths import named_files
|
||||
from project_config.main import project, title_templates
|
||||
from transcript_archive.location import project_archive
|
||||
from score_outcomes.reversals import reversal_lines
|
||||
from record_store.stores import store
|
||||
@@ -119,7 +119,7 @@ UNMERGED = [
|
||||
]
|
||||
|
||||
|
||||
def main(argv: list[str]) -> int:
|
||||
def main(argv: list[str], home: pathlib.Path) -> int:
|
||||
if argv[:1] in (["-h"], ["--help"]):
|
||||
print(__doc__.strip())
|
||||
return 0
|
||||
@@ -133,11 +133,11 @@ def main(argv: list[str]) -> int:
|
||||
default, note = found
|
||||
if note:
|
||||
print(f"score-outcomes: {note}", file=sys.stderr)
|
||||
results = read_results(default)
|
||||
results = read_results(default, home)
|
||||
if isinstance(results, Failure):
|
||||
return failed(results)
|
||||
anchored = read_anchors()
|
||||
reversal = read_reversals()
|
||||
anchored = read_anchors(home)
|
||||
reversal = read_reversals(home)
|
||||
print(report_text(results, anchored, dict(zip(GIVEN, map(int, argv))) if argv else None, reversal))
|
||||
unread = [found for found in (anchored, reversal) if isinstance(found, Failure)]
|
||||
for failure in unread:
|
||||
@@ -167,34 +167,34 @@ def failed(failure: Failure) -> int:
|
||||
return 1
|
||||
|
||||
|
||||
def read_anchors() -> Anchors | Failure:
|
||||
def read_anchors(home: pathlib.Path) -> Anchors | Failure:
|
||||
"""The project's anchors as they stand in the store its config names, so a branch that edits them shows its edit; none where it keeps none."""
|
||||
config = project()
|
||||
config = located(None, home)
|
||||
if isinstance(config, Failure):
|
||||
return config
|
||||
text = store(config, "score-anchors").read()
|
||||
return text if isinstance(text, Failure) else parse_anchors(text)
|
||||
|
||||
|
||||
def read_reversals() -> list[str] | Failure:
|
||||
def read_reversals(home: pathlib.Path) -> list[str] | Failure:
|
||||
"""The reversals in loop-claude's archive of this project, which the main checkout's path keys, whichever worktree this runs in."""
|
||||
common = git("rev-parse", "--path-format=absolute", "--git-common-dir")
|
||||
if isinstance(common, Failure):
|
||||
return common
|
||||
return reversal_lines(project_archive(str(pathlib.Path(common.strip()).parent), pathlib.Path.home(), os.environ))
|
||||
return reversal_lines(project_archive(str(pathlib.Path(common.strip()).parent), home, os.environ))
|
||||
|
||||
|
||||
def read_results(default: str) -> list[Result] | Failure:
|
||||
def read_results(default: str, home: pathlib.Path) -> list[Result] | Failure:
|
||||
"""What each chunk on the default branch's first-parent line measured."""
|
||||
if partial := full_history():
|
||||
return partial
|
||||
if why := unsupported(None, pathlib.Path.home()):
|
||||
if why := unsupported(None, home):
|
||||
return Failure(f"this project is not supported yet: {why}")
|
||||
root = top()
|
||||
if isinstance(root, Failure):
|
||||
return root
|
||||
run = functools.partial(git, cwd=root)
|
||||
templates = title_templates(None, pathlib.Path.home())
|
||||
templates = title_templates(None, home)
|
||||
if isinstance(templates, Failure):
|
||||
return templates
|
||||
chunks = branch_chunks(default, run, templates)
|
||||
|
||||
Reference in New Issue
Block a user