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

Function validateAnalysisOptions

cmd/opencodereview/analysis.go:25–43  ·  view source on GitHub ↗
(opts reviewOptions)

Source from the content-addressed store, hash-verified

23)
24
25func validateAnalysisOptions(opts reviewOptions) error {
26 if opts.analysisMaxTokensBudget < 0 {
27 return fmt.Errorf("--analysis-max-tokens-budget must be a non-negative integer (0 means unlimited)")
28 }
29 if !opts.analysis {
30 return nil
31 }
32 if opts.resume != "" || opts.preview {
33 return fmt.Errorf("--analysis cannot be combined with --resume or --preview")
34 }
35 if reviewModeFromOptions(opts) == session.ReviewModeWorkspace {
36 return fmt.Errorf("--analysis is not available in workspace mode; omit --analysis to review uncommitted changes, or use --commit <sha> or --from <base> [--to <head>] to analyze committed changes")
37 }
38 format := strings.ToLower(strings.TrimSpace(opts.outputFormat))
39 if format != "text" && format != "json" {
40 return fmt.Errorf("--analysis supports only --format text or json")
41 }
42 return nil
43}
44
45type analysisRequest struct {
46 input behaviortask.Input

Callers 1

validateReviewOptionsFunction · 0.85

Calls 1

reviewModeFromOptionsFunction · 0.85

Tested by

no test coverage detected