ValidatorOptionsFromConfig creates ValidatorOptions from config and CLI flags
(cfg *config.Config, flagsChanged map[string]bool, flags ValidatorFlags)
| 392 | |
| 393 | // ValidatorOptionsFromConfig creates ValidatorOptions from config and CLI flags |
| 394 | func ValidatorOptionsFromConfig(cfg *config.Config, flagsChanged map[string]bool, flags ValidatorFlags) ValidatorOptions { |
| 395 | opts := ValidatorOptions{ |
| 396 | Recursive: cfg.Validation.Recursive, |
| 397 | Pattern: cfg.Validation.Pattern, |
| 398 | Dialect: cfg.Validation.Dialect, |
| 399 | StrictMode: cfg.Validation.StrictMode, |
| 400 | Verbose: cfg.Output.Verbose, |
| 401 | } |
| 402 | |
| 403 | // Override with CLI flags if explicitly set |
| 404 | if flagsChanged["recursive"] { |
| 405 | opts.Recursive = flags.Recursive |
| 406 | } |
| 407 | if flagsChanged["pattern"] { |
| 408 | opts.Pattern = flags.Pattern |
| 409 | } |
| 410 | // Always use quiet flag value (may be set programmatically for SARIF output) |
| 411 | if flagsChanged["quiet"] || flags.Quiet { |
| 412 | opts.Quiet = flags.Quiet |
| 413 | } |
| 414 | if flagsChanged["stats"] { |
| 415 | opts.ShowStats = flags.ShowStats |
| 416 | } |
| 417 | if flagsChanged["dialect"] { |
| 418 | opts.Dialect = flags.Dialect |
| 419 | } |
| 420 | if flagsChanged["strict"] { |
| 421 | opts.StrictMode = flags.StrictMode |
| 422 | } |
| 423 | if flagsChanged["verbose"] { |
| 424 | opts.Verbose = flags.Verbose |
| 425 | } |
| 426 | |
| 427 | return opts |
| 428 | } |
no outgoing calls
no test coverage detected