feat(linter): add version-aware rule infrastructure with test rules#2
feat(linter): add version-aware rule infrastructure with test rules#2
Conversation
- Add version detection from comments and dependencies - Implement version-aware rule system with min/max version constraints - Support hash-based rule activation/deactivation - Add test rules demonstrating version/hash-specific behavior - Enable all base rules for all versions by default - Update documentation to reflect new capabilities
DXP-694 Support different versions of the GenVM
We need to be able to support multiple GenVM versions, producing a specific rules set for a given version based on the base rule set and all the modifications for every next version. We also need to detect an intelligent contract GenVM version so we know which rules should apply. |
WalkthroughAdds a version-aware linting system: new version parsing utilities, a rule registry with per-version applicability, a versioned rule framework, and linter integration with toggleable version awareness, info APIs, and comparison. Introduces YAML config, examples, expanded README/docs, dependency on PyYAML, public API exports, and extensive unit/integration tests. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
participant U as User
participant L as GenVMLinter
participant VP as VersionParser
participant RR as RuleRegistry
participant R* as Rules
Note over L: use_version_aware = true (default)
U->>L: lint_source(source)
L->>VP: extract_version(source)<br/>extract_dependencies(source)
VP-->>L: Version? + deps
L->>RR: set_version_context(context)
L->>RR: get_rules_for_version(Version|latest)
RR-->>L: instantiated Rules
loop Pre-AST / AST checks
L->>R*: set_version_context(context)
L->>R*: check(node/str)
R*-->>L: results
end
L-->>U: results (+version-info)
opt use_version_aware = false
Note over L: Fallback fixed rule set
end
sequenceDiagram
autonumber
participant U as User
participant L as GenVMLinter
participant RR as RuleRegistry
participant VP as VersionParser
U->>L: compare_versions(source1, source2)
L->>VP: extract_version(s1), extract_version(s2)
VP-->>L: v1, v2
L->>RR: get_breaking_changes(v1, v2)
RR-->>L: [changes]
L-->>U: {from, to, breaking_changes, compatible}
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60–90 minutes Poem
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Free 📒 Files selected for processing (13)
Note 🎁 Summarized by CodeRabbit FreeYour organization is on the Free plan. CodeRabbit will generate a high-level summary and a walkthrough for each pull request. For a comprehensive line-by-line review, please upgrade your subscription to CodeRabbit Pro by visiting https://app.coderabbit.ai/login. Comment |
Summary by CodeRabbit
New Features
Documentation
Tests
Chores