Skip to content

Commit fec9461

Browse files
committed
Added inspection warning for disabled invalid plugin
1 parent 553e14e commit fec9461

File tree

2 files changed

+17
-7
lines changed

2 files changed

+17
-7
lines changed

resources/magento2/inspection.properties

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
inspection.plugin.duplicateInSameFile=The plugin name already used in this file. For more details see Inspection Description.
22
inspection.plugin.duplicateInOtherPlaces=The plugin name "{0}" for targeted "{1}" class is already used in the module "{2}" ({3} scope). For more details see Inspection Description.
3+
inspection.plugin.disabledPluginDoesNotExist=This plugin does not exist to be disabled.
34
inspection.graphql.resolver.mustImplement=Class must implements any of the following interfaces: \\Magento\\Framework\\GraphQl\\Query\\ResolverInterface, \\Magento\\Framework\\GraphQl\\Query\\Resolver\\BatchResolverInterface, \\Magento\\Framework\\GraphQl\\Query\\Resolver\\BatchServiceContractResolverInterface
45
inspection.graphql.resolver.notExist=Resolver class do not exist
56
inspection.graphql.resolver.fix.family=Implement Resolver interface

src/com/magento/idea/magento2plugin/inspections/xml/PluginDeclarationInspection.java

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -84,13 +84,7 @@ public void visitFile(final PsiFile file) {
8484
final XmlAttribute pluginTypeDisabledAttribute
8585
= pluginTypeXmlTag.getAttribute(ModuleDiXml.DISABLED_ATTR_NAME);
8686

87-
if (pluginTypeNameAttribute == null
88-
|| (
89-
pluginTypeDisabledAttribute != null //NOPMD
90-
&& pluginTypeDisabledAttribute.getValue() != null
91-
&& pluginTypeDisabledAttribute.getValue().equals("true")
92-
)
93-
) {
87+
if (pluginTypeNameAttribute == null) {
9488
continue;
9589
}
9690

@@ -116,6 +110,21 @@ public void visitFile(final PsiFile file) {
116110
pluginIndex,
117111
file
118112
);
113+
114+
if (pluginTypeDisabledAttribute != null
115+
&& pluginTypeDisabledAttribute.getValue() != null
116+
&& pluginTypeDisabledAttribute.getValue().equals("true")
117+
&& modulesWithSamePluginName.isEmpty()
118+
) {
119+
problemsHolder.registerProblem(
120+
pluginTypeNameAttribute.getValueElement(),
121+
inspectionBundle.message(
122+
"inspection.plugin.disabledPluginDoesNotExist"
123+
),
124+
errorSeverity
125+
);
126+
}
127+
119128
for (final Pair<String, String> moduleEntry: modulesWithSamePluginName) {
120129
final String scope = moduleEntry.getFirst();
121130
final String moduleName = moduleEntry.getSecond();

0 commit comments

Comments
 (0)