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

Function validateScanOptions

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

Source from the content-addressed store, hash-verified

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

Callers 2

parseScanFlagsFunction · 0.85
scan_cmd.goFile · 0.85

Calls 2

validateAudienceFunction · 0.85
validateOutputFormatFunction · 0.85

Tested by 1

parseScanFlagsFunction · 0.68