Currently IDSCResourceRule requires two methods to be implemented:
- AnalyzeDSCResource
- AnalyzeDSCClass
First of them is called only for non-class based resources, while second of them is called for both class and non-class based resources.
If we have rule which should have different implementations for class and non-classed based resources, we need to perform additional checks inside AnalyzeDSCClass to confirm we are dealing with class based resource. We need to do it for every such rule, e.g. DscExamplesPresent and UseStandardDSCFunctionsInResource. Otherwise, we will have our rule run twice (and possibly displayed twice if conditions are not met).
We should modify the script analyzer engine so that it detects whether we are dealing with class based resource and calls AnalyzeDSCClass method only if that's the case.