Skip to content

Changed new module dialog validator #318

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
merged 6 commits into from
Oct 22, 2020

Conversation

drpayyne
Copy link
Contributor

@drpayyne drpayyne commented Oct 20, 2020

Description

This PR adds validation through annotations to the new module dialog and removes the unnecessary com.magento.idea.magento2plugin.actions.generation.dialog.validator.NewModuleDialogValidator.

Fixed Issues

  1. Change validation for the new module dialog window #301: Change validation for the new module dialog window

Questions or comments

There is one validation pending to be refactored into the annotation-type. I have addressed that below. Please advise on how to proceed on that. Thanks!

Contribution checklist

  • Pull request has a meaningful description of its purpose
  • All commits are accompanied by meaningful commit messages
  • All new or changed code is covered with integration/functional tests (if applicable)
  • All automated tests passed successfully (all builds are green)

Comment on lines -140 to -153
if (moduleName.equals(packageName)) {
final String errorMessage = validatorBundle.message(
"validator.moduleNameIsTheSameAsPackage",
MODULE_NAME
);
JOptionPane.showMessageDialog(
null,
errorMessage,
errorTitle,
JOptionPane.ERROR_MESSAGE
);

return false;
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This exists to check if the module name and package name are identical and throws an error if so.

  • Do we need this check?
  • How do we perform this through annotations? Module name field validation needs to access the package name to compare.

I'm unsure on how to proceed with this. Please advise. Thanks!

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There no system restrictions to call module e.g Vendor_Vendor.
However, this is wrong from the best practices standpoint.

@bohdan-harniuk
How do you think it can be implemented?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I understand @VitaliyBoyko, but just to note: a few modules which I noticed that have the same vendor and module name

  • elasticsearch/elasticsearch
  • container-interop/container-interop
  • cache/cache
  • mockery/mockery

@drpayyne drpayyne changed the title Issue 301 Changed new module dialog validator Oct 20, 2020
Copy link
Contributor

@VitaliyBoyko VitaliyBoyko left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Validation error on creating a new module on the vendor directory ⛔
image
image

@drpayyne drpayyne requested a review from VitaliyBoyko October 22, 2020 17:36
@VitaliyBoyko VitaliyBoyko merged commit cafc9db into magento:2.1.0-develop Oct 22, 2020
@drpayyne drpayyne mentioned this pull request Oct 27, 2020
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants