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

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

Merged
merged 1 commit into from
May 19, 2024

Conversation

bquorning
Copy link
Collaborator

@bquorning bquorning commented May 19, 2024

Fixes: #1879 (comment)

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:

  • Feature branch is up-to-date with master (if not - rebase it).
  • Squashed related commits together.
  • Added tests.
  • Updated documentation.
  • Added an entry to the CHANGELOG.md if the new code introduces user-observable changes.
  • The build (bundle exec rake) passes (be sure to run this locally, since it may produce updated documentation that you will need to commit).

@bquorning bquorning force-pushed the test-oldest-rubocop branch 2 times, most recently from 24b3393 to 340dce2 Compare May 19, 2024 14:47
@bquorning bquorning changed the title Test oldest rubocop Add CI task testing with the oldest RuboCop version allowed by gemspec May 19, 2024
@bquorning bquorning marked this pull request as ready for review May 19, 2024 14:50
@bquorning bquorning requested a review from a team as a code owner May 19, 2024 14:50
@pirj
Copy link
Member

pirj commented May 19, 2024

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
Copy link
Collaborator Author

bquorning commented May 19, 2024

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
Copy link
Collaborator Author

The problem is fixed; PR is ready for review.

Copy link
Member

@pirj pirj left a comment

Choose a reason for hiding this comment

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

Fantastic!
Frankly I was afraid that something’s broken and it’s just a coincidence that people update rubocop and rubocop-rspec simultaneously 😅

.github/workflows/main.yml Show resolved Hide resolved
Copy link
Member

@ydah ydah left a comment

Choose a reason for hiding this comment

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

Looks good!

@ydah ydah merged commit 1c029ac into master May 19, 2024
25 checks passed
@ydah ydah deleted the test-oldest-rubocop branch May 19, 2024 16:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants