Skip to content

Commit

Permalink
Implement 'meaningful' checks to email html (#111)
Browse files Browse the repository at this point in the history
Implement "meaningful" checks for `.html` email templates.

In this case `vendor/ampersand/upgrade-patch-helper-test-module/src/module/view/frontend/email/ignore.html` had some changes that were a comment or whitespace, so not worth actually reporting. It's flagged as ignored and hidden by default.
```
| IGNR  | Override (phtml/js/html) | vendor/ampersand/upgrade-patch-helper-test-module/src/module/view/frontend/email/ignore.html                                       | app/design/frontend/Ampersand/theme/Ampersand_TestVendor/email/ignore.html                                                         |
```

In this case `vendor/ampersand/upgrade-patch-helper-test-module/src/module/view/frontend/email/redundant.html` had some changes made to it, and the contents now equate to `app/design/frontend/Ampersand/theme/Ampersand_TestVendor/email/redundant.html` so the local `app/design` copy is redundant and can be removed.

```
| WARN  | Redundant Override       | vendor/ampersand/upgrade-patch-helper-test-module/src/module/view/frontend/email/redundant.html                                    | app/design/frontend/Ampersand/theme/Ampersand_TestVendor/email/redundant.html                                                      |
```
  • Loading branch information
convenient authored Nov 1, 2023
1 parent aecc6ab commit fe63dc1
Show file tree
Hide file tree
Showing 13 changed files with 49 additions and 15 deletions.
2 changes: 2 additions & 0 deletions dev/Docker/setup-magento-with-diff.sh
Original file line number Diff line number Diff line change
Expand Up @@ -117,9 +117,11 @@ echo "<!-- --><p>some change</p>" >> vendor/magento/module-ui/view/base/web/tem

# Redundant override
echo " " >> vendor/ampersand/upgrade-patch-helper-test-module/src/theme/Magento_Ui/web/templates/redundant.html
echo " " >> vendor/ampersand/upgrade-patch-helper-test-module/src/module/view/frontend/email/redundant.html

# Ignored change
echo "<!-- -->" >> vendor/ampersand/upgrade-patch-helper-test-module/src/theme/Magento_Ui/web/templates/ignore.html
echo "<!-- -->" >> vendor/ampersand/upgrade-patch-helper-test-module/src/module/view/frontend/email/ignore.html

echo "#" >> vendor/magento/module-customer/view/frontend/web/js/model/authentication-popup.js

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<h1>some override</h1>
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<div>

<!---- some comment is here -->
<h1>redundant</h1>





</div>
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<h1>ignore this</h1>
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<div>

<!---- some type of comment is here -->
<h1>redundant</h1>
</div><!--- -->
5 changes: 3 additions & 2 deletions dev/phpunit/functional/expected_output/magentom23.out.txt
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,10 @@
| WARN | Preference | vendor/magento/module-authorizenet/Model/Directpost.php | Ampersand\Test\Model\WebApiSoap\Directpost |
| WARN | Preference Removed | vendor/ampersand/upgrade-patch-helper-test-module/src/module/Model/ToPreferenceAndDelete.php | Ampersand\Test\Model\ToPreferenceAndDelete |
| WARN | Preference Removed | vendor/ampersand/upgrade-patch-helper-test-module/src/module/Model/ToPreferenceAndExtendAndDelete.php | Ampersand\Test\Model\ToPreferenceAndExtendAndDelete |
| WARN | Redundant Override | vendor/ampersand/upgrade-patch-helper-test-module/src/module/view/frontend/email/redundant.html | app/design/frontend/Ampersand/theme/Ampersand_TestVendor/email/redundant.html |
| WARN | Redundant Override | vendor/ampersand/upgrade-patch-helper-test-module/src/theme/Magento_Ui/web/templates/redundant.html | app/design/frontend/Ampersand/theme/Magento_Ui/web/templates/redundant.html |
+-------+--------------------------+------------------------------------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------+
WARN count: 63
WARN count: 64
INFO count: 309 (to view re-run this tool with --show-info)
IGNORE count: 1 (to view re-run this tool with --show-ignore)
IGNORE count: 2 (to view re-run this tool with --show-ignore)
For docs on each check see https://github.com/AmpersandHQ/ampersand-magento2-upgrade-patch-helper/blob/master/docs/CHECKS_AVAILABLE.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,10 @@
| WARN | Preference | vendor/magento/module-authorizenet/Model/Directpost.php | Ampersand\Test\Model\WebApiSoap\Directpost |
| WARN | Preference Removed | vendor/ampersand/upgrade-patch-helper-test-module/src/module/Model/ToPreferenceAndDelete.php | Ampersand\Test\Model\ToPreferenceAndDelete |
| WARN | Preference Removed | vendor/ampersand/upgrade-patch-helper-test-module/src/module/Model/ToPreferenceAndExtendAndDelete.php | Ampersand\Test\Model\ToPreferenceAndExtendAndDelete |
| WARN | Redundant Override | vendor/ampersand/upgrade-patch-helper-test-module/src/module/view/frontend/email/redundant.html | app/design/frontend/Ampersand/theme/Ampersand_TestVendor/email/redundant.html |
| WARN | Redundant Override | vendor/ampersand/upgrade-patch-helper-test-module/src/theme/Magento_Ui/web/templates/redundant.html | app/design/frontend/Ampersand/theme/Magento_Ui/web/templates/redundant.html |
+-------+--------------------------+------------------------------------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------+
WARN count: 64
WARN count: 65
INFO count: 314 (to view re-run this tool with --show-info)
IGNORE count: 1 (to view re-run this tool with --show-ignore)
IGNORE count: 2 (to view re-run this tool with --show-ignore)
For docs on each check see https://github.com/AmpersandHQ/ampersand-magento2-upgrade-patch-helper/blob/master/docs/CHECKS_AVAILABLE.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,10 @@
| WARN | Preference | vendor/magento/module-weee/Model/Total/Quote/Weee.php | Ampersand\Test\Model\WebApiSoap\Total\Quote\Weee |
| WARN | Preference Removed | vendor/ampersand/upgrade-patch-helper-test-module/src/module/Model/ToPreferenceAndDelete.php | Ampersand\Test\Model\ToPreferenceAndDelete |
| WARN | Preference Removed | vendor/ampersand/upgrade-patch-helper-test-module/src/module/Model/ToPreferenceAndExtendAndDelete.php | Ampersand\Test\Model\ToPreferenceAndExtendAndDelete |
| WARN | Redundant Override | vendor/ampersand/upgrade-patch-helper-test-module/src/module/view/frontend/email/redundant.html | app/design/frontend/Ampersand/theme/Ampersand_TestVendor/email/redundant.html |
| WARN | Redundant Override | vendor/ampersand/upgrade-patch-helper-test-module/src/theme/Magento_Ui/web/templates/redundant.html | app/design/frontend/Ampersand/theme/Magento_Ui/web/templates/redundant.html |
+-------+--------------------------+------------------------------------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------+
WARN count: 59
WARN count: 60
INFO count: 395 (to view re-run this tool with --show-info)
IGNORE count: 1 (to view re-run this tool with --show-ignore)
IGNORE count: 2 (to view re-run this tool with --show-ignore)
For docs on each check see https://github.com/AmpersandHQ/ampersand-magento2-upgrade-patch-helper/blob/master/docs/CHECKS_AVAILABLE.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
| WARN | Preference | vendor/magento/module-weee/Model/Total/Quote/Weee.php | Ampersand\Test\Model\WebApiSoap\Total\Quote\Weee |
| WARN | Preference Removed | vendor/ampersand/upgrade-patch-helper-test-module/src/module/Model/ToPreferenceAndDelete.php | Ampersand\Test\Model\ToPreferenceAndDelete |
| WARN | Preference Removed | vendor/ampersand/upgrade-patch-helper-test-module/src/module/Model/ToPreferenceAndExtendAndDelete.php | Ampersand\Test\Model\ToPreferenceAndExtendAndDelete |
| WARN | Redundant Override | vendor/ampersand/upgrade-patch-helper-test-module/src/module/view/frontend/email/redundant.html | app/design/frontend/Ampersand/theme/Ampersand_TestVendor/email/redundant.html |
| WARN | Redundant Override | vendor/ampersand/upgrade-patch-helper-test-module/src/theme/Magento_Ui/web/templates/redundant.html | app/design/frontend/Ampersand/theme/Magento_Ui/web/templates/redundant.html |
| INFO | DB schema added | vendor/magento/module-admin-adobe-ims/etc/db_schema.xml | admin_adobe_ims_webapi |
| INFO | DB schema added | vendor/magento/module-catalog/etc/db_schema.xml | catalog_compare_list |
Expand Down Expand Up @@ -455,9 +456,10 @@
| INFO | Setup Patch Data | vendor/ampersand/upgrade-patch-helper-test-module/src/module/Setup/Patch/Data/SomeDataChanges.php | Ampersand\TestVendor\Setup\Patch\Data\SomeDataChanges |
| INFO | Setup Patch Schema | vendor/ampersand/upgrade-patch-helper-test-module/src/module/Setup/Patch/Schema/SomeSchemaChanges.php | Ampersand\TestVendor\Setup\Patch\Schema\SomeSchemaChanges |
| INFO | Setup Script | vendor/ampersand/upgrade-patch-helper-test-module/src/module/Setup/InstallSchema.php | Ampersand\TestVendor\Setup\InstallSchema |
| IGNR | Override (phtml/js/html) | vendor/ampersand/upgrade-patch-helper-test-module/src/module/view/frontend/email/ignore.html | app/design/frontend/Ampersand/theme/Ampersand_TestVendor/email/ignore.html |
| IGNR | Override (phtml/js/html) | vendor/ampersand/upgrade-patch-helper-test-module/src/theme/Magento_Ui/web/templates/ignore.html | app/design/frontend/Ampersand/theme/Magento_Ui/web/templates/ignore.html |
+-------+--------------------------+------------------------------------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------+
WARN count: 59
WARN count: 60
INFO count: 395
IGNORE count: 1
IGNORE count: 2
For docs on each check see https://github.com/AmpersandHQ/ampersand-magento2-upgrade-patch-helper/blob/master/docs/CHECKS_AVAILABLE.md
5 changes: 3 additions & 2 deletions dev/phpunit/functional/expected_output/magentom24.out.txt
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,10 @@
| WARN | Preference | vendor/magento/module-weee/Model/Total/Quote/Weee.php | Ampersand\Test\Model\WebApiSoap\Total\Quote\Weee |
| WARN | Preference Removed | vendor/ampersand/upgrade-patch-helper-test-module/src/module/Model/ToPreferenceAndDelete.php | Ampersand\Test\Model\ToPreferenceAndDelete |
| WARN | Preference Removed | vendor/ampersand/upgrade-patch-helper-test-module/src/module/Model/ToPreferenceAndExtendAndDelete.php | Ampersand\Test\Model\ToPreferenceAndExtendAndDelete |
| WARN | Redundant Override | vendor/ampersand/upgrade-patch-helper-test-module/src/module/view/frontend/email/redundant.html | app/design/frontend/Ampersand/theme/Ampersand_TestVendor/email/redundant.html |
| WARN | Redundant Override | vendor/ampersand/upgrade-patch-helper-test-module/src/theme/Magento_Ui/web/templates/redundant.html | app/design/frontend/Ampersand/theme/Magento_Ui/web/templates/redundant.html |
+-------+--------------------------+------------------------------------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------+
WARN count: 57
WARN count: 58
INFO count: 395 (to view re-run this tool with --show-info)
IGNORE count: 1 (to view re-run this tool with --show-ignore)
IGNORE count: 2 (to view re-run this tool with --show-ignore)
For docs on each check see https://github.com/AmpersandHQ/ampersand-magento2-upgrade-patch-helper/blob/master/docs/CHECKS_AVAILABLE.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,10 @@
| WARN | Preference | vendor/magento/module-weee/Model/Total/Quote/Weee.php | Ampersand\Test\Model\WebApiSoap\Total\Quote\Weee |
| WARN | Preference Removed | vendor/ampersand/upgrade-patch-helper-test-module/src/module/Model/ToPreferenceAndDelete.php | Ampersand\Test\Model\ToPreferenceAndDelete |
| WARN | Preference Removed | vendor/ampersand/upgrade-patch-helper-test-module/src/module/Model/ToPreferenceAndExtendAndDelete.php | Ampersand\Test\Model\ToPreferenceAndExtendAndDelete |
| WARN | Redundant Override | vendor/ampersand/upgrade-patch-helper-test-module/src/module/view/frontend/email/redundant.html | app/design/frontend/Ampersand/theme/Ampersand_TestVendor/email/redundant.html |
| WARN | Redundant Override | vendor/ampersand/upgrade-patch-helper-test-module/src/theme/Magento_Ui/web/templates/redundant.html | app/design/frontend/Ampersand/theme/Magento_Ui/web/templates/redundant.html |
+-------+--------------------------+------------------------------------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------+
WARN count: 59
WARN count: 60
INFO count: 384 (to view re-run this tool with --show-info)
IGNORE count: 1 (to view re-run this tool with --show-ignore)
IGNORE count: 2 (to view re-run this tool with --show-ignore)
For docs on each check see https://github.com/AmpersandHQ/ampersand-magento2-upgrade-patch-helper/blob/master/docs/CHECKS_AVAILABLE.md
Loading

0 comments on commit fe63dc1

Please sign in to comment.