MCPcopy Create free account
hub / github.com/alibaba/open-code-review / splitAndNormalize

Function splitAndNormalize

internal/diff/resolver.go:286–297  ·  view source on GitHub ↗

splitAndNormalize splits code text into lines and normalizes each one.

(code string)

Source from the content-addressed store, hash-verified

284
285// splitAndNormalize splits code text into lines and normalizes each one.
286func splitAndNormalize(code string) []string {
287 raw := strings.Split(code, "\n")
288 result := make([]string, 0, len(raw))
289 for _, line := range raw {
290 n := normalizeLine(line)
291 if n == "" {
292 continue
293 }
294 result = append(result, n)
295 }
296 return result
297}
298
299// normalizeLine removes leading/trailing whitespace and strips any leading
300// '+' or '-' diff marker.

Callers 3

resolveFromHunkFunction · 0.70
resolveFromFileContentFunction · 0.70

Calls 1

normalizeLineFunction · 0.70

Tested by 1