Answer principles round 1: 0 🔴, 3 🟡 (0 misread); hand the home folder, the clock and the output to larv-review's commands from their wiring

This commit is contained in:
2026-11-13 03:04:44 +01:00
parent 87d5023773
commit e6da7b0b9c
22 changed files with 155 additions and 131 deletions
+15 -8
View File
@@ -75,14 +75,14 @@ class Commits(unittest.TestCase):
self.assertEqual(committed("cd a # go there\nGIT_EDITOR=true git commit -m x"), [CommitCall("/r/a", ["x"], False, False)])
def test_a_commit_after_a_heredoc_or_a_blank_line_is_seen(self):
self.assertEqual(len(committed("cat <<EOF > notes\nhello\nEOF\ngit commit -m a")), 1)
self.assertEqual(len(committed("git status &&\n\ngit commit -m a")), 1)
self.assertEqual(committed("cat <<EOF > notes\nhello\nEOF\ngit commit -m a"), [CommitCall("/r", ["a"], False, False)])
self.assertEqual(committed("git status &&\n\ngit commit -m a"), [CommitCall("/r", ["a"], False, False)])
def test_an_arithmetic_shift_is_no_heredoc(self):
self.assertEqual(len(committed("echo $((1<<2))\ngit commit -m a\n2")), 1)
self.assertEqual(committed("echo $((1<<2))\ngit commit -m a\n2"), [CommitCall("/r", ["a"], False, False)])
def test_a_line_that_does_not_parse_hides_only_itself(self):
self.assertEqual(len(committed("echo 'open\ngit commit -m a")), 1)
self.assertEqual(committed("echo 'open\ngit commit -m a"), [CommitCall("/r", ["a"], False, False)])
def test_a_redirect_keeps_its_command_s_words_together(self):
self.assertEqual(segments("echo hi > f arg"), [["echo", "hi", "arg"]])
@@ -892,16 +892,23 @@ class TodoRankCheck(unittest.TestCase):
self.config = configured(self, pathlib.Path(checkout)) / "config.toml"
return checkout
def test_a_changed_plan_that_cannot_be_read_is_a_breach(self):
checkout = self.changed_plan(self.other, "")
pathlib.Path(checkout, "todo.md").chmod(0)
self.addCleanup(pathlib.Path(checkout, "todo.md").chmod, 0o600)
self.assertEqual(len(self.details(checkout)), 1)
self.assertIn("Permission denied", self.details(checkout)[0])
def details(self, checkout: str) -> list[str]:
return [breach.detail for breach in todo_breaches(checkout, pathlib.Path(self.own))]
return [breach.detail for breach in todo_breaches(checkout, pathlib.Path.home(), pathlib.Path(self.own))]
def test_a_checkout_of_the_hooks_repo_runs_its_own_rank_todo(self):
checkout = self.changed_plan(f"{self.folder}/clone", self.STUB)
self.assertEqual(self.details(checkout), [f"own script checked {checkout}/todo.md"])
top = str(pathlib.Path(checkout).resolve())
self.assertEqual([(breach.rule, breach.directory) for breach in todo_breaches(checkout, pathlib.Path(self.own))], [("todo-rank-check", top)])
self.assertEqual([(breach.rule, breach.directory) for breach in todo_breaches(checkout, pathlib.Path.home(), pathlib.Path(self.own))], [("todo-rank-check", top)])
self.config.unlink()
self.assertEqual([(breach.rule, breach.directory) for breach in todo_breaches(checkout, pathlib.Path(self.own))], [("todo-rank-check", top)], "a todo.md with no config")
self.assertEqual([(breach.rule, breach.directory) for breach in todo_breaches(checkout, pathlib.Path.home(), pathlib.Path(self.own))], [("todo-rank-check", top)], "a todo.md with no config")
def test_its_own_rank_todo_passing_passes(self):
self.assertEqual(self.details(self.changed_plan(f"{self.folder}/clone", "")), [])
@@ -935,7 +942,7 @@ class TodoRankCheck(unittest.TestCase):
self.config.write_text(self.config.read_text().replace('"checkout:todo.md"', '"folder:todo.md"'))
(self.config.parent / "todo.md").write_text("# todo\n")
self.assertEqual(self.details(folder), [f"own script checked {folder}/todo.md"], "checked with the checkout's own rank_todo.py, as a commit there would be")
self.assertEqual([(breach.rule, breach.directory) for breach in todo_breaches(folder, pathlib.Path(self.own))], [("todo-rank-check", str(pathlib.Path(folder).resolve()))])
self.assertEqual([(breach.rule, breach.directory) for breach in todo_breaches(folder, pathlib.Path.home(), pathlib.Path(self.own))], [("todo-rank-check", str(pathlib.Path(folder).resolve()))])
git(folder, "add", "-A")
git(folder, "commit", "-q", "-m", "plan")
self.assertEqual(self.details(folder), [], "committed, so unchanged")