--- Validation functions ---
(from, to, commit string)
| 66 | // --- Validation functions --- |
| 67 | |
| 68 | func 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 | |
| 88 | func validateAudience(audience string) error { |
| 89 | switch audience { |
no outgoing calls
no test coverage detected