1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
//! Quality-gates: parse `.codelore-thresholds.toml` at the repo root
//! and evaluate a fact store against the declared gates. Used by
//! `codelore check` to power CI quality-gate enforcement.
//!
//! ## Config schema
//!
//! ```toml
//! [gates]
//! cognitive_max = 30 # any file exceeding fails
//! code_health_min = 60 # any file below fails (composite code-health score, 0..=100)
//! hotspot_score_max = 8.0 # any file above fails
//! disallow_clone_type_1 = true
//! max_dependency_cycles = 0 # no import-graph cycles allowed
//! max_propagation_cost = 0.15 # change-reach ceiling (0..1)
//! max_red_effort_pct = 30.0 # red-band churn ceiling (%, [0, 100])
//!
//! [diff]
//! delta_code_health_min = -5 # health may drop at most 5 pts in a PR
//! new_hotspot_max = 0 # zero new hotspots allowed
//! no_new_cycles = true # a PR may not introduce a dependency cycle
//! delta_code_health_min_per_file = 0.0 # gate-only: no changed file may lower its own health
//! new_file_health_min = 50.0 # gate-only: added files must clear this floor
//!
//! [calibration]
//! defect_artifact = "defects.calib.json" # repo-declared --defect-calibration default
//! ```
//!
//! ## Why thresholds-in-repo vs CLI flags
//!
//! Thresholds live with the *codebase*, not the *invocation*. That
//! means the gate is the same whether a contributor's pre-push hook,
//! GitHub Actions, an IDE plugin, or a release pipeline runs the
//! check. Per the [`feedback_modernize_dont_migrate`](../../../.claude/memory/feedback_modernize_dont_migrate.md)
//! memory: thresholds files predate `CodeLore` (`CodeMaat` reads CSV
//! rules); ours integrates with `--group-file`, `--mailmap`, and the
//! existing convention-naming pattern — same data, deeper DX.
pub use ;
pub use ;