Skip to content

Cleaned up duplicate variable assignments in the same line #28085

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

Closed

Conversation

bgorski
Copy link
Contributor

@bgorski bgorski commented May 3, 2020

Description (*)

This is a simple cleanup of two assignments to the same variable occurring in the same line.
Created by using the following regex:
($.*) = \1 = (with space before to exclude things like self::$loader = $loader = new \Composer\Autoload\ClassLoader(); and with space after to make sure it's an assignment and not anything else like ===)
And replacing with:
$1 = (also with space before and after to keep the formatting right)

Related Pull Requests

Fixed Issues (if relevant)

Manual testing scenarios (*)

none required

Questions or comments

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 unit/integration tests (if applicable)
  • All automated tests passed successfully (all builds are green)

@m2-assistant
Copy link

m2-assistant bot commented May 3, 2020

Hi @bgorski. Thank you for your contribution
Here is some useful tips how you can test your changes using Magento test environment.
Add the comment under your pull request to deploy test or vanilla Magento instance:

  • @magento give me test instance - deploy test instance based on PR changes
  • @magento give me 2.4-develop instance - deploy vanilla Magento instance

For more details, please, review the Magento Contributor Guide documentation.

@aleron75
Copy link
Contributor

aleron75 commented May 3, 2020

Hello @bgorski thank you for your contribution!

Can you please take a look at the failed static test report to check what's wrong with it?

I'm pretty sure the test doesn't fail because of your changes but because of legacy code. If you can apply suggested cleanup it would be very useful.

Thank you!
Alessandro

@bgorski
Copy link
Contributor Author

bgorski commented May 4, 2020

@aleron75 thank you for assigning yourself to this PR. All those issues were indeed legacy code that just happened to be in the same files I edited.
I fixed most of them, but decided to leave three of them intact:

  • two instances of "Avoid function calls in a FOR loop test part" warnings
  • one instance of "The use of function md5() is forbidden" error

Those would require some refactoring that I haven't exactly had in mind when creating this simple contribution - and as you suspected they're not new things generated by code changes from this PR. Do you think leaving them would be an issue?

@aleron75
Copy link
Contributor

aleron75 commented May 4, 2020

Do you think leaving them would be an issue?

it is indeed because if tests don't pass the PR can't be merged.

Do you think you can fix those failing tests?

Best.
Alessandro

Copy link
Contributor

@VladimirZaets VladimirZaets left a comment

Choose a reason for hiding this comment

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

Hi @bgorski. Thanks for collaboration. Can you please fix failed tests?

@engcom-Charlie
Copy link
Contributor

Hi @bgorski, I'm closing this PR now due to inactivity.
Please reopen and update if you wish to continue.
Thank you for your collaboration.

@m2-assistant
Copy link

m2-assistant bot commented Jul 21, 2020

Hi @bgorski, thank you for your contribution!
Please, complete Contribution Survey, it will take less than a minute.
Your feedback will help us to improve contribution process.

@bgorski
Copy link
Contributor Author

bgorski commented Sep 20, 2020

I'm not sure how to reopen this. I'll create a new PR.

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.

5 participants