-
Notifications
You must be signed in to change notification settings - Fork 109
refactor(analyser): separate concerns #617
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
83c2924 to
dc098c0
Compare
Changed pgls_analyse::AnalyserRules to pgls_analyser::LinterRules and fixed import statements to use the correct crate for RuleOptions. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Updated test files to use the new type names after the refactor: - Changed AnalyserOptions to LinterOptions - Changed RuleDiagnostic to LinterDiagnostic - Fixed import paths to import from pgls_analyser instead of pgls_analyse 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Fixed import ordering and line length formatting issues. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
| pub use LinterDiagnostic as RuleDiagnostic; | ||
| pub use LinterRule as Rule; | ||
| pub use LinterRuleContext as RuleContext; | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sind die Linter-spezifisch? wenn ja, kann das hier IMHo zu verwirrung führen
| pub mod options; | ||
| mod registry; | ||
|
|
||
| // Re-export linter-specific types |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| // Re-export linter-specific types |
| metadata | ||
| }); | ||
|
|
||
| // Separate function for visiting metadata registry (uses pgls_analyse::RegistryVisitor) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| // Separate function for visiting metadata registry (uses pgls_analyse::RegistryVisitor) |
| pub static METADATA: LazyLock<MetadataRegistry> = LazyLock::new(|| { | ||
| let mut metadata = MetadataRegistry::default(); | ||
| visit_registry(&mut metadata); | ||
| // Use a separate visitor for metadata that implements pgls_analyse::RegistryVisitor |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
inwiefern separate? ist das nicht einfach der default?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
vorher hatten wir einen Visitor auf Rule, wo Rule metadaten (RuleMeta) und ein run Methode verlangt hat. dh wir hatten ein tight coupling zwischen metadata declaration und execution von rules. jetzt haben wir zwei visitors: einer der nur über RuleMeta läuft, und einer der auch die execution verlange. letzterer existiert nur noch innerhalb der source code linter crate. deshalb "separate visitor" - es gibt jetzt zwei.
Refactors
pgls_analyseandpgls_analyserso that "source code linter"-concerns only live inanalyser.analyseonly contains shared concerns such asRuleMetaand a genericRuleVisitor.This is in preparation for the integration of other type of linters (e.g.
splinter), which will use the same infrastructure as much as possible. Every execution concern was moved topgls_analyser, since other linters will not run on the AST and have a different execution model.