Skip to content

Commit 25c0d0c

Browse files
committed
Refactor comments in stripDiffFormat function
Simplified and clarified comments in the stripDiffFormat function to improve readability and maintainability. No functional changes were made to the code.
1 parent f6b4985 commit 25c0d0c

1 file changed

Lines changed: 3 additions & 6 deletions

File tree

  • pkg/cmd/agent-task/shared

pkg/cmd/agent-task/shared/log.go

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -342,18 +342,15 @@ func stripDiffFormat(diff string) string {
342342
}
343343
}
344344

345-
// Guard clause: if we didn't find a hunk header, this isn't a diff, so
346-
// we defensively just return the original string.
345+
// This isn't a diff.
347346
if hunkEndIndex == -1 {
348347
return diff
349348
}
350349

351-
// We found the hunk header end; strip everything before it.
350+
// Removing hunk header.
352351
lines = lines[hunkEndIndex+1:]
353352

354-
// Now we strip the leading + and - from lines, if they exist.
355-
// Note: most of the time, but not all the time, we get a diff without
356-
// these prefixes.
353+
// Strip the leading + and - from lines, if they exist.
357354
var stripped []string
358355
for _, line := range lines {
359356
if strings.HasPrefix(line, "+") || strings.HasPrefix(line, "-") {

0 commit comments

Comments
 (0)