qlty_config/config/
issue_transformer.rs

1use qlty_types::analysis::v1::Issue;
2use std::fmt::Debug;
3
4pub trait IssueTransformer: Debug + Send + Sync + 'static {
5    fn initialize(&self) {}
6    fn transform(&self, issue: Issue) -> Option<Issue>;
7    fn clone_box(&self) -> Box<dyn IssueTransformer>;
8}
9
10impl Clone for Box<dyn IssueTransformer> {
11    fn clone(&self) -> Self {
12        self.clone_box()
13    }
14}
15
16#[derive(Debug, Clone)]
17pub struct NullIssueTransformer;
18
19impl IssueTransformer for NullIssueTransformer {
20    fn transform(&self, issue: Issue) -> Option<Issue> {
21        Some(issue)
22    }
23
24    fn clone_box(&self) -> Box<dyn IssueTransformer> {
25        Box::new(self.clone())
26    }
27}