Upgrading Magento themes can be horrible at times, especially when overrides were added too easily in the past. To lighten the workload, I have created a Yireo_ThemeOverrideChecker CLI that helps you judge the nature of those overrides.
There are already other tools out there, like the ampersand-magento2-upgrade-patch-helper, that allow you to analyse the health of your Magento instance, by detecting the number of overrides. This is helpful, but it still requires you to do the analysis. For instance, in the Ampersand helper, PHTML template overrides are reported. But there is no analysis whether that's being good or bad.
Say that a PHTML template is copied from the parent to the child, but nothing is modified - it's just a stupid file copy. This should trigger an error - the override is not needed. Or when the number of lines in the PHTML template being different is minimal? This should trigger a warning - somebody needs to inspect the file and try to get rid of the override.
Analysing the impact of those overrides
This is where the Yireo_ThemeOverrideChecker comes in. It offers a command
yireo:theme-overrides:check that lists all files in a given theme and then shows additional advice for them: Is it just a file that needs to be there (like a license,
composer.json)? Or is it an override (XML, PHTML, JS, CSS, image) that requires further inspection?
To judge whether an existing override makes sense, the module adds logic that is still kind of hard to battle with: It compares the number of lines to see if there is anything up. It also compares the number of lines that are actually different. And it tries to work with diff-based logic. It still feels a bit fuzzy all-in-all, but the main point is that the report already makes an analysis, so that you - as a developer tasked to upgrade a theme - have less to do.
bin/magento yireo:theme-overrides:show and
bin/magento yireo:theme-overrides:diff allow you to zoom into a specific file to check upon its details.
Try it out: yireo/Yireo_ThemeOverrideChecker