Skip to content

Commit cb76518

Browse files
Merge pull request #1038 from bohdan-harniuk/uct-1030-add-config-files-support
UCT-1030: Added configuration files support
2 parents db7ef2d + 334b769 commit cb76518

24 files changed

+788
-28
lines changed

resources/META-INF/plugin.xml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -543,6 +543,50 @@
543543
enabledByDefault="false"
544544
level="WARNING"
545545
implementationClass="com.magento.idea.magento2uct.inspections.php.api.CalledNonInterfaceMethod"/>
546+
547+
<localInspection language="XML" groupPath="UCT"
548+
shortName="UsedDeprecatedTypeInConfig"
549+
bundle="uct.bundle.inspection" key="inspection.displayName.UsedDeprecatedTypeInConfig"
550+
groupBundle="uct.bundle.inspection" groupKey="inspection.deprecation.group.name"
551+
enabledByDefault="false"
552+
level="WARNING"
553+
implementationClass="com.magento.idea.magento2uct.inspections.xml.UsedDeprecatedTypeInConfig"/>
554+
<localInspection language="XML" groupPath="UCT"
555+
shortName="UsedDeprecatedConstantInConfig"
556+
bundle="uct.bundle.inspection" key="inspection.displayName.UsedDeprecatedConstantInConfig"
557+
groupBundle="uct.bundle.inspection" groupKey="inspection.deprecation.group.name"
558+
enabledByDefault="false"
559+
level="WARNING"
560+
implementationClass="com.magento.idea.magento2uct.inspections.xml.UsedDeprecatedConstantInConfig"/>
561+
<localInspection language="XML" groupPath="UCT"
562+
shortName="UsedDeprecatedMethodInConfig"
563+
bundle="uct.bundle.inspection" key="inspection.displayName.UsedDeprecatedMethodInConfig"
564+
groupBundle="uct.bundle.inspection" groupKey="inspection.deprecation.group.name"
565+
enabledByDefault="false"
566+
level="WARNING"
567+
implementationClass="com.magento.idea.magento2uct.inspections.xml.UsedDeprecatedMethodInConfig"/>
568+
569+
<localInspection language="XML" groupPath="UCT"
570+
shortName="UsedNonExistentTypeInConfig"
571+
bundle="uct.bundle.inspection" key="inspection.displayName.UsedNonExistentTypeInConfig"
572+
groupBundle="uct.bundle.inspection" groupKey="inspection.existence.group.name"
573+
enabledByDefault="false"
574+
level="ERROR"
575+
implementationClass="com.magento.idea.magento2uct.inspections.xml.UsedNonExistentTypeInConfig"/>
576+
<localInspection language="XML" groupPath="UCT"
577+
shortName="UsedNonExistentConstantInConfig"
578+
bundle="uct.bundle.inspection" key="inspection.displayName.UsedNonExistentConstantInConfig"
579+
groupBundle="uct.bundle.inspection" groupKey="inspection.existence.group.name"
580+
enabledByDefault="false"
581+
level="ERROR"
582+
implementationClass="com.magento.idea.magento2uct.inspections.xml.UsedNonExistentConstantInConfig"/>
583+
<localInspection language="XML" groupPath="UCT"
584+
shortName="UsedNonExistentMethodInConfig"
585+
bundle="uct.bundle.inspection" key="inspection.displayName.UsedNonExistentMethodInConfig"
586+
groupBundle="uct.bundle.inspection" groupKey="inspection.existence.group.name"
587+
enabledByDefault="false"
588+
level="ERROR"
589+
implementationClass="com.magento.idea.magento2uct.inspections.xml.UsedNonExistentMethodInConfig"/>
546590
<!-- \UCT inspection -->
547591

548592
<internalFileTemplate name="Magento Composer JSON"/>
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<html>
2+
<body>
3+
<p>[1234] Using Magento 2 @deprecated constant: consider using Magento Open Source|Adobe Commerce constant marked as @api instead.</p>
4+
<!-- tooltip end -->
5+
</body>
6+
</html>
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<html>
2+
<body>
3+
<p>[1439] Using Magento 2 @deprecated method: this method will be removed in upcoming versions. Consider relying on methods declared in API interfaces instead.</p>
4+
<!-- tooltip end -->
5+
</body>
6+
</html>
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<html>
2+
<body>
3+
<p>[1134] Using Magento 2 @deprecated type: consider using Magento Open Source|Adobe Commerce type marked as @api instead.</p>
4+
<!-- tooltip end -->
5+
</body>
6+
</html>
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<html>
2+
<body>
3+
<p>[1214] The used constant is no longer present in the codebase.</p>
4+
<!-- tooltip end -->
5+
</body>
6+
</html>
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<html>
2+
<body>
3+
<p>[1410] The used method is no longer present in the codebase.</p>
4+
<!-- tooltip end -->
5+
</body>
6+
</html>
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<html>
2+
<body>
3+
<p>[1110] The used type is no longer present in the codebase.</p>
4+
<!-- tooltip end -->
5+
</body>
6+
</html>

resources/uct/bundle/inspection.properties

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,12 @@ inspection.displayName.ExtendedNonApiClass=Extended non Magento 2 API class
3838
inspection.displayName.InheritedNonApiInterface=Inherited non Magento 2 API interface
3939
inspection.displayName.PossibleDependencyOnImplDetails=Possible dependency on implementation details
4040
inspection.displayName.CalledNonInterfaceMethod=Called non-interface method
41+
inspection.displayName.UsedNonExistentTypeInConfig=Used non-existent Magento 2 type in the configuration file
42+
inspection.displayName.UsedDeprecatedTypeInConfig=Used deprecated Magento 2 type in the configuration file
43+
inspection.displayName.UsedDeprecatedConstantInConfig=Used deprecated Magento 2 constant in the configuration file
44+
inspection.displayName.UsedDeprecatedMethodInConfig=Used deprecated Magento 2 method in the configuration file
45+
inspection.displayName.UsedNonExistentConstantInConfig=Used non-existent Magento 2 constant in the configuration file
46+
inspection.displayName.UsedNonExistentMethodInConfig=Used non-existent Magento 2 method in the configuration file
4147
customCode.warnings.deprecated.1131=[1131] Extended class ''{0}'' that is @deprecated in the ''{1}''
4248
customCode.warnings.deprecated.1132=[1132] Imported class ''{0}'' that is @deprecated in the ''{1}''
4349
customCode.warnings.deprecated.1134=[1134] Used class ''{0}'' that is @deprecated in the ''{1}''

src/com/magento/idea/magento2uct/execution/GenerateUctReportCommand.java

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
import com.intellij.psi.PsiDocumentManager;
2121
import com.intellij.psi.PsiFile;
2222
import com.intellij.psi.PsiManager;
23-
import com.jetbrains.php.lang.psi.PhpFile;
2423
import com.magento.idea.magento2plugin.util.magento.MagentoVersionUtil;
2524
import com.magento.idea.magento2uct.execution.output.ReportBuilder;
2625
import com.magento.idea.magento2uct.execution.output.Summary;
@@ -135,9 +134,6 @@ public void execute() {
135134
boolean isModuleHeaderPrinted = false;
136135

137136
for (final PsiFile psiFile : new ModuleFilesScanner(componentData)) {
138-
if (!(psiFile instanceof PhpFile)) {
139-
continue;
140-
}
141137
final String filename = psiFile.getVirtualFile().getPath();
142138
final UctInspectionManager inspectionManager = new UctInspectionManager(
143139
project

src/com/magento/idea/magento2uct/execution/scanner/ModuleFilesScanner.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77

88
import com.intellij.psi.PsiDirectory;
99
import com.intellij.psi.PsiFile;
10-
import com.jetbrains.php.lang.psi.PhpFile;
1110
import com.magento.idea.magento2uct.execution.scanner.data.ComponentData;
11+
import com.magento.idea.magento2uct.packages.SupportedIssue;
1212
import java.util.ArrayList;
1313
import java.util.Iterator;
1414
import java.util.List;
@@ -53,9 +53,12 @@ private List<PsiFile> run() {
5353
*/
5454
private void collectFilesInDirectoryRecursively(final @NotNull PsiDirectory directory) {
5555
for (final PsiFile file : directory.getFiles()) {
56-
if (file instanceof PhpFile) {
57-
files.add(file);
56+
if (SupportedIssue.getSupportedFileTypes().stream().noneMatch(
57+
clazz -> clazz.isInstance(file))
58+
) {
59+
continue;
5860
}
61+
files.add(file);
5962
}
6063

6164
for (final PsiDirectory subDirectory : directory.getSubdirectories()) {

0 commit comments

Comments
 (0)