-
Notifications
You must be signed in to change notification settings - Fork 39
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
Don't report files with non-meaningful code changes #13
Comments
Hey @hostep This is a very interesting idea. Skirting around the edges of making this tool have sort of semantic diff functionality? The copyright header was a massive pain wasn't it. All of our projects have bypassed that version so I'm thankful we won't have to deal with it again. As far as actually implementing something like this... In the We already have the individual lines removed/added. We could refactor this around a bit and add rules for getting the modified lines and getting the "meaningful" modified lines. ampersand-magento2-upgrade-patch-helper/src/Ampersand/PatchHelper/Patchfile/Entry.php Lines 153 to 164 in ddcaf26
We could then use this function in public function validate()
{
+ if (!$this->patchEntry->isMeaningful()) { return true; }
switch (pathinfo($this->vendorFilepath, PATHINFO_EXTENSION)) {
case 'php':
$this->validatePhpFileForPreferences();
$this->validatePhpFileForPlugins(); I think the big issue is "what is meaningful?" I know docblock params are used by the swagger api so selectively ignoring them may be tricky. I'm not sure how i'd feel if this tool became too opinionated about the diffs in this manner, but i'd be all for having it as a We should probably just double check that there's not a better term than Let me know if you have any further thoughts. I won't be getting a chance to look at this feature in the foreseeable future so will add an appropriate label to this issue. Thanks for the feedback 👌 |
Hi!
I recently was involved in a Magento upgrade from 2.1.12 to 2.1.16
In 2.1.13, Magento changed all copyright headers in all the files. This change is not important for comparing changes between versions of Magento. So files where only this copyright header got changed should not be outputted.
Some example files:
vendor/magento/module-catalog/Model/ResourceModel/Eav/Attribute.php
: 2.1.12 vs 2.1.16vendor/magento/module-catalog/view/base/templates/product/price/final_price.phtml
: 2.1.12 vs 2.1.16diff:
Another one which can be observed between Magento 2.1.x and 2.2.x are those php short tags in phtml files. Where it has changed from
<?php echo ...
to<?= ...
.For example in:
vendor/magento/module-catalog/view/frontend/templates/product/list/toolbar.phtml
2.1.16 vs 2.2.7diff:
Also notice the extra
;
which was removed in the first diff line (is also non-meaningful in this case)But those
escapeNotVerified
comments (which exist in a couple of different forms) might make things more complex.Would it somehow be possible to ignore these non-meaningful code changes?
Some patterns which I think can be ignored:
-w
flag to the diff command?)<?php echo ...
vs<?= ...
in phtml files;
at the end of a single php line in phtml filesNot sure how easy it is for something like this to be implemented?
The text was updated successfully, but these errors were encountered: