Skip to content

1023: [UCT] Added theme scanning #1028

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
8897c15
828: rename inspection titles
doninAtwix Feb 22, 2022
ac1a97c
828: update code style
doninAtwix Feb 22, 2022
ab81ce1
414: Added Images support for Copy Magento Path
doninAtwix Feb 28, 2022
11dbae8
409: Added arguments injection/replacement action
bohdan-harniuk Mar 7, 2022
1ea194e
409: Code refactoring
bohdan-harniuk Mar 7, 2022
238dd49
Merge branch '4.3.0-develop' of github.com:magento/magento2-phpstorm-…
bohdan-harniuk Mar 7, 2022
e06a65b
Merge pull request #1020 from doninAtwix/414-add-action-copy-path-image
bohdan-harniuk Mar 7, 2022
d93801f
966 add context action to create layout xml file
Feb 28, 2022
79bcc60
Merge branch '4.3.0-develop' of github.com:magento/magento2-phpstorm-…
bohdan-harniuk Mar 7, 2022
2cf2f80
967: Code refactoring
bohdan-harniuk Mar 7, 2022
134472d
967: Code refactoring
bohdan-harniuk Mar 7, 2022
42ca0e0
967: Code refactoring
bohdan-harniuk Mar 7, 2022
5d661e6
409: Added argument injection/replacement test cases
bohdan-harniuk Mar 9, 2022
aeffd6f
409: Suppressed warning
bohdan-harniuk Mar 9, 2022
f8901e2
Merge branch '4.3.0-develop' of github.com:magento/magento2-phpstorm-…
bohdan-harniuk Mar 9, 2022
3293ea1
409: Added target type suggestion
bohdan-harniuk Mar 9, 2022
2dd6eac
Merge pull request #1027 from bohdan-harniuk/409-add-argument-replace…
Iamwade Mar 10, 2022
2a0ec5f
967 fixes after CR
Mar 10, 2022
66394a6
967: Code refactoring after code review
bohdan-harniuk Mar 10, 2022
83fc536
Merge branch '4.3.0-develop' of github.com:magento/magento2-phpstorm-…
bohdan-harniuk Mar 10, 2022
875b63d
Merge pull request #1021 from SilinMykola/967-add-context-action-to-c…
bohdan-harniuk Mar 11, 2022
103b417
828: Code refactoring
bohdan-harniuk Mar 11, 2022
441031d
Merge branch '4.3.0-develop' of github.com:magento/magento2-phpstorm-…
bohdan-harniuk Mar 11, 2022
b1dbfbe
Merge pull request #1015 from doninAtwix/828-rename-inspection-titles
bohdan-harniuk Mar 14, 2022
9e799ac
1023: added functional for addtional scanning files
doninAtwix Mar 14, 2022
667f86b
1023: Removed unnecessary files
bohdan-harniuk Mar 14, 2022
6228b90
1023: Added support of the theme component
bohdan-harniuk Mar 15, 2022
6f24218
1023: Added phtml files support
bohdan-harniuk Mar 15, 2022
d1db080
Merge branch '4.3.0-develop' of github.com:magento/magento2-phpstorm-…
bohdan-harniuk Mar 15, 2022
47d4cdc
1023: Added themes count into the json report
bohdan-harniuk Mar 15, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions resources/META-INF/plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@
<action id="MagentoCreateViewFile" class="com.magento.idea.magento2plugin.actions.context.xml.NewViewXmlAction"/>
<action id="MagentoCreateWebapiFile" class="com.magento.idea.magento2plugin.actions.context.xml.NewWebapiXmlAction"/>
<action id="MagentoCreateWidgetFile" class="com.magento.idea.magento2plugin.actions.context.xml.NewWidgetXmlAction"/>
<action id="MagentoCreateLayoutFile" class="com.magento.idea.magento2plugin.actions.context.xml.NewLayoutXmlAction"/>
<!-- Context dependent actions -->
<separator/>
<add-to-group group-id="NewGroup" anchor="before" relative-to-action="NewXml"/>
Expand Down Expand Up @@ -126,6 +127,9 @@
<action id="MagentoCreateAWebApiInterfaceForService.Menu" class="com.magento.idea.magento2plugin.actions.generation.NewWebApiInterfaceAction">
<add-to-group group-id="EditorPopupMenu"/>
</action>
<action id="MagentoInjectConstructorArgumentAction.Menu" class="com.magento.idea.magento2plugin.actions.generation.InjectConstructorArgumentAction">
<add-to-group group-id="EditorPopupMenu"/>
</action>

<action id="CopyMagentoPath"
class="com.magento.idea.magento2plugin.actions.CopyMagentoPath"
Expand Down
8 changes: 7 additions & 1 deletion resources/fileTemplates/internal/Magento Layout XML.xml.ft
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
<?xml version="1.0"?>
#parse("XML File Header.xml")
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="admin-1column" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
#if (${IS_ADMIN} == "true")
#set ($isAdmin = true)
#else
#set ($isAdmin = false)
#end
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" #if ($isAdmin)layout="admin-1column"#end
xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
</page>
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<html>
<body>
<p>[1439] Call Adobe Commerce @deprecated method: The deprecated method will be removed in upcoming versions. Consider relying on methods declared in API interfaces instead.</p>
<p>[1439] Call Magento 2 @deprecated method: The deprecated method will be removed in upcoming versions. Consider relying on methods declared in API interfaces instead.</p>
<!-- tooltip end -->
</body>
</html>
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<html>
<body>
<p>[1131] Extending from Adobe Commerce @deprecated class: The extended class will be removed in upcoming versions. Inheritance is not recommended way of extending Adobe Commerce functionality. Update code to use a class marked as @api.</p>
<p>[1131] Extending from Magento 2 @deprecated class: The extended class will be removed in upcoming versions. Inheritance is not recommended way of extending Magento Open Source|Adobe Commerce functionality. Update code to use a class marked as @api.</p>
<!-- tooltip end -->
</body>
</html>
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<html>
<body>
<p>[1338] Implemented Adobe Commerce @deprecated interface: The deprecated interface will be removed in upcoming versions. Consider removing the interface inheritance, using an interface marked as @api or an interface introduced within your implementation instead.</p>
<p>[1338] Implemented Magento 2 @deprecated interface: The deprecated interface will be removed in upcoming versions. Consider removing the interface inheritance, using an interface marked as @api or an interface introduced within your implementation instead.</p>
<!-- tooltip end -->
</body>
</html>
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<html>
<body>
<p>[1132] Importing Adobe Commerce @deprecated class: The extended class will be removed in upcoming versions. Consider using Adobe Commerce class marked as @api instead.</p>
<p>[1132] Importing Magento 2 @deprecated class: The extended class will be removed in upcoming versions. Consider using Magento Open Source|Adobe Commerce class marked as @api instead.</p>
<!-- tooltip end -->
</body>
</html>
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<html>
<body>
<p>[1332] Imported Adobe Commerce @deprecated interface: The deprecated interface will be removed in upcoming versions. Consider using an interface or class marked as @api instead.</p>
<p>[1332] Imported Magento 2 @deprecated interface: The deprecated interface will be removed in upcoming versions. Consider using an interface or class marked as @api instead.</p>
<!-- tooltip end -->
</body>
</html>
</html>
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<html>
<body>
<p>[1337] Inherited from Adobe Commerce @deprecated interface: The deprecated interface will be removed in upcoming versions. Consider removing the interface inheritance, using an interface marked as @api or an interface introduced within your implementation instead.</p>
<p>[1337] Inherited from Magento 2 @deprecated interface: The deprecated interface will be removed in upcoming versions. Consider removing the interface inheritance, using an interface marked as @api or an interface introduced within your implementation instead.</p>
<!-- tooltip end -->
</body>
</html>
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<html>
<body>
<p>[1235] Overriding Adobe Commerce @deprecated constant: The deprecated constant will be removed in upcoming versions. Consider using a constant marked as @api or a private constant within your implementation instead.</p>
<p>[1235] Overriding Magento 2 @deprecated constant: The deprecated constant will be removed in upcoming versions. Consider using a constant marked as @api or a private constant within your implementation instead.</p>
<!-- tooltip end -->
</body>
</html>
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<html>
<body>
<p>[1535] Overriding Adobe Commerce @deprecated property: The deprecated property will be removed in upcoming versions. Consider relying on methods declared in API interfaces or using a private property within your implementation instead.</p>
<p>[1535] Overriding Magento 2 @deprecated property: The deprecated property will be removed in upcoming versions. Consider relying on methods declared in API interfaces or using a private property within your implementation instead.</p>
<!-- tooltip end -->
</body>
</html>
2 changes: 1 addition & 1 deletion resources/inspectionDescriptions/UsingDeprecatedClass.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<html>
<body>
<p>[1134] Using Adobe Commerce @deprecated class: The extended class will be removed in upcoming versions. Consider using Adobe Commerce class marked as @api instead.</p>
<p>[1134] Using Magento 2 @deprecated class: The extended class will be removed in upcoming versions. Consider using Magento Open Source|Adobe Commerce class marked as @api instead.</p>
<!-- tooltip end -->
</body>
</html>
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<html>
<body>
<p>[1234] Using Adobe Commerce @deprecated constant: The deprecated constant will be removed in upcoming versions. Consider using a constant marked as @api or a private constant within your implementation instead.</p>
<p>[1234] Using Magento 2 @deprecated constant: The deprecated constant will be removed in upcoming versions. Consider using a constant marked as @api or a private constant within your implementation instead.</p>
<!-- tooltip end -->
</body>
</html>
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<html>
<body>
<p>[1334] Used Adobe Commerce @deprecated interface: The deprecated interface will be removed in upcoming versions. Consider using an interface or class marked as @api instead.</p>
<p>[1334] Used Magento 2 @deprecated interface: The deprecated interface will be removed in upcoming versions. Consider using an interface or class marked as @api instead.</p>
<!-- tooltip end -->
</body>
</html>
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<html>
<body>
<p>[1534] Using Adobe Commerce @deprecated property: The deprecated method will be removed in upcoming versions. Consider relying on methods declared in API interfaces instead.</p>
<p>[1534] Using Magento 2 @deprecated property: The deprecated method will be removed in upcoming versions. Consider relying on methods declared in API interfaces instead.</p>
<!-- tooltip end -->
</body>
</html>
1 change: 1 addition & 0 deletions resources/magento2/common.properties
Original file line number Diff line number Diff line change
Expand Up @@ -72,4 +72,5 @@ common.template.type=Email Type
common.diagnostic.reportButtonText=Report Me
common.diagnostic.reportSubmittedTitle=The report is successfully submitted!
common.diagnostic.reportSubmittedMessage=Thank you for submitting your report! We will check it as soon as possible.
common.layout.filename=Layout File Name
common.targetMethod=Target Method
6 changes: 6 additions & 0 deletions resources/magento2/validation.properties
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ validator.alphaAndDashCharacters=The {0} field must contain alphabets and dashes
validator.alreadyDeclared={0} is already declared in the {1} module
validator.startWithNumberOrCapitalLetter=The {0} field must start with a number or a capital letter
validator.onlyNumbers=The {0} field must contain numbers only
validator.onlyIntegerOrFloatNumbers=The {0} field must contain only integer or float numbers
validator.mustNotBeNegative={0} must not be negative
validator.identifier=The {0} field must contain letters, numbers, dashes, and underscores only
validator.identifier.colon=The {0} field must contain letters, numbers, colons, dashes, and underscores only
Expand Down Expand Up @@ -41,3 +42,8 @@ validator.lowerSnakeCase=The {0} field must be of the lower snake case format
validator.menuIdentifierInvalid=The menu identifier is invalid
validator.someFieldsHaveErrors=Please, check the dialog. Some fields have errors
validator.dbSchema.invalidColumnType=Invalid ''{0}'' column type specified
validator.arrayValuesDialog.invalidValueForRowWithName=Invalid value ''{0}'' specified for the row with name ''{1}''
validator.arrayValuesDialog.namesMustBeUnique=Duplicated items names
validator.arrayValuesDialog.nameMustNotBeEmpty=The array name cannot be empty
validator.layoutNameRuleInvalid=The layout name is invalid
validator.layoutNameUnderscoreQtyInvalid=Wrong layout name, please check
44 changes: 22 additions & 22 deletions resources/uct/bundle/inspection.properties
Original file line number Diff line number Diff line change
Expand Up @@ -14,28 +14,28 @@ inspection.displayName.InheritedDeprecatedInterface=Inherited from @deprecated i
inspection.displayName.ImplementedDeprecatedInterface=Implemented @deprecated interface
inspection.displayName.CallingDeprecatedMethod=Call @deprecated method
inspection.displayName.UsingDeprecatedProperty=Using @deprecated property
inspection.displayName.ImportingNonExistentClass=Importing non-existent Adobe Commerce class
inspection.displayName.ImportingNonExistentInterface=Importing non-existent Adobe Commerce interface
inspection.displayName.InheritedNonExistentInterface=Inherited non-existent Adobe Commerce interface
inspection.displayName.ImplementedNonExistentInterface=Implemented non-existent Adobe Commerce interface
inspection.displayName.ExtendedNonExistentClass=Extended non-existent Adobe Commerce class
inspection.displayName.OverriddenNonExistentConstant=Overridden non-existent Adobe Commerce constant
inspection.displayName.OverriddenNonExistentProperty=Overridden non-existent Adobe Commerce property
inspection.displayName.CalledNonExistentMethod=Call non-existent Adobe Commerce method
inspection.displayName.UsedNonExistentType=Used non-existent Adobe Commerce type
inspection.displayName.UsedNonExistentConstant=Used non-existent Adobe Commerce constant
inspection.displayName.UsedNonExistentProperty=Used non-existent Adobe Commerce property
inspection.displayName.ImportedNonApiClass=Imported non Adobe Commerce API class
inspection.displayName.ImportedNonApiInterface=Imported non Adobe Commerce API interface
inspection.displayName.CalledNonApiMethod=Called non Adobe Commerce API method
inspection.displayName.OverriddenNonApiConstant=Overridden non Adobe Commerce API constant
inspection.displayName.OverriddenNonApiProperty=Overridden non Adobe Commerce API property
inspection.displayName.UsedNonApiConstant=Used non Adobe Commerce API constant
inspection.displayName.UsedNonApiProperty=Used non Adobe Commerce API property
inspection.displayName.UsedNonApiType=Used non Adobe Commerce API type
inspection.displayName.ImplementedNonApiInterface=Implemented non Adobe Commerce API interface
inspection.displayName.ExtendedNonApiClass=Extended non Adobe Commerce API class
inspection.displayName.InheritedNonApiInterface=Inherited non Adobe Commerce API interface
inspection.displayName.ImportingNonExistentClass=Importing non-existent Magento 2 class
inspection.displayName.ImportingNonExistentInterface=Importing non-existent Magento 2 interface
inspection.displayName.InheritedNonExistentInterface=Inherited non-existent Magento 2 interface
inspection.displayName.ImplementedNonExistentInterface=Implemented non-existent Magento 2 interface
inspection.displayName.ExtendedNonExistentClass=Extended non-existent Magento 2 class
inspection.displayName.OverriddenNonExistentConstant=Overridden non-existent Magento 2 constant
inspection.displayName.OverriddenNonExistentProperty=Overridden non-existent Magento 2 property
inspection.displayName.CalledNonExistentMethod=Call non-existent Magento 2 method
inspection.displayName.UsedNonExistentType=Used non-existent Magento 2 type
inspection.displayName.UsedNonExistentConstant=Used non-existent Magento 2 constant
inspection.displayName.UsedNonExistentProperty=Used non-existent Magento 2 property
inspection.displayName.ImportedNonApiClass=Imported non Magento 2 API class
inspection.displayName.ImportedNonApiInterface=Imported non Magento 2 API interface
inspection.displayName.CalledNonApiMethod=Called non Magento 2 API method
inspection.displayName.OverriddenNonApiConstant=Overridden non Magento 2 API constant
inspection.displayName.OverriddenNonApiProperty=Overridden non Magento 2 API property
inspection.displayName.UsedNonApiConstant=Used non Magento 2 API constant
inspection.displayName.UsedNonApiProperty=Used non Magento 2 API property
inspection.displayName.UsedNonApiType=Used non Magento 2 API type
inspection.displayName.ImplementedNonApiInterface=Implemented non Magento 2 API interface
inspection.displayName.ExtendedNonApiClass=Extended non Magento 2 API class
inspection.displayName.InheritedNonApiInterface=Inherited non Magento 2 API interface
inspection.displayName.PossibleDependencyOnImplDetails=Possible dependency on implementation details
inspection.displayName.CalledNonInterfaceMethod=Called non-interface method
customCode.warnings.deprecated.1131=[1131] Extended class ''{0}'' that is @deprecated in the ''{1}''
Expand Down
35 changes: 24 additions & 11 deletions src/com/magento/idea/magento2plugin/actions/CopyMagentoPath.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,10 @@
import com.intellij.psi.PsiFile;
import com.intellij.psi.PsiManager;
import com.magento.idea.magento2plugin.util.magento.GetModuleNameByDirectoryUtil;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import javax.imageio.ImageIO;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

Expand All @@ -27,6 +29,8 @@ public class CopyMagentoPath extends CopyPathProvider {
public static final String CSS_EXTENSION = "css";
private final List<String> acceptedTypes
= Arrays.asList(PHTML_EXTENSION, JS_EXTENSION, CSS_EXTENSION);
private static final List<String> SUPPORTED_IMAGE_EXTENSIONS
= new ArrayList<>(Arrays.asList(ImageIO.getReaderFormatNames()));
public static final String SEPARATOR = "::";
private int index;

Expand All @@ -44,6 +48,15 @@ public class CopyMagentoPath extends CopyPathProvider {
"web/"
};

/**
* Copy Magento Path actions for phtml, css, js, images extensions.
*/
public CopyMagentoPath() {
super();

SUPPORTED_IMAGE_EXTENSIONS.add("svg");
}

@Override
public void update(@NotNull final AnActionEvent event) {
final VirtualFile virtualFile = event.getData(PlatformDataKeys.VIRTUAL_FILE);
Expand All @@ -54,7 +67,8 @@ public void update(@NotNull final AnActionEvent event) {

private boolean isNotValidFile(final VirtualFile virtualFile) {
return virtualFile != null && virtualFile.isDirectory()
|| virtualFile != null && !acceptedTypes.contains(virtualFile.getExtension());
|| virtualFile != null && !acceptedTypes.contains(virtualFile.getExtension())
&& !SUPPORTED_IMAGE_EXTENSIONS.contains(virtualFile.getExtension());
}

@Override
Expand Down Expand Up @@ -85,24 +99,23 @@ private boolean isNotValidFile(final VirtualFile virtualFile) {
if (PHTML_EXTENSION.equals(virtualFile.getExtension())) {
paths = templatePaths;
} else if (JS_EXTENSION.equals(virtualFile.getExtension())
|| CSS_EXTENSION.equals(virtualFile.getExtension())) {
|| CSS_EXTENSION.equals(virtualFile.getExtension())
|| SUPPORTED_IMAGE_EXTENSIONS.contains(virtualFile.getExtension())) {
paths = webPaths;
} else {
return fullPath.toString();
}
int endIndex;

try {
endIndex = getIndexOf(paths, fullPath, paths[++index]);
} catch (ArrayIndexOutOfBoundsException exception) {
// endIndex could not be found.
return "";
}
final int offset = paths[index].length();
final int endIndex = getIndexOf(paths, fullPath, paths[++index]);
final int offset = paths[index].length();

fullPath.replace(0, endIndex + offset, "");
fullPath.replace(0, endIndex + offset, "");

return moduleName + SEPARATOR + fullPath;
return moduleName + SEPARATOR + fullPath;
} catch (ArrayIndexOutOfBoundsException exception) {
return fullPath.toString();
}
}

/**
Expand Down
Loading