use tree_sitter::Node;
use crate::cop::{Cop, CopConfig};
use crate::diagnostic::Diagnostic;
use crate::parse::source::SourceFile;
pub struct Semicolon;
impl Cop for Semicolon {
fn name(&self) -> &'static str {
"Style/Semicolon"
}
fn interested_node_kinds(&self) -> &'static [&'static str] {
&[";"]
}
fn check_node(
&self,
source: &SourceFile,
node: Node<'_>,
_config: &CopConfig,
diagnostics: &mut Vec<Diagnostic>,
_corrections: Option<&mut Vec<crate::correction::Correction>>,
) {
let (line, col) = source.offset_to_line_col(node.start_byte());
diagnostics.push(self.diagnostic(
source,
line,
col,
"Do not use semicolons to terminate expressions.".to_string(),
));
}
fn redundant_disable_audit(&self) -> bool {
false
}
}