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

RuboCop autofixes for Ruby 3.1 #16337

Closed
wants to merge 5 commits into from

Conversation

issyl0
Copy link
Member

@issyl0 issyl0 commented Dec 14, 2023

  • Have you followed the guidelines in our Contributing document?
  • Have you checked to ensure there aren't other open Pull Requests for the same change?
  • Have you added an explanation of what your changes do and why you'd like us to include them?
  • Have you written new tests for your changes? Here's an example.
  • Have you successfully run brew style with your changes locally?
  • Have you successfully run brew typecheck with your changes locally?
  • Have you successfully run brew tests with your changes locally?

  • As noted in Slack, bumping RuboCop's target Ruby version to the one we actually use now reveals a bunch of improvements, all autofixable.
  • This is draft because I have to change trains now - I'll return to this later.

Copy link
Member

@MikeMcQuaid MikeMcQuaid left a comment

Choose a reason for hiding this comment

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

Thanks @issyl0! If you can make this PR non-draft after CI is 🟢: let's get it merged ASAP. This is going to be much better/easier to handle with lots of smaller PRs (maybe even one commit per PR) than one big PR that grows and stays open for a while.

Library/.rubocop.yml Outdated Show resolved Hide resolved
Library/.rubocop.yml Outdated Show resolved Hide resolved
@issyl0 issyl0 force-pushed the rubocop-fixes-for-ruby-3.1 branch from 7b82b69 to 74d8a9c Compare December 14, 2023 10:47
@issyl0 issyl0 marked this pull request as ready for review December 14, 2023 10:48
@Bo98
Copy link
Member

Bo98 commented Dec 14, 2023

TargetRubyVersion is needed as it controls whether RuboCop thinks this new syntax is valid.

It will also make this a lot less trivial as you will then need to convert every tap and merge them all at the same time. Half why I dumped a Gist link and walked away :-)

@issyl0
Copy link
Member Author

issyl0 commented Dec 14, 2023

Oh, but 2.6 and 3.1 disagree with each other. Joy.

@Bo98
Copy link
Member

Bo98 commented Dec 14, 2023

The easiest way is likely shipping TargetRubyVersion first in its own PR, but with all new cops disabled. And then have a second PR (this one) where you enable the cops. That way the changes can be merged in taps without having a chicken/egg problem.

@issyl0
Copy link
Member Author

issyl0 commented Dec 14, 2023

Yeah, I realised this is bigger than I thought. We can do it though! Somehow.

@issyl0
Copy link
Member Author

issyl0 commented Dec 14, 2023

Good idea. I'll do that soon.

issyl0 added a commit to issyl0/brew that referenced this pull request Dec 14, 2023
- As discussed in
  Homebrew#16337 (comment),
  then we won't have the chicken/egg problem of fixing cops for syntax
  that's unsupported on Ruby 2.6 _before_ we set the TargetRubyVersion
  to 3.1, but if we set it too early then all the taps will fail.
@issyl0 issyl0 closed this Dec 15, 2023
@github-actions github-actions bot added the outdated PR was locked due to age label Jan 15, 2024
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 15, 2024
@issyl0 issyl0 deleted the rubocop-fixes-for-ruby-3.1 branch January 15, 2024 18:38
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
outdated PR was locked due to age
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants