--- Validation functions ---
(from, to, commit string)
| 81 | // --- Validation functions --- |
| 82 | |
| 83 | func 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 | |
| 103 | func validateAudience(audience string) error { |
| 104 | switch audience { |
no outgoing calls
no test coverage detected