prefix stdout with link/copy#86
Merged
Merged
Conversation
Reviewer's GuideThis PR adds explicit operation prefixes (“link” or “copy”) to both test assertions and runtime log output by introducing a new AssertStdout helper, updating existing tests to use it and enforce prefix expectations, and modifying the link function to emit the correct operation in its log messages. Class diagram for new AssertStdout helper and link function changesclassDiagram
class AssertStdout {
+AssertStdout(t *testing.T, expected []string, actual []string)
}
class Link {
+link(sourcePath string, targetDir string) error
-op string
}
AssertStdout <.. TestCases : used by
Link <.. log.Default : logs operation
Link <.. internal.Copy : calls
Link <.. internal.SameFile : calls
File-Level Changes
Assessment against linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Hey there - I've reviewed your changes - here's some feedback:
- The AssertStdout helper slices the first 5 characters to strip the prefix but only checks HasPrefix("copy") or HasPrefix("link"); it should validate "copy " and "link " (with the space) and adjust the slice accordingly to avoid off-by-one errors.
- The assertion error message references "line" instead of "link"—update it to mention the correct prefix.
- Consider defining constants for the "copy " and "link " prefixes to avoid hardcoding the length and make future changes safer.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- The AssertStdout helper slices the first 5 characters to strip the prefix but only checks HasPrefix("copy") or HasPrefix("link"); it should validate "copy " and "link " (with the space) and adjust the slice accordingly to avoid off-by-one errors.
- The assertion error message references "line" instead of "link"—update it to mention the correct prefix.
- Consider defining constants for the "copy " and "link " prefixes to avoid hardcoding the length and make future changes safer.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #86 +/- ##
==========================================
+ Coverage 74.02% 74.56% +0.53%
==========================================
Files 11 11
Lines 566 578 +12
==========================================
+ Hits 419 431 +12
Misses 104 104
Partials 43 43 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
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.
Summary by Sourcery
Prefix stdout messages of file operations with operation type and update tests to assert on these prefixes using a new AssertStdout helper.
New Features:
Enhancements:
Tests: