Rule

Trait Rule 

Source
pub trait Rule:
    DynClone
    + Send
    + Sync {
    // 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 should_skip(&self, _ctx: &LintContext<'_>) -> bool { ... }
    fn category(&self) -> RuleCategory { ... }
    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§

Source

fn name(&self) -> &'static str

Source

fn description(&self) -> &'static str

Source

fn check(&self, ctx: &LintContext<'_>) -> LintResult

Source

fn fix(&self, ctx: &LintContext<'_>) -> Result<String, LintError>

Source

fn as_any(&self) -> &dyn Any

Provided Methods§

Source

fn should_skip(&self, _ctx: &LintContext<'_>) -> bool

Check if this rule should quickly skip processing based on content

Source

fn category(&self) -> RuleCategory

Get the category of this rule for selective processing

Source

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.

Source

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

Source

fn fix_capability(&self) -> FixCapability

Declares the fix capability of this rule

Source

fn from_config(_config: &Config) -> Box<dyn Rule>
where Self: Sized,

Factory: create a rule from config (if present), or use defaults.

Implementors§

Source§

impl Rule for MD004UnorderedListStyle

Source§

impl Rule for MD013LineLength

Source§

impl Rule for MD030ListMarkerSpace

Source§

impl Rule for MD001HeadingIncrement

Source§

impl Rule for MD003HeadingStyle

Source§

impl Rule for MD005ListIndent

Source§

impl Rule for MD007ULIndent

Source§

impl Rule for MD009TrailingSpaces

Source§

impl Rule for MD010NoHardTabs

Source§

impl Rule for MD012NoMultipleBlanks

Source§

impl Rule for MD014CommandsShowOutput

Source§

impl Rule for MD018NoMissingSpaceAtx

Source§

impl Rule for MD019NoMultipleSpaceAtx

Source§

impl Rule for MD020NoMissingSpaceClosedAtx

Source§

impl Rule for MD021NoMultipleSpaceClosedAtx

Source§

impl Rule for MD022BlanksAroundHeadings

Source§

impl Rule for MD023HeadingStartLeft

Source§

impl Rule for MD024NoDuplicateHeading

Source§

impl Rule for MD025SingleTitle

Source§

impl Rule for MD026NoTrailingPunctuation

Source§

impl Rule for MD027MultipleSpacesBlockquote

Source§

impl Rule for MD028NoBlanksBlockquote

Source§

impl Rule for MD029OrderedListPrefix

Source§

impl Rule for MD031BlanksAroundFences

Source§

impl Rule for MD032BlanksAroundLists

Source§

impl Rule for MD033NoInlineHtml

Source§

impl Rule for MD034NoBareUrls

Source§

impl Rule for MD035HRStyle

Source§

impl Rule for MD036NoEmphasisAsHeading

Source§

impl Rule for MD037NoSpaceInEmphasis

Source§

impl Rule for MD038NoSpaceInCode

Source§

impl Rule for MD040FencedCodeLanguage

Source§

impl Rule for MD041FirstLineHeading

Source§

impl Rule for MD043RequiredHeadings

Source§

impl Rule for MD044ProperNames

Source§

impl Rule for MD045NoAltText

Source§

impl Rule for MD046CodeBlockStyle

Source§

impl Rule for MD047SingleTrailingNewline

Source§

impl Rule for MD048CodeFenceStyle

Source§

impl Rule for MD049EmphasisStyle

Source§

impl Rule for MD050StrongStyle

Source§

impl Rule for MD051LinkFragments

Source§

impl Rule for MD052ReferenceLinkImages

Source§

impl Rule for MD053LinkImageReferenceDefinitions

Source§

impl Rule for MD054LinkImageStyle

Source§

impl Rule for MD055TablePipeStyle

Source§

impl Rule for MD056TableColumnCount

Source§

impl Rule for MD058BlanksAroundTables

Source§

impl Rule for MD059LinkText

Source§

impl Rule for MD060TableFormat

Source§

impl Rule for MD061ForbiddenTerms