I like to keep my codebase nice and neat.
However; when I run 'drush fu [feature name]' or click the 'Generate Feature' button in the UI I occasionally end up with 'crufty' leftover files. Particularly when removing entire Components from an existing feature.
Steps to reproduce;
1. Create a feature called 'sites/all/modules/features/crufty' and include say a content type and some 'Permissions'.
2. Re-create the feature but remove the Permissions, so that only the content type remains. Overwrite the existing feature using the UI by clicking the 'Generate feature' button, being sure that the path is once again 'sites/all/modules/features/crufty'.
3. Observe that the feature is re-created successfully, but that a file named 'crufty.permissions.inc' remains in the folder.
The patch here seeks to address this by parsing all the files remaining in the folder and validating that they are all in fact required by the feature you just updated.
Comment | File | Size | Author |
---|---|---|---|
#1 | features-remove-cruft-2544920-1.patch | 848 bytes | samtny |
Comments
Comment #1
samtny CreditAttribution: samtny commentedComment #2
hefox CreditAttribution: hefox at Phase2 commentedComment #3
samtny CreditAttribution: samtny commentedComment #4
hefox CreditAttribution: hefox at Phase2 commentedLooking at patch quickly, off top of head -- people can add whatever files they want to a feature, so this can be lot of false positives that might result in people removing files they do need.
Comment #5
samtny CreditAttribution: samtny commentedIs it a common pattern to 'add whatever files they want to a feature'?
My impression was that Features are made up of exportables only, all of which would be accounted for by the patch in #1 (more-or-less).
If someone can point me to a documented use-case of 'whatever files' added to a Feature then I can withdraw this Feature request.
Comment #6
donquixote CreditAttribution: donquixote as a volunteer commentedI have been part of multiple teams where this was/is a common practice.
It is a case we must support.
If we were to do this, we would need a way to better distinguish files owned by features from files created by a user.
And once we have this, we can as well delete the files directly instead of leaving this to a site builder or site developer.
Expecting a developer to clean up manually does not scale.
So I would propose to close this as wontfix and continue here:
#1896528: generate features doesn't delete existing files