Skip to main content

crate_cli/fmt/driver/
struct.rs

1use super::*;
2
3/// Structured summary returned by unified workspace text formatting.
4#[derive(Clone, Data, Debug, Default, Eq, New, PartialEq)]
5pub struct UnifiedFmtReport {
6    /// Total number of supported text files scanned.
7    #[get(type(copy))]
8    #[set(pub(crate))]
9    #[get_mut(skip)]
10    pub(crate) files_scanned: usize,
11    /// Number of files modified (or needing modification in `--check` mode).
12    #[get(type(copy))]
13    #[set(pub(crate))]
14    #[get_mut(skip)]
15    pub(crate) files_formatted: usize,
16    /// Whether formatting ran in check-only mode.
17    #[get(type(copy))]
18    #[set(pub(crate))]
19    #[get_mut(skip)]
20    pub(crate) check_mode: bool,
21    /// Relative or display paths of files that were changed or failed `--check`.
22    #[set(pub(crate))]
23    #[get_mut(pub(crate))]
24    pub(crate) changed_files: Vec<String>,
25}
26
27/// Single parsed rule from a workspace-root `.prettierignore` file.
28#[derive(Clone, Debug, Eq, Getter, New, PartialEq)]
29pub(crate) struct PrettierIgnoreRule {
30    /// Raw normalized glob pattern (with leading `!`/`/` and trailing `/` stripped).
31    #[get(pub(crate))]
32    pub(crate) pattern: String,
33    /// Whether this rule negates (`!`) an earlier ignore match.
34    #[get(pub(crate), type(copy))]
35    pub(crate) negated: bool,
36    /// Whether this rule applies only to directories (trailing `/`).
37    #[get(pub(crate), type(copy))]
38    pub(crate) dir_only: bool,
39    /// Whether this rule matches against the full relative path rather than a single segment.
40    #[get(pub(crate), type(copy))]
41    pub(crate) anchored: bool,
42}