Show the size of the code each finished item names beside its S in score-outcomes
This commit is contained in:
@@ -45,7 +45,10 @@ Given L, E and I, on the levels ~/.claude/rules/todo-items.md defines, and S, it
|
||||
L, E and I, as rank_todo.py does, and lists the 5 finished items whose guesses sit closest, closest
|
||||
first: the least mean squared difference over the scores both hold, so R and S alone for an item
|
||||
scored before L, E and I, the newest first among equals. Each line gives what the item's chunk
|
||||
measured, which items shipped with it, and its tagline.
|
||||
measured, which items shipped with it, and its tagline. Where the item's tagline or detail names
|
||||
tracked files or folders, each in backticks such as `bin/rank_todo.py`, the line gives their size
|
||||
before the chunk beside the item's S: how many files and their lines, which bound what the change
|
||||
could touch.
|
||||
|
||||
Then the project's anchors, the shipped items its docs/score-anchors.md names for each level of L,
|
||||
E and I, read from the checkout's working tree, each line as above, or that no chunk shipped it. A
|
||||
@@ -73,6 +76,7 @@ clone, or the default branch cannot be read; or, after the rest of the report, w
|
||||
left out.
|
||||
"""
|
||||
import functools
|
||||
import os
|
||||
import pathlib
|
||||
import re
|
||||
import sys
|
||||
@@ -81,9 +85,10 @@ from score_outcomes.anchors import anchor_lines, Anchors, ANCHORS_PATH, parse_an
|
||||
from branch_chunks.read import branch_chunks
|
||||
from git_cli.git_repo import default_branch, full_history, git, top
|
||||
from failure import Failure
|
||||
from score_outcomes.results import fixed_later, misreads, nearest, render, report, Result, results_of
|
||||
from release_plan.todo_table import LEVELS, risk, TOP_SCORE
|
||||
from score_outcomes.results import file_lines, fixed_later, item_text, misreads, nearest, render, report, Result, results_of
|
||||
from release_plan.todo_table import item_details, LEVELS, risk, TOP_SCORE
|
||||
from records.markdown_text import listed
|
||||
from release_plan.named_code import named_files
|
||||
|
||||
# The scores score-outcomes takes, in order.
|
||||
GIVEN = ("L", "E", "I", "S")
|
||||
@@ -165,12 +170,25 @@ def read_results(default: str) -> list[Result] | Failure:
|
||||
chunks = branch_chunks(default, run)
|
||||
if isinstance(chunks, Failure):
|
||||
return chunks
|
||||
empty_tree = run("hash-object", "-t", "tree", os.devnull)
|
||||
if isinstance(empty_tree, Failure):
|
||||
return empty_tree
|
||||
results: list[Result] = []
|
||||
for chunk in chunks:
|
||||
if chunk.before is None or not chunk.shipped:
|
||||
continue
|
||||
numstat = run("diff", "--numstat", chunk.before, chunk.tip)
|
||||
if isinstance(numstat, Failure):
|
||||
return numstat
|
||||
results += results_of(chunk, numstat)
|
||||
numstat, plan = run("diff", "--numstat", chunk.before, chunk.tip), run("show", f"{chunk.before}:todo.md")
|
||||
if isinstance(numstat, Failure) or isinstance(plan, Failure):
|
||||
return numstat if isinstance(numstat, Failure) else plan
|
||||
found = item_details(plan)
|
||||
details = {} if isinstance(found, Failure) else found
|
||||
tracked = run("ls-tree", "-r", "-z", "--name-only", chunk.before)
|
||||
if isinstance(tracked, Failure):
|
||||
return tracked
|
||||
# Only the files the items name, since counting every file's lines for every chunk doubles the run.
|
||||
named = list(dict.fromkeys(path for item in chunk.shipped for path in named_files(item_text(item, details), tracked.split("\0")[:-1])))
|
||||
tree = run("--literal-pathspecs", "diff", "--numstat", empty_tree.strip(), chunk.before, "--", *named) if named else ""
|
||||
if isinstance(tree, Failure):
|
||||
return tree
|
||||
results += results_of(chunk, numstat, details, file_lines(tree))
|
||||
return results
|
||||
|
||||
Reference in New Issue
Block a user