It will be great help if you could extract it into `ASTUtil`. I agree extracting it to base class or `RuleCarrier` would write much less code, however I don't think it's something that is required by the majority of the rules, but rather a helper method. So in my opinion, I prefer it in the `ASTUtil`.

If `LongClassRule` and `LongMethodRule` can reuse this new method, it will be great! Thanks!