libscilo/lints/
error.rs

1//! Errors resulting from lint checks that have failed.
2
3use std::path::PathBuf;
4use thiserror::Error;
5
6/// Errors resulting from lint checks that have failed.
7#[derive(Debug, Error)]
8pub enum LintError {
9    /// There exists a subdirectory within the [`code`][crate::RootDirs::code]
10    /// or [`results`][crate::RootDirs::results] directories that does
11    /// not match the naming format required by [`code_results_subdir_regex`][crate::InstantiatedConfig::code_results_subdir_regex].
12    #[error("`{0}` does not match the regular expression `{1}` required for code and results directories. Consider changing this directory name or the `code_results_dir_regex` option in your configuration.")]
13    CodeResultsSubdirectoryRegexMismatch(PathBuf, String),
14
15    /// One of the required directories at the project root is not found.
16    #[error("The required directory `{0}` does not exist. Consider creating this directory or modifying the top-level directories in your configuration.")]
17    RequiredDirectoryDoesNotExist(PathBuf),
18
19    /// One of the required files at the project root is not found.
20    #[error("The required file `{0}` does not exist. Consider creating this file or modifying the required files in your configuration.")]
21    RequiredFileDoesNotExist(PathBuf),
22
23    /// Some subdirectory of [`code`][crate::RootDirs::code] does not
24    /// have a corresponding directory within [`results`][crate::RootDirs::results].
25    #[error("Code subdirectory `{code}` does not have a corresponding subdirectory in the results directory. Consider creating `{results}`.")]
26    CodeSubdirectoryMissingInResults { code: PathBuf, results: PathBuf },
27
28    /// Some subdirectory of [`results`][crate::RootDirs::results] does not
29    /// have a corresponding directory within [`code`][crate::RootDirs::code].
30    #[error("Results subdirectory `{results}` does not have a corresponding subdirectory in the code directory. Consider creating `{code}`.")]
31    ResultsSubdirectoryMissingInCode { code: PathBuf, results: PathBuf },
32
33    /// A README file is not found within a subdirectory of a [root directory][crate::RootDirs].
34    #[error("The directory `{0}` does not contain a README. Consider creating a README file or changing the `readme_names` option in your configuration.")]
35    SubdirectoryMissingReadme(PathBuf),
36
37    /// A workflow file is not found within a [`code`][crate::RootDirs::code] subdirectory.
38    #[error("The directory `{0}` does not contain a workflow. Consider creating a workflow file or changing the `workflow_names` option in your configuration.")]
39    SubdirectoryMissingWorkflow(PathBuf),
40}