use cpd_core::models::{CloneKind, CpdClone, SimilarityMethod};
pub const DUPLICATE: &str = "jscpd/duplicate-code";
pub const RENAMED: &str = "jscpd/renamed-code";
pub const SIMILAR: &str = "jscpd/similar-code";
pub const SIMILAR_FUNCTION: &str = "jscpd/similar-function";
pub const SEMANTIC: &str = "jscpd/semantic-code";
pub const COMPLEX_FUNCTION: &str = "jscpd/complex-function";
pub const COMPLEX_FILE: &str = "jscpd/complex-file";
pub fn rule_id(clone: &CpdClone) -> &'static str {
match clone.kind {
CloneKind::Exact => DUPLICATE,
CloneKind::Renamed => RENAMED,
CloneKind::Similar if clone.similarity_method == Some(SimilarityMethod::Ast) => {
SIMILAR_FUNCTION
}
CloneKind::Similar => SIMILAR,
CloneKind::Semantic => SEMANTIC,
}
}