diff --git a/plugins/devkit/src/inspections/InspectionMappingConsistencyInspection.java b/plugins/devkit/src/inspections/InspectionMappingConsistencyInspection.java index 2da0d036763d..39c531748bf4 100644 --- a/plugins/devkit/src/inspections/InspectionMappingConsistencyInspection.java +++ b/plugins/devkit/src/inspections/InspectionMappingConsistencyInspection.java @@ -48,8 +48,8 @@ public class InspectionMappingConsistencyInspection extends DevKitInspectionBase public void visitXmlTag(XmlTag tag) { DomElement element = DomUtil.getDomElement(tag); if (element instanceof Extension) { - ExtensionPoint target = ((Extension)element).getExtensionPoint(); - if (target != null && InheritanceUtil.isInheritor(target.getBeanClass().getValue(), "com.intellij.codeInspection.InspectionEP")) { + ExtensionPoint extensionPoint = ((Extension)element).getExtensionPoint(); + if (extensionPoint != null && InheritanceUtil.isInheritor(extensionPoint.getBeanClass().getValue(), "com.intellij.codeInspection.InspectionEP")) { boolean key = tag.getAttribute("key") != null; boolean groupKey = tag.getAttribute("groupKey") != null; if (key) { @@ -57,11 +57,17 @@ public class InspectionMappingConsistencyInspection extends DevKitInspectionBase checkDefaultBundle(element, holder); } } + else if (tag.getAttribute("displayName") == null) { + registerProblem(element, holder, "displayName or key should be specified"); + } if (groupKey) { if (tag.getAttribute("bundle") == null && tag.getAttribute("groupBundle") == null) { checkDefaultBundle(element, holder); } } + else if (tag.getAttribute("groupName") == null) { + registerProblem(element, holder, "groupName or groupKey should be specified"); + } } } } @@ -71,11 +77,15 @@ public class InspectionMappingConsistencyInspection extends DevKitInspectionBase private static void checkDefaultBundle(DomElement element, ProblemsHolder holder) { IdeaPlugin plugin = DomUtil.getParentOfType(element, IdeaPlugin.class, true); if (plugin != null && plugin.getResourceBundles().isEmpty()) { - Pair range = DomUtil.getProblemRange(element.getXmlTag()); - holder.registerProblem(range.second, range.first, "Bundle should be specified"); + registerProblem(element, holder, "Bundle should be specified"); } } + private static void registerProblem(DomElement element, ProblemsHolder holder, String message) { + Pair range = DomUtil.getProblemRange(element.getXmlTag()); + holder.registerProblem(range.second, range.first, message); + } + @Nls @NotNull @Override diff --git a/plugins/devkit/testData/codeInsight/inspectionMapping.xml b/plugins/devkit/testData/codeInsight/inspectionMapping.xml index 8fb30e4e1c29..e4ab77ccfc44 100644 --- a/plugins/devkit/testData/codeInsight/inspectionMapping.xml +++ b/plugins/devkit/testData/codeInsight/inspectionMapping.xml @@ -8,11 +8,14 @@ - <localInspection key="foo"/> - <localInspection groupKey="foo"/> - <localInspection key="foo" groupBundle="bundle"/> + <localInspection key="foo"/> + <localInspection groupKey="foo"/> + <localInspection key="foo" groupBundle="bundle"/> - - + <localInspection key="foo" bundle="bundle"/> + <localInspection groupKey="foo" bundle="bundle"/> + + + \ No newline at end of file diff --git a/plugins/devkit/testData/codeInsight/inspectionMappingWithDefaultBundle.xml b/plugins/devkit/testData/codeInsight/inspectionMappingWithDefaultBundle.xml index 293518cf9581..851e097992eb 100644 --- a/plugins/devkit/testData/codeInsight/inspectionMappingWithDefaultBundle.xml +++ b/plugins/devkit/testData/codeInsight/inspectionMappingWithDefaultBundle.xml @@ -9,11 +9,15 @@ - - - + <localInspection key="foo"/> + <localInspection groupKey="foo"/> + <localInspection key="foo" groupBundle="bundle"/> + + <localInspection key="foo" bundle="bundle"/> + <localInspection groupKey="foo" bundle="bundle"/> + + + - - \ No newline at end of file