-
-
Notifications
You must be signed in to change notification settings - Fork 2
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
build artifacts are erroneously skipped for unusual directory structures #38
Comments
@sassman I already had the chance to look into the code and I suspect that the issue is caused by this code. Using I would be open to contribute a fix, but I think a good fix would require some refactoring upfront. Would you be open for that? 👀 |
I think you're right. This is the root cause of the issue, because the folder should actually not be skipped because it is not the one that is going to be removed. It's a sub folder of it that is going to be removed. This is what the rule checks. Also, I think this would not require a refactoring. |
Yes, that would indeed solve scenario 1, but implementing this will definitely require some kind of refactoring. Ignoring the to-be-removed child dir of our current Additionally, this solution still wouldn't fix scenario 2. As of now, the A clean solution to both problems could be to refactor fn should_remove(&self, folder: impl AsRef<Path>) -> bool Then we could check if the current folder should be removed, instead of checking if the current folder is a parent of something that should be removed. I hope my explanation does make sense, and thanks again for looking into this. :-) |
Sure it makes sense. As an alternative approach the function that does check could return the (sub)folder that was the one going to be removed. In the folder walk we could keep track of any returned folder as a list of deletion and check in every dive down if we got a folder that is on this delete list. If so that's the one we gonna skip then. |
While using
putzen-rs
, I noticed two edge-cases where the tool does not delete all build artifacts right away, so I have to re-run the tool a couple of times to get all files deleted. The expected behavior would be that all build artifacts are deleted in the very first run ofputzen -y
.Scenario 1: Nested Projects
Running
putzen -y
against this folder structure will only deletefoo/node_modules/
. IMO, it should also deletefoo/bar/node_modules/
. The tool may skip further processing forfoo/node_modules/
as this folder is deleted anyway, but it seems like there is a bug which causesfoo/
to be skipped instead.Scenario 2: Bulky Projects
Running
putzen -y
against this folder structure will only deletebaz/target/
, but it will skipbaz/node_modules/
for reasons similar to those mentioned above.The text was updated successfully, but these errors were encountered: