rubocop / rubocop-rspec

Code style checking for RSpec files.
https://docs.rubocop.org/rubocop-rspec
MIT License
794 stars 272 forks source link

Add CI task testing with the oldest RuboCop version allowed by gemspec #1882

Closed bquorning closed 1 month ago

bquorning commented 1 month ago

Fixes: https://github.com/rubocop/rubocop-rspec/pull/1879#issuecomment-2107631095

There is one thing we might be missing - it’s to test our code against our minimum specified rubocop version.


Before submitting the PR make sure the following are checked:

pirj commented 1 month ago

Nice!

can the failure be caused by some default TargetRubyVersion setting for that older RuboCop version? I guess we may have new syntax used in our specs, and conditionally enable those examples, but they won’t parse if the TargetRubyVersion won’t match the RUBY_VERSION. We have no need to test combinations of those two, right? We can just set the TRV to the RV.

bquorning commented 1 month ago

~I guess we may be using a newer RUBY_VERSION than RuboCop can handle. E.g. if we use Ruby 3.3 and RuboCop 1.40 can only handle up to 3.1 or 3.2… Should we then rather test with the oldest Ruby that we support or the most recent Ruby that RuboCop supports?~

It turns out that the issue was fixed by adding :ruby27 metadata to the failing spec. RuboCop v1.40.0 used Ruby 2.6.0 by default when running specs: https://github.com/rubocop/rubocop/blob/v1.40.0/lib/rubocop/rspec/cop_helper.rb#L9

bquorning commented 1 month ago

The problem is fixed; PR is ready for review.