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

Function validateDiffMode

cmd/opencodereview/shared_flags.go:68–86  ·  view source on GitHub ↗

--- Validation functions ---

(from, to, commit string)

Source from the content-addressed store, hash-verified

66// --- Validation functions ---
67
68func validateDiffMode(from, to, commit string) error {
69 modeCount := 0
70 if from != "" || to != "" {
71 modeCount++
72 }
73 if commit != "" {
74 modeCount++
75 }
76 if modeCount > 1 {
77 return fmt.Errorf("only one review mode allowed (--from/--to or --commit)")
78 }
79 if from != "" && to == "" {
80 return fmt.Errorf("--to is required when --from is specified")
81 }
82 if to != "" && from == "" {
83 return fmt.Errorf("--from is required when --to is specified")
84 }
85 return nil
86}
87
88func validateAudience(audience string) error {
89 switch audience {

Callers 2

validateReviewOptionsFunction · 0.85
validateDelegateOptionsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected