--- Validation functions ---
(from, to, commit string)
| 74 | // --- Validation functions --- |
| 75 | |
| 76 | func 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 | |
| 96 | func validateAudience(audience string) error { |
| 97 | switch audience { |
no outgoing calls
no test coverage detected