@@ -9,47 +9,15 @@ mod rule;
99// Re-exported for use in the `declare_group` macro
1010pub use pg_diagnostics:: category_concat;
1111
12- use registry:: RegistryRuleParams ;
13-
1412pub use crate :: categories:: {
15- ActionCategory , RefactorKind , RuleCategories , RuleCategory ,
16- SourceActionKind , SUPPRESSION_ACTION_CATEGORY , RuleCategoriesBuilder
13+ ActionCategory , RefactorKind , RuleCategories , RuleCategoriesBuilder , RuleCategory ,
14+ SourceActionKind , SUPPRESSION_ACTION_CATEGORY ,
1715} ;
1816pub use crate :: filter:: { AnalysisFilter , GroupKey , RuleFilter , RuleKey } ;
19- pub use crate :: options:: { AnalyzerConfiguration , AnalyzerOptions , AnalyzerRules } ;
20- pub use crate :: registry:: { MetadataRegistry , RegistryVisitor , RuleRegistry , RuleRegistryBuilder } ;
17+ pub use crate :: options:: { AnalyserOptions , AnalyserRules } ;
18+ pub use crate :: registry:: {
19+ MetadataRegistry , RegistryRuleParams , RegistryVisitor , RuleRegistry , RuleRegistryBuilder ,
20+ } ;
2121pub use crate :: rule:: {
2222 GroupCategory , Rule , RuleDiagnostic , RuleGroup , RuleMeta , RuleMetadata , RuleSource ,
2323} ;
24-
25- pub struct Analyzer < ' analyzer > {
26- /// Holds the metadata for all the rules statically known to the analyzer
27- /// we need this later when we add suppression support
28- #[ allow( dead_code) ]
29- metadata : & ' analyzer MetadataRegistry ,
30- }
31-
32- pub struct AnalyzerContext < ' a > {
33- pub root : & ' a pg_query_ext:: NodeEnum ,
34- pub options : & ' a AnalyzerOptions ,
35- pub registry : RuleRegistry ,
36- }
37-
38- impl < ' analyzer > Analyzer < ' analyzer > {
39- /// Construct a new instance of the analyzer with the given rule registry
40- pub fn new ( metadata : & ' analyzer MetadataRegistry ) -> Self {
41- Self { metadata }
42- }
43-
44- pub fn run ( self , ctx : AnalyzerContext ) -> Vec < RuleDiagnostic > {
45- let params = RegistryRuleParams {
46- root : ctx. root ,
47- options : ctx. options ,
48- } ;
49-
50- ctx. registry
51- . into_iter ( )
52- . flat_map ( |rule| ( rule. run ) ( & params) )
53- . collect :: < Vec < _ > > ( )
54- }
55- }
0 commit comments