-
Notifications
You must be signed in to change notification settings - Fork 2
feat(config): replace toml with figment for layered config #393
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Omen AnalysisDiff Risk
Risk Factors
Recommendations
Repository Health
Score Components
Tips for AI agentsUse these commands to investigate and improve low-scoring areas. Run full analysis: omen -f json score # health score with component breakdown
omen -f json diff # PR risk analysis
omen hotspot # high-churn + high-complexity filesCoupling (score: 50.56559139784946) -- needs attention omen graph && omen smellsBreak cyclic dependencies by introducing interfaces or extracting shared types. Reduce fan-out from hub modules by splitting responsibilities. Duplication (score: 41.72579188338992) -- needs attention omen clonesLook for Type-1 (exact) and Type-2 (renamed) clones. Extract shared logic into reusable functions or modules. Prioritize clones in high-churn files. General workflow for improving scores:
|
📝 WalkthroughWalkthroughReplaced direct TOML parsing with Figment-based configuration loading across the project. Expanded Config struct with new fields and updated loading methods to support environment variable overrides (OMEN_ prefix). Simplified error handling by removing TOML-specific error variant. Changes
Important Pre-merge checks failedPlease resolve all errors before merging. Addressing warnings is optional. ❌ Failed checks (1 error)
✅ Passed checks (3 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
No actionable comments were generated in the recent review. 🎉 Comment |
Replace manual TOML loading with figment's layered config system: defaults -> optional file -> env vars. Missing config files are now silently skipped instead of requiring explicit existence checks. - Add figment dependency with toml and env features - Rewrite Config::from_file and Config::load_default using Figment - Support OMEN_ prefixed env vars with __ nesting separator - Remove Config::config_exists (no longer needed) - Remove Toml error variant from Error enum - Remove score command early-return workaround - Migrate config tests to figment::Jail for env var isolation
37994c3 to
4a3cfe6
Compare
Summary
tomlcrate withfigmentfor layered configuration: defaults -> optional TOML file -> env varsOMEN_prefixed env vars (use__for nesting, e.g.OMEN_COMPLEXITY__CYCLOMATIC_WARN=5)from_file()still errors on missing files (for explicit--configflag)Config::config_exists()andError::Tomlvariant (no longer needed)Test plan
figment::Jailfor env var isolation)cargo test)cargo clippy --all-targets --all-features -- -D warnings)omen -p /tmp scoreruns with defaults (no config file, no error)OMEN_COMPLEXITY__CYCLOMATIC_WARN=5 omen complexityrespects env varomen -c nonexistent.toml scoreerrors with "not found"Summary by CodeRabbit
Release Notes
OMEN_prefix.