Repository navigation
Split lms linters into one file each and match expectation arguments as R does - #40
Conversation
psc#33 moved lms here unchanged, so its review findings were deferred. - #35: split R/linters.R into one file per function, as psc's coding-practices chapter asks. The four functions move verbatim; only the man/ source headers change. - #34: condition_class_linter() counted only a named class = argument, so expect_error(f(), "msg", "my_class") was flagged. A new match_expectation_args() matches object, regexp and class as R does: named (exact or unique partial) first, then unnamed in order. Four of the five new tests fail on the old linter. Bump lms to 0.1.2 for the rule change. - #32: re-break lms/README.md at sentence and clause boundaries. It also told readers to install from the lms-v0.1.1 tag, which does not exist, so the examples now pin a commit, as the lab manual does. Closes #32, closes #34, closes #35. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Jt6yVGbqCGUgWio5QUBDex
The self-review of 58c6168 found calls the matcher misread: a piped object, a comment between arguments, a backticked or quoted argument name, an empty argument, and a forwarded `...`. call_arg_slots() now splits the call into argument slots, skipping comments and stripping name delimiters. match_expectation_args() counts the piped value as the first unnamed argument, lets an empty argument take its slot without supplying it, and treats `...` as possibly supplying anything. Nine of the new expectations fail on 58c6168's matcher. The README now says the pinned 0.1.1 commit predates the fix. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Jt6yVGbqCGUgWio5QUBDex
The second self-review found cases the matcher still misread. piped_into() now recognizes magrittr pipes (%>%, %T>%, %<>%) as well as |>, skipping comments before the call. A placeholder (`_` for |>, `.` for magrittr) keeps the piped value out of the positional slots. A named argument with an empty value takes its formal but supplies nothing, and a leading empty argument keeps its slot. All six new expectations fail on 118adb3. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Jt6yVGbqCGUgWio5QUBDex
|
Claude finished review — View run Clean. This completes my review. The implementation is well-tested, the logic traces correctly through every test case I checked by hand, documentation/links are accurate, issue references are real, and the referenced commit SHA in the README genuinely predates the fix. I found no blocking issues. Review: #40 — Clear the lms issues deferred from the moveScope. Entirely within Correctness. I don't have R/lintr/xml2 available in this sandbox to execute the test suite, so I hand-traced the new matching logic ( Build hygiene / consistency checks performed:
No AI hallucinations found (URLs, SHAs, and issue numbers all check out), no CLAUDE.md violations, no accidental VerdictReady for merge Structured Review Data (JSON){
"schema_version": "1.1",
"reviewer": "claude",
"commit_sha": "02eafe928317d616ba5a0eb1b172e4208234f018",
"verdict": "CLEAN",
"findings": [],
"detailed_assessment": "Hand-traced match_expectation_args.R, call_arg_slots.R, and piped_into.R against roughly fifteen new testthat cases covering pipes, placeholders, comments, and empty arguments without finding a divergence from R's own argument-matching order.",
"holistic_assessment": "Verified man page source headers, NAMESPACE exports, referenced issue numbers, and the pinned install commit SHA all stayed consistent after the R/linters.R file split and version bump to 0.1.2."
}Reviewed commit: 903973b |
2026-10-16 03:34 UTC |
|
agy review of 903973b (model: Gemini 4 Argon (High), Adversarial Review of
|
|
The agy review's one nit (a Posted by Claude Code (AI agent) --- not written by a human. Generated by Claude Code |
Before:
lms/R/linters.Rheld four unrelated objects in one file, andcondition_class_linter()only recognized aclassargument passed by name. It flagged correct calls such asexpect_error(f(), "msg", "my_class")andf() |> expect_error("msg", class = "c"), and it missed calls whoseregexpwas partially named or piped.After: each function has its own file, and the linter matches an expectation's
object,regexpandclassarguments the way R does. That covers named, partially named and positional arguments,|>and magrittr pipes and their placeholders, comments between arguments, quoted or backticked names, empty arguments, and a forwarded....How:
call_arg_slots()splits a call's parse tree into argument slots,piped_into()names the pipe feeding a call, andmatch_expectation_args()applies R's matching order (exact or partial names, then positions) to the three formals.lmsis bumped to 0.1.2, and the README now says the pinned 0.1.1 commit predates this fix.Each round of tests was checked against the previous commit: the new expectations fail there and pass here. Three rounds of adversarial self-review ended CLEAN on cc33a35.
Closes #32, closes #34, closes #35.
🤖 Generated with Claude Code
https://claude.ai/code/session_01Jt6yVGbqCGUgWio5QUBDex
Generated by Claude Code