Repository navigation
refactor: split the longest functions, and test reusing scores under --skip - #217
Merged
Merged
Conversation
to_markdown was 143 lines. Each section -- the introduction, functions per file, elements per function, the top elements of a group, the per-file table and the skipped files -- is now its own function, and to_markdown puts them in order. The output is unchanged byte for byte. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
resolve was 109 lines. It now refuses `..`, makes the path absolute, finds the deepest part that exists, appends the rest and checks the result against the roots, each in a function of its own. The refusals that name the roots are made in one place. Every answer, refusals included, is unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
oinkie_review was 95 lines. Parsing the aggregator and min_elements, the review itself and the confinement of the birthmarks the score CSVs name are now functions of their own, and the scores are made by analysis::scores, which the other tools already used, rather than by a copy of it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Each was around 80 lines. run's extraction, reading a pair's CSV and parsing its result line, and building the lifter, lifting one file and running the lifts in jobs are now functions of their own. Comparing a pair and storing its CSV, and reusing the CSV an earlier run left, were written out in both perform_run and compare_impl; both now call compare_and_store and reuse_result. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
load_comparison was 82 lines. Reading a matrix line's column names and a row's values, and checking that the values fill the matrix, are now functions of their own. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
It read "a directory of pair CSVs similarity CSVs". It now says what those CSVs are and which tools wrote them. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…icate inputs run was 54 lines. Extracting each input once, into the destination or into memory, is now extract_inputs. Removing the inputs given more than once was written out in both extract_all and run; both now call unique_inputs. The pair's birthmark paths go to CompareResult::new as they are, since it takes anything that converts into a PathBuf. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A score no comparison gives is planted in a pair's CSV, and the second run with --skip must report it. Neither path was reached by any test. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ark_op Importing the variants inside the function lets each match arm and condition fit on one line.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Splits the longest functions in the CLI so that each is about 50 lines or fewer, removes the duplicated code the splitting turned up, and adds tests for a path no test reached. Behaviour does not change.
This is based on #215 and targets its branch, because both touch
perform_run. Once #215 is merged, GitHub retargets this tomain.Functions split
to_markdown(cli/stats.rs)Roots::resolve(cli/mcp/paths.rs)oinkie_review(cli/mcp/server.rs)perform_lift(cli/main.rs)load_comparison(cli/review.rs)perform_run(cli/main.rs)read_result_file(cli/main.rs)run(cli/mcp/analysis.rs)extract_birthmark_op(src/extract.rs)to_markdownhas one function per section of the report.Roots::resolvereads as its steps: refuse.., make the path absolute, find the deepest part that exists, append the rest, check it against the roots.Duplication removed
perform_runandcompare_impl. Both now callcompare_and_storeandreuse_result.oinkie_reviewbuilt its scores with a copy ofanalysis::scores. It now callsanalysis::scores.extract_alland the MCPrun. Both now callunique_inputs.CompareResult::newtakesimpl Into<PathBuf>, so callers pass a birthmark's path as it is.Fixes and tests
oinkie_review's tool description read "a directory of pair CSVs similarity CSVs". It now says what those CSVs hold and which tools wrote them.--skipreusing a pair's score, from eitherrunorcompare. Two CLI tests plant a score no comparison gives in a pair's CSV and require the second run with--skipto report it. Both fail when the reuse is disabled.Checked
to_markdown: the report fromoinkie stats -f markdown, with and without--per-file --top 3, over a directory that produces every section, is identical byte for byte before and after.resolve: its answers to six paths, the refusal messages included, are identical before and after.cargo test --features mcp(413 tests) and clippy with-D warningspass locally, and every commit builds on its own.🤖 Generated with Claude Code