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

Function validateScanOptions

cmd/opencodereview/shared_flags.go:170–195  ·  view source on GitHub ↗
(opts *scanOptions)

Source from the content-addressed store, hash-verified

168}
169
170func validateScanOptions(opts *scanOptions) error {
171 if err := validateAudience(opts.audience); err != nil {
172 return err
173 }
174 normalizedFormat, err := validateOutputFormat(opts.outputFormat)
175 if err != nil {
176 return err
177 }
178 opts.outputFormat = normalizedFormat
179 if opts.maxTools < 0 {
180 return fmt.Errorf("--max-tools must be a non-negative integer (0 means use template default)")
181 }
182 if opts.maxGitProcs < 0 {
183 return fmt.Errorf("--max-git-procs must be a non-negative integer (0 means use default 16)")
184 }
185 if opts.maxTokens < 0 {
186 return fmt.Errorf("--max-tokens must be a non-negative integer (0 means use configured or template default)")
187 }
188 if opts.preview && opts.resume != "" {
189 return fmt.Errorf("--preview and --resume cannot be used together")
190 }
191 if opts.maxTokensBudget < 0 {
192 return fmt.Errorf("--max-tokens-budget must be a non-negative integer (0 means unlimited)")
193 }
194 return nil
195}
196
197func validateDelegateOptions(opts *delegateOptions) error {
198 opts.to = normalizeDiffTarget(opts.from, opts.to, opts.commit)

Callers 2

parseScanFlagsFunction · 0.85
scan_cmd.goFile · 0.85

Calls 2

validateAudienceFunction · 0.85
validateOutputFormatFunction · 0.85

Tested by 1

parseScanFlagsFunction · 0.68