MCPcopy
hub / github.com/harness/harness / mapCodeOwnerEvaluation

Function mapCodeOwnerEvaluation

app/api/controller/pullreq/codeowner.go:60–87  ·  view source on GitHub ↗
(ownerEvaluation *codeowners.Evaluation)

Source from the content-addressed store, hash-verified

58}
59
60func mapCodeOwnerEvaluation(ownerEvaluation *codeowners.Evaluation) []types.CodeOwnerEvaluationEntry {
61 codeOwnerEvaluationEntries := make([]types.CodeOwnerEvaluationEntry, len(ownerEvaluation.EvaluationEntries))
62 for i, entry := range ownerEvaluation.EvaluationEntries {
63 ownerEvaluations := make([]types.OwnerEvaluation, len(entry.OwnerEvaluations))
64 userGroupOwnerEvaluations := make([]types.UserGroupOwnerEvaluation, len(entry.UserGroupOwnerEvaluations))
65 for j, owner := range entry.OwnerEvaluations {
66 ownerEvaluations[j] = mapOwner(owner)
67 }
68 for j, userGroupOwnerEvaluation := range entry.UserGroupOwnerEvaluations {
69 userGroupEvaluations := make([]types.OwnerEvaluation, len(userGroupOwnerEvaluation.Evaluations))
70 for k, userGroupOwner := range userGroupOwnerEvaluation.Evaluations {
71 userGroupEvaluations[k] = mapOwner(userGroupOwner)
72 }
73 userGroupOwnerEvaluations[j] = types.UserGroupOwnerEvaluation{
74 ID: userGroupOwnerEvaluation.Identifier,
75 Name: userGroupOwnerEvaluation.Name,
76 Evaluations: userGroupEvaluations,
77 }
78 }
79 codeOwnerEvaluationEntries[i] = types.CodeOwnerEvaluationEntry{
80 LineNumber: entry.LineNumber,
81 Pattern: entry.Pattern,
82 OwnerEvaluations: ownerEvaluations,
83 UserGroupOwnerEvaluations: userGroupOwnerEvaluations,
84 }
85 }
86 return codeOwnerEvaluationEntries
87}
88
89func mapOwner(owner codeowners.OwnerEvaluation) types.OwnerEvaluation {
90 return types.OwnerEvaluation{

Callers 1

CodeOwnersMethod · 0.85

Calls 1

mapOwnerFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…