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

bundle update rubocop --conservative #50515

Merged
merged 2 commits into from
Jan 2, 2024
Merged

Conversation

skipkayhil
Copy link
Member

@skipkayhil skipkayhil commented Jan 1, 2024


When attempting to update Gemfile.lock for Ruby 3.3.0 (#50516), there were a few new warnings raised by RuboCop. This commit splits out just the RuboCop update with fixes for the new warnings introduced.

@@ -1694,7 +1694,7 @@ def test_route_with_subdomain_and_constraints_must_receive_params
set.draw do
get "page/:name" => "pages#show", :constraints => lambda { |request|
name_param = request.params[:name]
return true
true
Copy link
Member

Choose a reason for hiding this comment

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

Don't like this rule.

Copy link
Member Author

@skipkayhil skipkayhil Jan 1, 2024

Choose a reason for hiding this comment

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

(linking for context) Style/RedundantReturn was enabled in 146b1c2 after #31004 was merged

Copy link
Member

Choose a reason for hiding this comment

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

Guess that's why I'd be keen to get Rails under omakase style too.

@@ -784,7 +784,7 @@ def link_to_remote_options?(options)
end

def add_method_to_attributes!(html_options, method)
if method_not_get_method?(method) && !html_options["rel"]&.match?(/nofollow/)
if method_not_get_method?(method) && !html_options["rel"]&.include?("nofollow")
Copy link
Member

Choose a reason for hiding this comment

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

This also seems like an odd choice. Maybe fine but it's in the wrong PR.

Copy link
Member Author

Choose a reason for hiding this comment

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

(linking for context) Performance/StringInclude was enabled in #45865

Copy link
Member

Choose a reason for hiding this comment

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

Gotcha. Not sure about this one either! But yes, should be in compliance with the rules as they currently are. Just think that needs to happen in a clear PR separate from a dependency bump.

@skipkayhil
Copy link
Member Author

Maybe fine but it's in the wrong PR.

I'm not sure I understand the reasoning here. The rules are already being enforced but bumping RuboCop is bringing in bug fixes that cause these two code changes to only be warned on now.

@dhh
Copy link
Member

dhh commented Jan 1, 2024

The dependency bump is broad, bumps all sorts of stuff. The new rubocop rules are specific, and should just get their own explaining PR. Or you can split the dep bump into "just rubocop, plus new rules" and "everything else".

@skipkayhil
Copy link
Member Author

skipkayhil commented Jan 1, 2024

The dependency bump is broad, bumps all sorts of stuff. The new rubocop rules are specific, and should just get their own explaining PR. Or you can split the dep bump into "just rubocop, plus new rules" and "everything else".

Got it, the transitive dependencies are being bumped as well but really we should bump the minimum (only rubocop/rubocop-performance) to trigger these violations to fix. I'll make that change 👍

Also perform two autocorrects with `bundle exec rubocop -A`:

- fixes a new case of [`Style/RedundantReturn`][1]
- fixes a new case of [`Performance/StringInclude`][2]

[1]: 146b1c2
[2]: 3158bbb
@skipkayhil skipkayhil changed the title bundle update rubocop bundle update rubocop --conservative Jan 1, 2024
* main:
  Add a default yield :head to layouts/application.html.erb (rails#50527)
  Switch to new enum syntax in example code [ci-skip]
  Utilize new enum syntax
  Apply autocorrection by RuboCop to files generated by `bin/rails generate` (rails#50506)
  Add brakeman as development dependency
  Fix skipped rubocop test typo (rails#50519)
  Update the puma startup message
  docs: remove unneeded whitespace from start of code blocks
  Add changelog entry for rails#50512
  Remove unnecessary require
  Fix railspect not validating alphabetical order
@dhh dhh merged commit 90da071 into rails:main Jan 2, 2024
3 of 4 checks passed
dhh added a commit that referenced this pull request Jan 2, 2024
* main:
  Fix test
  Allow overriding SQLite defaults from `database.yml` (#50460)
  Fix a flaky test in `query_assertions_test.rb` (#50503)
  Document apply_rubocop_autocorrect_after_generate! in configuration guide (#50532)
  bundle update rubocop --conservative (#50515)
@skipkayhil skipkayhil deleted the hm-bump-rubocop branch January 2, 2024 14:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants