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

Function splitAndNormalize

internal/diff/resolver.go:299–310  ·  view source on GitHub ↗

splitAndNormalize splits code text into lines and normalizes each one.

(code string)

Source from the content-addressed store, hash-verified

297
298// splitAndNormalize splits code text into lines and normalizes each one.
299func splitAndNormalize(code string) []string {
300 raw := strings.Split(code, "\n")
301 result := make([]string, 0, len(raw))
302 for _, line := range raw {
303 n := normalizeLine(line)
304 if n == "" {
305 continue
306 }
307 result = append(result, n)
308 }
309 return result
310}
311
312// normalizeLine removes leading/trailing whitespace and strips any leading
313// '+' or '-' diff marker.

Callers 3

resolveFromHunkFunction · 0.70
resolveFromFileContentFunction · 0.70

Calls 1

normalizeLineFunction · 0.70

Tested by 1