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

Function validateScanOptions

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

Source from the content-addressed store, hash-verified

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