Skip to content

Conversation

@panbanda
Copy link
Owner

@panbanda panbanda commented Feb 10, 2026

Summary

  • Replace toml crate with figment for layered configuration: defaults -> optional TOML file -> env vars
  • Missing config files are silently skipped (no more early-return workarounds needed)
  • Users can override any config value via OMEN_ prefixed env vars (use __ for nesting, e.g. OMEN_COMPLEXITY__CYCLOMATIC_WARN=5)
  • from_file() still errors on missing files (for explicit --config flag)
  • Remove Config::config_exists() and Error::Toml variant (no longer needed)

Test plan

  • All existing config tests pass (migrated to figment::Jail for env var isolation)
  • New tests: env var overrides file values, env var overrides defaults, from_file errors on missing file
  • Full test suite passes (cargo test)
  • Clippy clean (cargo clippy --all-targets --all-features -- -D warnings)
  • CI passes
  • Manual: omen -p /tmp score runs with defaults (no config file, no error)
  • Manual: OMEN_COMPLEXITY__CYCLOMATIC_WARN=5 omen complexity respects env var
  • Manual: omen -c nonexistent.toml score errors with "not found"

Summary by CodeRabbit

Release Notes

  • Configuration
    • Configuration can now be overridden via environment variables using the OMEN_ prefix.
    • Expanded configuration options including satd, churn, duplicates, hotspot, score, feature_flags, temporal, output, and exclude_built_assets.
    • Configuration file validation now enforced for specified file paths.

@github-actions
Copy link
Contributor

github-actions bot commented Feb 10, 2026

Omen Analysis

Diff Risk

Risk Score 38%
Risk Level MEDIUM
Files Modified 4
Lines Added +234
Lines Deleted -111
Commits 2
Risk Factors
Factor Score
file_churn 0.1
lines_added 0.0936
entropy 0.0515
lines_deleted 0.0444
num_files 0.0213
commits 0.0140
file_complexity 0.0061
ownership_diffusion 0.0029
Recommendations
  • Touches historically volatile files - changes here often introduce bugs

Repository Health

Health Score 77.26451153340304 / 100
Grade C
Files Analyzed 93
Critical Issues 1
Score Components
Component Score Weight
complexity 92 1
duplication 41.7 0.8
cohesion 94.2 0.6
tdg 84 0.6
coupling 50.6 0.4
satd 91.4 0.4
smells 100 0.2
Tips for AI agents

Use 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 files

Coupling (score: 50.56559139784946) -- needs attention

omen graph && omen smells

Break 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 clones

Look 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:

  1. Run the relevant analyzer command to identify specific files
  2. Focus on the highest-weight components first (complexity 25%, duplication 20%, cohesion 15%, TDG 15%)
  3. Make targeted improvements -- small refactors that reduce complexity or eliminate duplication
  4. Re-run omen score to verify improvement

@coderabbitai
Copy link

coderabbitai bot commented Feb 10, 2026

📝 Walkthrough

Walkthrough

Replaced 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

Cohort / File(s) Summary
Configuration Loading Refactor
src/config/mod.rs
Migrated to Figment for config merging (defaults → TOML → environment). Added from_file(), load_default(), and alias methods. Expanded Config with 10 new fields. Changed exclude_patterns from alias to rename. Replaced TempDir tests with Jail-based tests.
Dependency Updates
Cargo.toml
Replaced toml dependency with figment (0.10) including toml and env features. Added figment dev-dependency with test feature.
Error Simplification
src/core/error.rs
Removed Toml error variant from Error enum. Figment handles TOML deserialization errors internally.

Important

Pre-merge checks failed

Please resolve all errors before merging. Addressing warnings is optional.

❌ Failed checks (1 error)
Check name Status Explanation Resolution
Pr Test Coverage & Quality Check ❌ Error PR objectives claim Config::config_exists(dir) method with 3 unit tests, but method does not exist in codebase. Implement Config::config_exists(dir) method and add 3 unit tests, or update PR description to match actual implementation.
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed Title accurately describes the main change: replacing toml with figment for layered configuration loading across the codebase.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/score-warn-no-config

No actionable comments were generated in the recent review. 🎉


Comment @coderabbitai help to get the list of available commands and usage tips.

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
@panbanda panbanda force-pushed the feat/score-warn-no-config branch from 37994c3 to 4a3cfe6 Compare February 10, 2026 16:12
@panbanda panbanda changed the title feat(score): warn and return early when no config file found feat(config): replace toml with figment for layered config Feb 10, 2026
@panbanda panbanda merged commit 600e8f9 into main Feb 10, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant