pub struct Config {
pub engines: EngineConfig,
pub rules: HashMap<String, RuleConfig>,
pub exclude: Vec<String>,
pub auto_fix: Vec<AutoFixRule>,
pub performance: PerformanceConfig,
pub dictionaries: DictionaryConfig,
pub languages: LanguageConfig,
pub workspace: WorkspaceConfig,
pub names: NameConfig,
pub morphology: MorphologyConfig,
}Fields§
§engines: EngineConfig§rules: HashMap<String, RuleConfig>§exclude: Vec<String>§auto_fix: Vec<AutoFixRule>§performance: PerformanceConfig§dictionaries: DictionaryConfig§languages: LanguageConfig§workspace: WorkspaceConfig§names: NameConfig§morphology: MorphologyConfigImplementations§
Source§impl Config
impl Config
Sourcepub fn load_or_warn(workspace_root: &Path) -> Self
pub fn load_or_warn(workspace_root: &Path) -> Self
Load configuration, warning and falling back to defaults if it cannot be read.
load fails on a malformed .languagecheck.yaml — a bad indent, a typo’d enum — and
callers used to answer that with a bare Config::default(), so a rejected file was
indistinguishable from an absent one and the user’s overrides silently did nothing.
A missing file is not an error and is not reported; an unreadable one is.
Callers with no tracing subscriber installed (the CLI binary) must report to stderr
themselves rather than call this, or the warning goes nowhere.
Sourcepub fn excludes(&self, path: &Path, workspace_root: &Path) -> bool
pub fn excludes(&self, path: &Path, workspace_root: &Path) -> bool
Whether exclude covers this path.
path may be absolute or already relative to workspace_root; it is
reduced to the workspace-relative form the patterns are written
against, because node_modules/** is how a user thinks about it and
an absolute path would never match.
An unparseable pattern excludes nothing. Refusing to check a file because a glob had a typo is the worse of the two failures.
pub fn load(workspace_root: &Path) -> Result<Self>
Sourcepub fn apply_auto_fixes(&self, text: &str) -> (String, usize)
pub fn apply_auto_fixes(&self, text: &str) -> (String, usize)
Apply user-defined auto-fix rules to the given text, returning the modified text and the number of replacements made.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Config
impl<'de> Deserialize<'de> for Config
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Auto Trait Implementations§
impl Freeze for Config
impl RefUnwindSafe for Config
impl Send for Config
impl Sync for Config
impl Unpin for Config
impl UnsafeUnpin for Config
impl UnwindSafe for Config
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> GetSetFdFlags for T
impl<T> GetSetFdFlags for T
Source§fn get_fd_flags(&self) -> Result<FdFlags, Error>where
T: AsFilelike,
fn get_fd_flags(&self) -> Result<FdFlags, Error>where
T: AsFilelike,
self file descriptor.Source§fn new_set_fd_flags(&self, fd_flags: FdFlags) -> Result<SetFdFlags<T>, Error>where
T: AsFilelike,
fn new_set_fd_flags(&self, fd_flags: FdFlags) -> Result<SetFdFlags<T>, Error>where
T: AsFilelike,
Source§fn set_fd_flags(&mut self, set_fd_flags: SetFdFlags<T>) -> Result<(), Error>where
T: Sized + AsFilelike,
fn set_fd_flags(&mut self, set_fd_flags: SetFdFlags<T>) -> Result<(), Error>where
T: Sized + AsFilelike,
self file descriptor. Read moreSource§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more