Skip to main content

Rule

Trait Rule 

Source
pub trait Rule {
    // Required method
    fn name(&self) -> &'static str;

    // Provided methods
    fn check(
        &self,
        file_path: &Path,
        syntax_tree: &File,
        content: &str,
        lang: &str,
        is_test_file: bool,
    ) -> Vec<CodeIssue> { ... }
    fn check_with_context(
        &self,
        file_path: &Path,
        syntax_tree: &File,
        content: &str,
        lang: &str,
        is_test_file: bool,
        _context: &FileContext,
        _config: &ProjectConfig,
    ) -> Vec<CodeIssue> { ... }
}

Required Methods§

Source

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

Provided Methods§

Source

fn check( &self, file_path: &Path, syntax_tree: &File, content: &str, lang: &str, is_test_file: bool, ) -> Vec<CodeIssue>

Original check method (backward compatible)

Source

fn check_with_context( &self, file_path: &Path, syntax_tree: &File, content: &str, lang: &str, is_test_file: bool, _context: &FileContext, _config: &ProjectConfig, ) -> Vec<CodeIssue>

New method: check with context (recommended)

Implementors§