Repository navigation
fix(concerto-linter): traverse inheritance hierarchy in abstract-must-subclassed rule (closes #1651) - #1652
fix(concerto-linter): traverse inheritance hierarchy in abstract-must-subclassed rule (closes #1651)#1652Ashu-213 wants to merge 1 commit into
Conversation
…-subclassed rule (closes accordproject#1651) Signed-off-by: ashup <ashuptdr4@gmail.com>
There was a problem hiding this comment.
Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.
An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.
|
Thank you for this pull request, Ashu-213. It fixes the false positive reported in #1651 by following the full superType chain when deciding whether an abstract concept has a concrete subclass, so indirect subclasses through multi-level inheritance are now recognised. It also adds a valid and a branching invalid fixture with matching tests, which makes the intended behaviour easy to check. Jonathan Casey and Jamie Shorten have been asked to review. The CI runs for this pull request need approval before they start, and once they finish a maintainer will review the change and reply here. Thanks again for the contribution. Posted automatically by Mira, an Accord Project agent. A maintainer will follow up; they make the decisions on this. |
There was a problem hiding this comment.
Thank you for this fix, and for the clear linked issue. Walking each concrete declaration's superType chain fixes the false positives on root abstract types in multi-level hierarchies. The visited-set guard protects against cycles, and supertypes that aren't in the model (imports) end the walk cleanly. The two new tests are well chosen: the valid multi-level case would have failed before the change, and the branching case pins that only WaterVehicle is reported. I found nothing that needs changing, so this is ready for a maintainer to approve.
No problems found.
Automated review by Mira, an Accord Project agent, at 73ce8c6. Findings are labelled blocking, should-fix or nit; a maintainer makes the final call.
Closes #1651
The
abstract-must-subclassedlinter rule previously only inspected the immediatesuperType.nameon direct concrete declarations. In multi-level inheritance hierarchies (e.g.Vehicle(abstract) <-MotorVehicle(abstract) <-Car(concrete)), root abstract declarations were falsely reported as lacking concrete subclasses.This PR traverses the
superTypehierarchy transitively for all concrete declarations so all ancestor declarations in the chain are recognized as having concrete subclasses.Changes
hasConcreteSubclassinpackages/concerto-linter/default-ruleset/src/functions/find-abstract-declaration.tsto build a declaration lookup map and traverse thesuperTypechain up to the root for each concrete declaration.visitedset to guard against circular inheritance cycles.abstract-must-subclassed-multilevel-valid.ctoandabstract-must-subclassed-multilevel-invalid.cto.packages/concerto-linter/default-ruleset/test/rules/abstract-must-subclassed.test.tscovering multi-level inheritance and branching hierarchies.Flags
Related Issues
Author Checklist
--signoffoption of git commit.mainfromfork:branchname