pub trait Rule:
DynClone
+ Send
+ Sync {
Show 13 methods
// Required methods
fn name(&self) -> &'static str;
fn description(&self) -> &'static str;
fn check(&self, ctx: &LintContext<'_>) -> LintResult;
fn fix(&self, ctx: &LintContext<'_>) -> Result<String, LintError>;
fn as_any(&self) -> &dyn Any;
// Provided methods
fn check_with_ast(
&self,
ctx: &LintContext<'_>,
_ast: &MarkdownAst,
) -> LintResult { ... }
fn should_skip(&self, _ctx: &LintContext<'_>) -> bool { ... }
fn category(&self) -> RuleCategory { ... }
fn as_maybe_ast(&self) -> Option<&dyn MaybeAst> { ... }
fn default_config_section(&self) -> Option<(String, Value)> { ... }
fn config_aliases(&self) -> Option<HashMap<String, String>> { ... }
fn fix_capability(&self) -> FixCapability { ... }
fn from_config(_config: &Config) -> Box<dyn Rule>
where Self: Sized { ... }
}Expand description
Remove marker /// TRAIT_MARKER_V1
Required Methods§
fn name(&self) -> &'static str
fn description(&self) -> &'static str
fn check(&self, ctx: &LintContext<'_>) -> LintResult
fn fix(&self, ctx: &LintContext<'_>) -> Result<String, LintError>
fn as_any(&self) -> &dyn Any
Provided Methods§
Sourcefn check_with_ast(
&self,
ctx: &LintContext<'_>,
_ast: &MarkdownAst,
) -> LintResult
fn check_with_ast( &self, ctx: &LintContext<'_>, _ast: &MarkdownAst, ) -> LintResult
AST-based check method for rules that can benefit from shared AST parsing By default, calls the regular check method if not overridden
Sourcefn should_skip(&self, _ctx: &LintContext<'_>) -> bool
fn should_skip(&self, _ctx: &LintContext<'_>) -> bool
Check if this rule should quickly skip processing based on content
Sourcefn category(&self) -> RuleCategory
fn category(&self) -> RuleCategory
Get the category of this rule for selective processing
fn as_maybe_ast(&self) -> Option<&dyn MaybeAst>
Sourcefn default_config_section(&self) -> Option<(String, Value)>
fn default_config_section(&self) -> Option<(String, Value)>
Returns the rule name and default config table if the rule has config.
If a rule implements this, it MUST be defined on the impl Rule for ... block,
not just the inherent impl.
Sourcefn config_aliases(&self) -> Option<HashMap<String, String>>
fn config_aliases(&self) -> Option<HashMap<String, String>>
Returns config key aliases for this rule This allows rules to accept alternative config key names for backwards compatibility
Sourcefn fix_capability(&self) -> FixCapability
fn fix_capability(&self) -> FixCapability
Declares the fix capability of this rule