Skip to content

Commit 030b66c

Browse files
committed
Fixed bug invalid check setup_version
1 parent 02bb789 commit 030b66c

File tree

2 files changed

+25
-17
lines changed

2 files changed

+25
-17
lines changed

CHANGELOG.md

+3
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0).
1010

1111
- Require restart on plugin update due to using native libraries
1212

13+
### Fixed
14+
- Fixed invalid check 'setup_version' in the etc/module.xml
15+
1316
## 3.1.2
1417

1518
### Fixed

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

+22-17
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
import com.intellij.codeInspection.ProblemHighlightType;
99
import com.intellij.codeInspection.ProblemsHolder;
1010
import com.intellij.codeInspection.XmlSuppressableInspectionTool;
11+
import com.intellij.patterns.XmlAttributeValuePattern;
1112
import com.intellij.psi.PsiDirectory;
1213
import com.intellij.psi.PsiElementVisitor;
1314
import com.intellij.psi.PsiFile;
@@ -27,6 +28,8 @@
2728

2829
public class ModuleDeclarationInModuleXmlInspection extends XmlSuppressableInspectionTool {
2930

31+
private static final String MODULE_NAME = "name";
32+
3033
@NotNull
3134
@Override
3235
public PsiElementVisitor buildVisitor(
@@ -54,24 +57,26 @@ public void visitXmlAttributeValue(final XmlAttributeValue value) {
5457
return;
5558
}
5659

57-
final String expectedName
58-
= GetEditableModuleNameByRootFileUtil.execute(etcDirectory);
59-
final String actualName = value.getValue();
60-
if (actualName.equals(expectedName)) {
61-
return;
60+
final String attributeName = XmlAttributeValuePattern.getLocalName(value);
61+
if (attributeName != null && attributeName.equals(MODULE_NAME)) {
62+
final String expectedName
63+
= GetEditableModuleNameByRootFileUtil.execute(etcDirectory);
64+
final String actualName = value.getValue();
65+
if (actualName.equals(expectedName)) {
66+
return;
67+
}
68+
final InspectionBundle inspectionBundle = new InspectionBundle();
69+
problemsHolder.registerProblem(
70+
value,
71+
inspectionBundle.message(
72+
"inspection.moduleDeclaration.warning.wrongModuleName",
73+
actualName,
74+
expectedName
75+
),
76+
ProblemHighlightType.ERROR,
77+
new XmlModuleNameQuickFix(expectedName)
78+
);
6279
}
63-
64-
final InspectionBundle inspectionBundle = new InspectionBundle();
65-
problemsHolder.registerProblem(
66-
value,
67-
inspectionBundle.message(
68-
"inspection.moduleDeclaration.warning.wrongModuleName",
69-
actualName,
70-
expectedName
71-
),
72-
ProblemHighlightType.ERROR,
73-
new XmlModuleNameQuickFix(expectedName)
74-
);
7580
}
7681
};
7782
}

0 commit comments

Comments
 (0)