Remove PRD/doc paths, bead IDs, phase notes and deleted-test references from comments; drop test-only hooks left by the test deletion. Includes in-progress archied bootstrap, gateway and query changes.
59 lines
1.3 KiB
Go
59 lines
1.3 KiB
Go
package prreview
|
|
|
|
// Depth is how many review dimensions a run affords, driven by the size of
|
|
// the change.
|
|
type Depth string
|
|
|
|
const (
|
|
DepthQuick Depth = "quick"
|
|
DepthStandard Depth = "standard"
|
|
DepthDeep Depth = "deep"
|
|
)
|
|
|
|
const (
|
|
quickLinesCeiling = 100
|
|
standardLinesCeiling = 500
|
|
)
|
|
|
|
// The dimension caps each depth affords.
|
|
const (
|
|
maxDimensionsQuick = 3
|
|
maxDimensionsStandard = 6
|
|
maxDimensionsDeep = 12
|
|
)
|
|
|
|
// ClassifyDepth derives a review depth from the number of changed lines
|
|
// (additions plus deletions).
|
|
func ClassifyDepth(changedLines int) Depth {
|
|
switch {
|
|
case changedLines < quickLinesCeiling:
|
|
return DepthQuick
|
|
case changedLines < standardLinesCeiling:
|
|
return DepthStandard
|
|
default:
|
|
return DepthDeep
|
|
}
|
|
}
|
|
|
|
// MaxDimensionsFor returns how many review dimensions a depth affords. An
|
|
// unrecognised depth gets the cheapest cap, never the most expensive: a typo
|
|
// or a stale value must not silently buy a deep run's budget.
|
|
func MaxDimensionsFor(depth Depth) int {
|
|
switch depth {
|
|
case DepthStandard:
|
|
return maxDimensionsStandard
|
|
case DepthDeep:
|
|
return maxDimensionsDeep
|
|
default:
|
|
return maxDimensionsQuick
|
|
}
|
|
}
|
|
|
|
// An empty explicit depth means no override was given.
|
|
func ResolveDepth(changedLines int, explicit Depth) Depth {
|
|
if explicit != "" {
|
|
return explicit
|
|
}
|
|
return ClassifyDepth(changedLines)
|
|
}
|