You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I found it practical to group Rules into collections in order to resolve some of the MaybeOverlap that I was getting by having too many chained actions.
For background, I think I use the chained actions a bit too much and I am reluctant to have lots of Rules (I get lost as to naming them and knowing which is faulty), but then, I end-up with some MaybeOverlap because I don't want to break a Rule into many rules.
So, I thought, it would be great if I could still target the changes, say for a ClassDef, but instead of doing the yield, or creating many rules, I would have a Collection of Rules, each one completing (instead of piling up the chain) but within the same Session (pretty sure this is not very clear)
class ClassProcessing(RuleCollection):
rules: list[type[Rule] = [ChangeClassName, AddFundctionB, MoveFuncAtoB, ChangeFuncA, etc...]
class ChangeClassName(Rule):
...
The way I am currently clunky-ing it is by:
class _ChangeClassName(Rule):
...
class ClassProcessing(Rule):
def match(self, node: ast.AST) -> Iterator[BaseAction]:
if isinstance(statement, ast.AsyncFunctionDef):
for remove in _ChangeClassName(self.context).match(statement):
yield remove
But then if I push this too far ... BAAAM MaybeOverlap
I prepared a PR for it, but any feedback on better ways (or surely I could overlooking something!) would be welcome
The text was updated successfully, but these errors were encountered:
I found it practical to group Rules into collections in order to resolve some of the
MaybeOverlap
that I was getting by having too many chained actions.For background, I think I use the chained actions a bit too much and I am reluctant to have lots of Rules (I get lost as to naming them and knowing which is faulty), but then, I end-up with some
MaybeOverlap
because I don't want to break a Rule into many rules.So, I thought, it would be great if I could still target the changes, say for a ClassDef, but instead of doing the yield, or creating many rules, I would have a Collection of Rules, each one completing (instead of piling up the chain) but within the same Session (pretty sure this is not very clear)
For example:
My session would be simple
and for example, my ClassProcessing would be:
The way I am currently clunky-ing it is by:
But then if I push this too far ... BAAAM
MaybeOverlap
I prepared a PR for it, but any feedback on better ways (or surely I could overlooking something!) would be welcome
The text was updated successfully, but these errors were encountered: