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

Function validateDiffMode

cmd/opencodereview/shared_flags.go:83–101  ·  view source on GitHub ↗

--- Validation functions ---

(from, to, commit string)

Source from the content-addressed store, hash-verified

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

Callers 2

validateReviewOptionsFunction · 0.85
validateDelegateOptionsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected