Skip to content
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

extend/pathname: import rmtree again. #17329

Merged
merged 1 commit into from
May 20, 2024
Merged

extend/pathname: import rmtree again. #17329

merged 1 commit into from
May 20, 2024

Conversation

MikeMcQuaid
Copy link
Member

The separate file is no longer required now that sorbet/sorbet#7895 was merged.

(if this fails, it'll be that we need a Sorbet version bump first)

Comment on lines +508 to +512
# Ideally we'd odeprecate this but probably can't given gems so let's
# create a RuboCop autocorrect instead soon.
# This is why monkeypatching is non-ideal (but right solution to get
# Ruby 3.3 over the line).
# odeprecated "rmtree", "FileUtils#rm_r"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a comment re the autocorrect: in my experience, use of #rmtree in formulae typically does mean rm_rf, so I wonder if we could avoid the unnecessary code churn, at least for formulae.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We are using both rm_rf and rmtree in formulae currently. Might make sense to only use rm_rf anyways for simplicity and explicitness.

Copy link
Member

@Bo98 Bo98 May 18, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd discourage rm_rf unless you are ok with it not actually removing the directory. rm_r is safer where possible

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in my experience, use of #rmtree in formulae typically does mean rm_rf

Not sure what you mean about this. Do we have code that makes Pathname operations ignore all errors?

Copy link
Member

@Bo98 Bo98 May 18, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh right, I think you are talking about rmtree something rather than something.rmtree. Yes they mean two different things with the former meaning rm_rf and the latter meaning rm_r. Encouraging rm_r something everywhere could make sense.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@carlocab I think there's an argument that this could be the beginning of "monkey patch Pathname everywhere" (as we do today) to "only monkey patch Pathname and similar in formulae/casks and otherwise use things as-is".

I would really like to see us get rid of pretty much all extends of core/stdlib Ruby classes.

The separate file is no longer required now that
sorbet/sorbet#7895 was merged.
@MikeMcQuaid MikeMcQuaid merged commit ea05828 into master May 20, 2024
25 checks passed
@MikeMcQuaid MikeMcQuaid deleted the rmtree branch May 20, 2024 07:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants