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

Function validateDiffMode

cmd/opencodereview/shared_flags.go:76–94  ·  view source on GitHub ↗

--- Validation functions ---

(from, to, commit string)

Source from the content-addressed store, hash-verified

74// --- Validation functions ---
75
76func validateDiffMode(from, to, commit string) error {
77 modeCount := 0
78 if from != "" || to != "" {
79 modeCount++
80 }
81 if commit != "" {
82 modeCount++
83 }
84 if modeCount > 1 {
85 return fmt.Errorf("only one review mode allowed (--from/--to or --commit)")
86 }
87 if from != "" && to == "" {
88 return fmt.Errorf("--to is required when --from is specified")
89 }
90 if to != "" && from == "" {
91 return fmt.Errorf("--from is required when --to is specified")
92 }
93 return nil
94}
95
96func validateAudience(audience string) error {
97 switch audience {

Callers 2

validateReviewOptionsFunction · 0.85
validateDelegateOptionsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected