I'm implementing some inspections for a JS test library and I would need to enable/disable them based on project specific conditions.
The trick is that the library has two versions in two different npm packages, so the inspections would need to be enabled/disabled based on which npm package is used as dependency in the project (using both is invalid). The other reason is that they changed the behaviour of the library so that certain things (and therefore inspections too) are applicable only in one or the other.
The plan is to enable/disable them in the currently used inspection profile, or even globally, so that I wouldn't have to ask the plugin's users to enable/disable them manually for each project they use.
This is what I have so far as candidate solutions or have looked into:
enabledByDefault property in plugin.xml is not a valid approach because it cannot evaluate dynamic conditions, simply accept boolean literals.
InspectionProfileEnty#isEnabledByDefault() is also not good for me, because the javadoc states that it must not be overridden, and also because I would need access to the current project's Project object.
- Implement a StartupActivity and enable/disabled them via InspectionProfileManager and InspectionProfileImpl
Can you suggest a sophisticated approach with which this might be possible to achieve?