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

Function splitAndNormalize

internal/diff/resolver.go:217–228  ·  view source on GitHub ↗

splitAndNormalize splits code text into lines and normalizes each one.

(code string)

Source from the content-addressed store, hash-verified

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

Callers 3

resolveFromHunkFunction · 0.70
resolveFromFileContentFunction · 0.70

Calls 1

normalizeLineFunction · 0.70

Tested by 1