feat(pierre): sanity check
This commit is contained in:
@@ -46,6 +46,12 @@ type ReviewConfig struct {
|
||||
}
|
||||
|
||||
type Config struct {
|
||||
// Deprecated flags (no prefix). Retained for backward compatibility.
|
||||
// These will be mapped to the embedded ReviewConfig if provided.
|
||||
MaxChunkSize int `help:"Deprecated: use --review-max-chunk-size"`
|
||||
Guidelines []string `help:"Deprecated: use --review-guidelines" sep:","`
|
||||
DisableComments bool `help:"Deprecated: use --review-disable-comments"`
|
||||
|
||||
// Embedding ReviewConfig with a prefix changes flag names to `--review-…`.
|
||||
// Existing configuration files using the old flag names will need to be updated.
|
||||
// Consider keeping backwards compatibility if required.
|
||||
@@ -75,6 +81,17 @@ func main() {
|
||||
kong.Configuration(kongyaml.Loader, "config.yaml", defaultConfig),
|
||||
)
|
||||
|
||||
// Backwards compatibility: map deprecated flag values (if any) to the embedded ReviewConfig.
|
||||
if cfg.MaxChunkSize != 0 {
|
||||
cfg.Review.MaxChunkSize = cfg.MaxChunkSize
|
||||
}
|
||||
if len(cfg.Guidelines) > 0 {
|
||||
cfg.Review.Guidelines = cfg.Guidelines
|
||||
}
|
||||
if cfg.DisableComments {
|
||||
cfg.Review.DisableComments = cfg.DisableComments
|
||||
}
|
||||
|
||||
// Auto-detect provider
|
||||
provider := cfg.GitProvider
|
||||
if provider == "" {
|
||||
|
||||
Reference in New Issue
Block a user