How is it better to orginize inspection code

Answered

I am creating a plugin (python) with inspection that will do some actions like:

```

with MyRoot(

    id = 'id',

    mydate='1234-01-01'

):

    someVar = MyElement(

        endDate=''

    )

```

So the logic is to find `MyRoot`, then grab it's `mydate` property and compare it with `MyElement.endDate`. To do this I need create Visitor in Inspection class. The visitor can implement 2 methods:

1) `visitPyCallExpression` and then traverse children and find `Myelement`

2) `visitPyKeywordArgument` and then traverse parents to `MyRoot` and `Myelement`

What method is better?

0
1 comment

Have you measured it to be problematic? Otherwise, I'd just stick with the approach that is more stable (and easier to implement).

0

Please sign in to leave a comment.