Skip to content

Upgrade rubocop from v1.84.0 to v1.84.2, update config, and correct offences#37795

Open
larouxn wants to merge 1 commit intomastodon:mainfrom
larouxn:rubocop_1.84.1
Open

Upgrade rubocop from v1.84.0 to v1.84.2, update config, and correct offences#37795
larouxn wants to merge 1 commit intomastodon:mainfrom
larouxn:rubocop_1.84.1

Conversation

@larouxn
Copy link
Contributor

@larouxn larouxn commented Feb 10, 2026

Upgrade rubocop gem from v1.84.0 to v1.84.2, update Layout RuboCop config, and correct offences.

References

Supersedes #37710

@ClearlyClaire
Copy link
Contributor

There are two cops involved:

@larouxn
Copy link
Contributor Author

larouxn commented Feb 10, 2026

Good catch and agreed with the cop config choices. That said, I think we'll need to wait for 1.84.2 as there are errors occurring with the cops above. Thankfully fixes have already been merged to RuboCop master. Marking as draft until 1.84.2 is released.

RuboCop 1.84.1 (errors)

image

RuboCop head (no more errors)

image

@larouxn larouxn changed the title Upgrade rubocop gem from v1.84.0 to v1.84.1 and correct offences [waiting for v1.84.2] Upgrade rubocop gem from v1.84.0 to v1.84.1 and correct offences Feb 10, 2026
@larouxn larouxn marked this pull request as draft February 10, 2026 15:35
@larouxn larouxn changed the title [waiting for v1.84.2] Upgrade rubocop gem from v1.84.0 to v1.84.1 and correct offences [waiting for v1.84.2] Upgrade rubocop from v1.84.0 to v1.84.1, update config, and correct offences Feb 10, 2026
@mjankowski mjankowski added dependencies Pull requests that update a dependency file ruby Pull requests that update Ruby code lint fix 💅 labels Feb 10, 2026
@larouxn
Copy link
Contributor Author

larouxn commented Feb 12, 2026

v1.84.2 is out, rebasing and updating this PR.

https://github.com/rubocop/rubocop/releases/tag/v1.84.2

@larouxn larouxn changed the title [waiting for v1.84.2] Upgrade rubocop from v1.84.0 to v1.84.1, update config, and correct offences Upgrade rubocop from v1.84.0 to v1.84.2, update config, and correct offences Feb 12, 2026
@larouxn larouxn marked this pull request as ready for review February 12, 2026 14:09
@mjankowski
Copy link
Contributor

I don't feel strongly about this, but FWIW, the autocorrect changes here for that rule:

  • Leave default of aligned - 23 corrections
  • Change to indented - 86 corrections
  • Change to indented_relative_to_receiver - 961 corrections

I have a small personal bias towards "indented" (which reduces overall PR alignment churn when you rename a var or method or something in the line above indentations) ... but mostly just wanted to show the file impact of each option there.

@larouxn
Copy link
Contributor Author

larouxn commented Feb 12, 2026

For stylistic reference here are the three different options. I feel indented is probably the most "default looking Ruby" as far as chaining .method calls is concerned but aligned and indented_relative_to_receiver both read a bit clearer as the calls are closer to the call above/receiver.

# app/controllers/api/v1/mutes_controller.rb#L19-L29
# aligned i.e. default
def paginated_mutes
  @paginated_mutes ||= Mute.eager_load(target_account: [:account_stat, :user])
                            .joins(:target_account)
                            .merge(Account.without_suspended)
                            .where(account: current_account)
                            .paginate_by_max_id(
                              limit_param(DEFAULT_ACCOUNTS_LIMIT),
                              params[:max_id],
                              params[:since_id]
                            )
end

# indented
def paginated_mutes
  @paginated_mutes ||= Mute.eager_load(target_account: [:account_stat, :user])
    .joins(:target_account)
    .merge(Account.without_suspended)
    .where(account: current_account)
    .paginate_by_max_id(
      limit_param(DEFAULT_ACCOUNTS_LIMIT),
      params[:max_id],
      params[:since_id]
    )
end

# indented_relative_to_receiver
def paginated_mutes
  @paginated_mutes ||= Mute.eager_load(target_account: [:account_stat, :user])
                          .joins(:target_account)
                          .merge(Account.without_suspended)
                          .where(account: current_account)
                          .paginate_by_max_id(
                            limit_param(DEFAULT_ACCOUNTS_LIMIT),
                            params[:max_id],
                            params[:since_id]
                          )
end

I think I prefer indented_relative_to_receiver stylistically but it's a good point regarding alignment churn.

@ClearlyClaire
Copy link
Contributor

oof, that's a lot of changes in either cases, and I'm surprised that so many of the issues would flare up in a patch release 🤔

I'm definitely fine with the Layout/IndentationWidth fixes but I'm honestly not quite sure how to proceed with Layout/MultilineMethodCallIndentation

@larouxn
Copy link
Contributor Author

larouxn commented Feb 13, 2026

oof, that's a lot of changes in either cases, and I'm surprised that so many of the issues would flare up in a patch release 🤔

Yeah, I suppose the cops causing these changes were really quite busted/not running in prior releases.

Looking at Layout/MultilineMethodCallIndentation, as pointed out by Matt above #37795 (comment) if we go with the indented we end up with both a reasonable number of changes and we will also avoid large indentation based diffs every time we rename something i.e. better/cleaner maintainability. Thus, for those reasons, I propose we go with indented for Layout/MultilineMethodCallIndentation.

Suppose I'm also a bit of a fan of indented as to me "next line, two spaces in" looks like idiomatic Ruby style.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dependencies Pull requests that update a dependency file lint fix 💅 ruby Pull requests that update Ruby code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants