-
Notifications
You must be signed in to change notification settings - Fork 105
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
Developed preference xml inspections #578
Developed preference xml inspections #578
Conversation
Waiting for #577 |
Waiting for #582 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hello, @Iamwade! I've left few comments in your PR. Please, check them.
<li>existence of attribute values</li> | ||
</ul> | ||
</body> | ||
</html> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Iamwade, please add an empty line in the and of the file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you!
<html> | ||
<body> | ||
<p> | ||
Validates classes and interfaces for attributes "for" and the "type" for the "preference" tag |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Iamwade, please remove extra space after the first "for". And if you can, please, formulate this sentence differently. For now, it is hard to read.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you!
resources/META-INF/plugin.xml
Outdated
@@ -219,6 +219,13 @@ | |||
enabledByDefault="true" level="WARNING" | |||
implementationClass="com.magento.idea.magento2plugin.inspections.xml.InvalidDependencyInjectionTypeInspection"/> | |||
|
|||
<localInspection language="XML" groupPath="XML" | |||
shortName="PreferenceXmlInspections" | |||
displayName="Inspection the existence of PHP classes for attributes in the preference" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Iamwade, please extract displayName attribute value to the magento2.inspection bundle and reference it from this context:
displayName="Inspection the existence of PHP classes for attributes in the preference" | |
bundle="magento2.inspection" key="inspection.displayName.PreferenceXmlInspections" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you!
resources/META-INF/plugin.xml
Outdated
<localInspection language="XML" groupPath="XML" | ||
shortName="PreferenceXmlInspections" | ||
displayName="Inspection the existence of PHP classes for attributes in the preference" | ||
groupName="Magento 2" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
groupName="Magento 2" | |
groupBundle="magento2.inspection" groupKey="inspection.group.name" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you!
src/com/magento/idea/magento2plugin/inspections/xml/PreferenceDeclarationInspection.java
Show resolved
Hide resolved
|
||
private static final String ARGUMENT_VALUE_IS_EMPTY = | ||
"inspection.error.idAttributeCanNotBeEmpty"; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Iamwade, do we really need extra empty lines after each constant property?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you!
* Test for an error for the "type" attribute because it is empty. | ||
* <preference for="" type="Foo\Bar\Model\Logger"/> | ||
*/ | ||
public void testAttrArgForValuesIsEmpty() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Iamwade, sorry, but I cannot understand this...you are testing type attribute, but method annotation, description, name and test data file name says that you are testing For attribute. Could you check it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you!
tests/com/magento/idea/magento2plugin/inspections/xml/PreferenceDeclarationInspectionTest.java
Show resolved
Hide resolved
tests/com/magento/idea/magento2plugin/inspections/xml/PreferenceDeclarationInspectionTest.java
Show resolved
Hide resolved
|
||
final String typeAttrIsEmptyMessage = inspectionBundle.message( | ||
ARGUMENT_VALUE_IS_EMPTY, | ||
ModuleDiXml.PREFERENCE_ATTR_FOR |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Iamwade, check it, please. (the reason the same as for previous methods)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you!
@bohdan-harniuk |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hello, @Iamwade! I've left one more comment in your PR. Please, check it.
testData/inspections/xml/PreferenceDeclarationInspection/classAttrForDoesNotExists/di.xml
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Iamwade, thank you for your work here!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
454c97a
to
084b53a
Compare
@VitaliyBoyko a bug when removing an attribute value has been fixed. In the process of fixing this error, I found this error for the tag in the file |
Description (*)

Added inspection to the di.xml file for preference.
The inspection is performed for preference attributes "for" and "type".
If the class in the specified path for these attributes does not exist, then the corresponding warning will be displayed
Fixed Issues (if relevant)
Contribution checklist (*)