Skip to content

Extract RuleDefinition as the base identity for rules - #1007

Merged
vinistock merged 1 commit into
mainfrom
vs_extract_rule_definition
Aug 14, 2026
Merged

Extract RuleDefinition as the base identity for rules#1007
vinistock merged 1 commit into
mainfrom
vs_extract_rule_definition

Conversation

@vinistock

Copy link
Copy Markdown
Member

Third step towards #1000

We need to share the concept of a rule across Rust and Ruby, the graph and the linter. However, Rule currently enforces that each descendant must implement lint. This is an issue for unification because graph and linter diagnostics are collected differently.

In reality, the common concept is not Rule, but a RuleDefinition. All we need is the identity of the rule: a name and the default severity. With this, we can treat all rules similarly for the configuration as it applies to the RuleDefinition and not the Rule.

In more abstract terms, this PR makes RuleDefinition the identity of a rule, while Rule is the execution abstraction for the definition.

@vinistock vinistock self-assigned this Aug 14, 2026
@vinistock
vinistock requested a review from a team as a code owner August 14, 2026 15:48
@st0012

st0012 commented Aug 14, 2026

Copy link
Copy Markdown
Member

IMO RuleDefinition is more like an interface then a base class, so using a module probably makes more sense?
And I think it should be kept under the Linter namespace.

Base automatically changed from vs_move_default_severity_to_class_level to main August 14, 2026 16:12
@vinistock
vinistock force-pushed the vs_extract_rule_definition branch from 4abc55f to 65d7c1e Compare August 14, 2026 17:44
@vinistock

Copy link
Copy Markdown
Member Author

I moved it under the linter. However, after trying out the module approach, I find it a bit strange. I would keep it as a parent class that defines the identity of a rule.

@vinistock
vinistock force-pushed the vs_extract_rule_definition branch from 65d7c1e to fd06555 Compare August 14, 2026 19:53
@vinistock
vinistock merged commit 7de2050 into main Aug 14, 2026
30 checks passed
@vinistock
vinistock deleted the vs_extract_rule_definition branch August 14, 2026 20:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants