stern4rust/settings/config.rs
1// Copyright 2025 Umberto Gotti <umberto.gotti@umbertogotti.dev>
2// Licensed under the MIT License
3// SPDX-License-Identifier: MIT
4
5use crate::reporting::offence_threshold::OffenceThreshold;
6use crate::reporting::output_format::OutputFormat;
7use crate::settings::rule_selection::RuleSelection;
8use std::path::PathBuf;
9
10// The threshold is an OffenceThreshold rather than a bare usize precisely so
11// this can stay derived. A usize field would default to zero, which this tool
12// reads as "no limit" -- the opposite of the CLI default, and a mismatch that
13// would only surface on a codebase big enough to need the cap.
14//
15// The directory limits are Options for the same reason and the opposite danger:
16// a bare usize defaulting to zero would mean "no files may exist", turning
17// every directory in an unconfigured run into an offence. None means "not
18// configured", and each rule supplies its own default.
19#[derive(Debug, Clone, Default, PartialEq, Eq)]
20pub struct Config {
21 pub baseline: Option<PathBuf>,
22 pub config_file: Option<PathBuf>,
23 pub fix: bool,
24 pub write_baseline: bool,
25 pub manifest_path: Option<PathBuf>,
26 pub max_files_per_directory: Option<usize>,
27 pub max_subfolders_per_directory: Option<usize>,
28 pub packages: Vec<String>,
29 pub excludes: Vec<String>,
30 pub expected_header: Vec<String>,
31 pub format: OutputFormat,
32 pub offence_threshold: OffenceThreshold,
33 pub selection: RuleSelection,
34}