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

Function splitAndNormalize

internal/diff/resolver.go:220–231  ·  view source on GitHub ↗

splitAndNormalize splits code text into lines and normalizes each one.

(code string)

Source from the content-addressed store, hash-verified

218
219// splitAndNormalize splits code text into lines and normalizes each one.
220func splitAndNormalize(code string) []string {
221 raw := strings.Split(code, "\n")
222 result := make([]string, 0, len(raw))
223 for _, line := range raw {
224 n := normalizeLine(line)
225 if n == "" {
226 continue
227 }
228 result = append(result, n)
229 }
230 return result
231}
232
233// normalizeLine removes leading/trailing whitespace and strips any leading
234// '+' or '-' diff marker.

Callers 3

resolveFromHunkFunction · 0.70
resolveFromFileContentFunction · 0.70

Calls 1

normalizeLineFunction · 0.70

Tested by 1