libscilo/config/instantiated_config/cfg_struct.rs
1//! This module contains the definition of the [`InstantiatedConfig`] struct.
2//! Implementations of trains and methods are found in sibling modules.
3
4use std::path::PathBuf;
5
6use regex::Regex;
7
8use crate::{LintCheck, RootDirs};
9
10/// The internal representation of all the important files, directories, and lints to check.
11///
12/// This data structure isn't created directly from a configuration file.
13/// It is instead instantiated from the [`ConfigFile`][crate::config::file::ConfigFile] struct, using some intermediate
14/// logic that can fail along the way.
15#[derive(Clone, Debug)]
16pub struct InstantiatedConfig {
17 /// Expected top-level directories to organize the project folder.
18 pub root_dirs: RootDirs,
19
20 /// Regular expression for units of analysis within the code and their matching results.
21 ///
22 /// The default value for this regular expression is [`CODE_RESULTS_SUBDIR_REGEX`][crate::config::instantiated_config::defaults::CODE_RESULTS_SUBDIR_REGEX].
23 pub code_results_subdir_regex: Option<Regex>,
24
25 /// The explicit list of lint checks that should be performed.
26 /// See [`LintCheck`] for the complete list.
27 pub lints: Vec<LintCheck>,
28
29 /// The explicit list of files that should be present at the root of the
30 /// project directory.
31 pub root_files: Vec<PathBuf>,
32
33 /// The file name for the READMEs that should be present within each
34 /// subdirectory in the [`code`][RootDirs::code] and [`data`][RootDirs::data]
35 /// directories.
36 pub readme_names: Option<Vec<String>>,
37
38 /// The file name for the workflow file that should be present within each
39 /// subdirectory in the [`code`][RootDirs::code] directory.
40 pub workflow_names: Option<Vec<String>>,
41
42 /// The set of directories that are ignored during checks.
43 pub ignored: Vec<PathBuf>,
44}