makandra / makandra-rubocop

makandra's default Rubocop configuration
MIT License
6 stars 1 forks source link

Upgrade to rubocop 1.60.0 and rubocop-rails 2.23.1 #44

Closed foobear closed 5 months ago

foobear commented 6 months ago

Upgrade to support Ruby 3.3 and Rails 7.1.

Newly introduced cops

The upgrade introduces several new cops.

All of them were set to Enabled: pending in the default Rubocop configuration. Since we set NewCops: enable this means all pending cops are enabled, i.e. the same as if we'd explicitly set them to Enabled: true. We do not want to set Enabled: true for all of them to avoid merge conflicts when upgrading later.

I reviewed all new cops and disabled those which I believe do not provide enough benefit and/or do not match our preferred code styles:

Warning from Style/ArgumentsForwarding cop

Annoyingly, in a Ruby 3.3 application, Rubocop prints a warning:

Warning: obsolete parameter `AllowOnlyRestArgument` (for `Style/ArgumentsForwarding`) found in .../config/default.yml
`AllowOnlyRestArgument` has no effect with TargetRubyVersion >= 3.2.

I am not sure how to resolve that properly. The parameter is also included in the default configuration, so I assume that is just how Rubocop behaves when it's set from another file. When removing it from our default.yml, Rubocop will not print the warning, but I don't know if its default AllowOnlyRestArgument: true still applies. Maybe we don't need to care. Instead of removing that line, we could comment it out and leave a comment about why. Would help with future upgrades.

Jan 3 update: I went ahead with commenting out the AllowOnlyRestArgument option and left a comment explaining why.

What about rubocop-rspec?

I did not upgrade rubocop-rspec as there seem to be some configuration changes between rubocop-rspec and rubocop-capybara now. Did not investigate further.

foobear commented 5 months ago

Reverted disabling Style/MinMaxComparison, it's now explicitly enabled.

Rubocop 1.60.0 has been released on Monday; I'll look into upgrading to 1.60.0 now.

foobear commented 5 months ago

Upgraded to 1.16.0, fixed some quirks in previous commits and prepared changelog.

Will merge and release as version 12.0.0.