pub struct LintGroup {
pub config: LintGroupConfig,
/* private fields */
}
Expand description
A struct for collecting the output of a number of individual Linters.
Each child can be toggled via the public, mutable Self::config
object.
Fields§
§config: LintGroupConfig
Implementations§
Source§impl LintGroup
impl LintGroup
pub fn empty() -> Self
Sourcepub fn contains_key(&self, name: impl AsRef<str>) -> bool
pub fn contains_key(&self, name: impl AsRef<str>) -> bool
Check if the group already contains a linter with a given name.
Sourcepub fn add(
&mut self,
name: impl AsRef<str>,
linter: impl Linter + 'static,
) -> bool
pub fn add( &mut self, name: impl AsRef<str>, linter: impl Linter + 'static, ) -> bool
Add a Linter
to the group, returning whether the operation was successful.
If it returns false
, it is because a linter with that key already existed in the group.
Sourcepub fn add_expr_linter(
&mut self,
name: impl AsRef<str>,
linter: impl ExprLinter + 'static,
) -> bool
pub fn add_expr_linter( &mut self, name: impl AsRef<str>, linter: impl ExprLinter + 'static, ) -> bool
Add a ExprLinter
to the group, returning whether the operation was successful.
If it returns false
, it is because a linter with that key already existed in the group.
This function is not significantly different from Self::add
, but allows us to take
advantage of some properties of ExprLinter
s for cache optimization.
Sourcepub fn merge_from(&mut self, other: &mut LintGroup)
pub fn merge_from(&mut self, other: &mut LintGroup)
Merge the contents of another LintGroup
into this one.
The other lint group will be left empty after this operation.
pub fn iter_keys(&self) -> impl Iterator<Item = &str>
Sourcepub fn set_all_rules_to(&mut self, enabled: Option<bool>)
pub fn set_all_rules_to(&mut self, enabled: Option<bool>)
Set all contained rules to a specific value.
Passing None
will unset that rule, allowing it to assume its default state.
Sourcepub fn all_descriptions(&self) -> HashMap<&str, &str>
pub fn all_descriptions(&self) -> HashMap<&str, &str>
Get map from each contained linter’s name to its associated description.
Sourcepub fn all_descriptions_html(&self) -> HashMap<&str, String>
pub fn all_descriptions_html(&self) -> HashMap<&str, String>
Get map from each contained linter’s name to its associated description, rendered to HTML.
Sourcepub fn with_lint_config(self, config: LintGroupConfig) -> Self
pub fn with_lint_config(self, config: LintGroupConfig) -> Self
Swap out Self::config
with another LintGroupConfig
.
pub fn new_curated( dictionary: Arc<impl Dictionary + 'static>, dialect: Dialect, ) -> Self
Sourcepub fn new_curated_empty_config(
dictionary: Arc<impl Dictionary + 'static>,
dialect: Dialect,
) -> Self
pub fn new_curated_empty_config( dictionary: Arc<impl Dictionary + 'static>, dialect: Dialect, ) -> Self
Create a new curated group with all config values cleared out.
pub fn organized_lints( &mut self, document: &Document, ) -> BTreeMap<String, Vec<Lint>>
Trait Implementations§
Source§impl Linter for LintGroup
impl Linter for LintGroup
Source§fn lint(&mut self, document: &Document) -> Vec<Lint>
fn lint(&mut self, document: &Document) -> Vec<Lint>
Lint
s.
We pass self
mutably for caching purposes.Source§fn description(&self) -> &str
fn description(&self) -> &str
Auto Trait Implementations§
impl Freeze for LintGroup
impl !RefUnwindSafe for LintGroup
impl !Send for LintGroup
impl !Sync for LintGroup
impl Unpin for LintGroup
impl !UnwindSafe for LintGroup
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<L> HtmlDescriptionLinter for L
impl<L> HtmlDescriptionLinter for L
fn description_html(&self) -> String
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