rslint_core

Trait Rule

Source
pub trait Rule:
    Debug
    + DynClone
    + Send
    + Sync {
    // Required methods
    fn name(&self) -> &'static str;
    fn group(&self) -> &'static str;

    // Provided methods
    fn docs(&self) -> &'static str { ... }
    fn tags(&self) -> &'static [Tag] { ... }
    fn recommended(&self) -> bool { ... }
}
Expand description

A generic trait which describes things common to a rule regardless on what they run on.

Each rule should have a new function for easy instantiation. We however do not require this for the purposes of allowing more complex rules to instantiate themselves in a different way. However the rules must be easily instantiated because of rule groups.

Required Methods§

Source

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

A unique, kebab-case name for the rule.

Source

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

The name of the group this rule belongs to.

Provided Methods§

Source

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

Optional docs for the rule, an empty string by default

Source

fn tags(&self) -> &'static [Tag]

A list of tags present on this rule. Empty by default.

Source

fn recommended(&self) -> bool

Whether this rule is recommended, this is a simple helper around Self::tags.

Implementors§