fallow_engine/health/
pipeline.rs1use std::path::PathBuf;
4
5use fallow_config::ResolvedConfig;
6use fallow_output::DiffIndex;
7use fallow_types::workspace::WorkspaceDiagnostic;
8use rustc_hash::{FxHashMap, FxHashSet};
9
10pub struct HealthPipelineInputs {
12 pub config: ResolvedConfig,
13 pub files: Vec<fallow_types::discover::DiscoveredFile>,
14 pub modules: Vec<fallow_types::extract::ModuleInfo>,
15 pub config_ms: f64,
17 pub discover_ms: f64,
18 pub parse_ms: f64,
19 pub parse_cpu_ms: f64,
20 pub shared_parse: bool,
22 pub pre_computed_analysis: Option<crate::DeadCodeAnalysisArtifacts>,
23 pub workspace_diagnostics: Vec<WorkspaceDiagnostic>,
24}
25
26pub struct HealthScopeInputs<'a, R> {
33 pub changed_files: Option<FxHashSet<PathBuf>>,
34 pub diff_index: Option<&'a DiffIndex>,
35 pub ws_roots: Option<Vec<PathBuf>>,
36 pub group_resolver: Option<R>,
37}
38
39pub(super) struct HealthPipelineTimings {
40 pub(super) config: f64,
41 pub(super) discover: f64,
42 pub(super) parse: f64,
43 pub(super) parse_cpu: f64,
45 pub(super) shared_parse: bool,
47}
48
49impl HealthPipelineTimings {
50 pub(super) fn into_base_input(self, complexity_ms: f64) -> HealthTimingBaseInput {
51 HealthTimingBaseInput {
52 config_ms: self.config,
53 discover_ms: self.discover,
54 parse_ms: self.parse,
55 parse_cpu_ms: self.parse_cpu,
56 complexity_ms,
57 shared_parse: self.shared_parse,
58 }
59 }
60}
61
62pub(super) struct HealthScope<'a, R> {
63 pub(super) max_cyclomatic: u16,
64 pub(super) max_cognitive: u16,
65 pub(super) max_crap: f64,
66 pub(super) enforce_crap: bool,
67 pub(super) ignore_set: globset::GlobSet,
68 pub(super) changed_files: Option<FxHashSet<PathBuf>>,
69 pub(super) diff_index: Option<&'a DiffIndex>,
70 pub(super) ws_roots: Option<Vec<PathBuf>>,
71 pub(super) group_resolver: Option<R>,
72 pub(super) file_paths: FxHashMap<crate::discover::FileId, &'a PathBuf>,
73}
74
75pub(super) struct HealthTimingBaseInput {
76 pub(super) config_ms: f64,
77 pub(super) discover_ms: f64,
78 pub(super) parse_ms: f64,
79 pub(super) parse_cpu_ms: f64,
80 pub(super) complexity_ms: f64,
81 pub(super) shared_parse: bool,
82}