Skip to content

Conversation

@petergoldstein
Copy link
Contributor

This PR adds Ruby 3.2 to the CI matrix and updates RuboCop to a version that can be run with that Ruby version.

Getting everything green required:

  1. Updating the .rubocop.yml to account for Cop name changes
  2. Adding rubocop-performance to the gemspec and config
  3. Some minor changes to address lints
  4. Disabling the Lint/MissingSuper for the Timezone::Lookup::Test class, because that missing super is a deliberate strategy for that class.

Everything runs green on my fork.

Copy link
Owner

@panthomakos panthomakos left a comment

Choose a reason for hiding this comment

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

Thanks for contributing! Sorry for the delay in responding. I have a few suggestions and questions.

timezone.gemspec Outdated
s.add_development_dependency('rake', '~> 12')
s.add_development_dependency('rubocop', '= 0.51')
s.add_development_dependency('rubocop', '>= 0.51')
s.add_development_dependency('rubocop-performance')
Copy link
Owner

Choose a reason for hiding this comment

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

This should have a version lock as well.

@petergoldstein
Copy link
Contributor Author

So I'm getting a bundler segfault on Ruby 2.2, but everything else is green with no warnings. Not sure if you want to maintain support for 2.2 at this point.

@petergoldstein
Copy link
Contributor Author

@panthomakos For what it's worth, rerunning the 2.2 job on my fork caused it to pass.

assert Timezone.fetch('Australia/Sydney').valid?

# Explicitly testing block syntax, so disable Cop
# rubocop:disable Style/RedundantFetchBlock
Copy link
Owner

Choose a reason for hiding this comment

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

👍

config.username = 'timezone'
config.request_handler = HTTPTestClientFactory.new(body)
yield config if block_given?
yield config if block
Copy link
Owner

Choose a reason for hiding this comment

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

To keep consistency with the code should we use block_given? here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is a Rubocop fix - https://msp-greg.github.io/rubocop-performance/RuboCop/Cop/Performance/BlockGivenWithExplicitBlock.html

I'm not sure why the previous version would be preferable.

config.api_key = 'MTIzYWJj'
config.request_handler = HTTPTestClientFactory.new(body)
yield config if block_given?
yield config if block
Copy link
Owner

Choose a reason for hiding this comment

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

Ditto here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is a Rubocop fix - https://msp-greg.github.io/rubocop-performance/RuboCop/Cop/Performance/BlockGivenWithExplicitBlock.html

I'm not sure why the previous version would be preferable.


assert_equal Timezone::Lookup::Test,
Timezone::Lookup.lookup.class
Timezone::Lookup.lookup.class
Copy link
Owner

Choose a reason for hiding this comment

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

Is there a cop changing this behavior and can we revert to the previous behavior?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is a spacing lint.

'lookups.'

s.files = `git ls-files`.split("\n")
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
Copy link
Owner

Choose a reason for hiding this comment

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

How come this is removed?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

s.rdoc_options = ['--charset=UTF-8']
s.require_paths = ['lib']

s.required_ruby_version = '>= 2.2'
Copy link
Owner

Choose a reason for hiding this comment

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

I am not objected to dropping 2.2 support, but it's unclear to me why it stopped working with these changes. If it's feasible to add 3.2 support independently of the RuboCop changes to see if everything still works, I would prefer not to drop 2.2 support unnecessarily.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Given that Rubocop is being run in the CI pipeline (with a Ruby version of 3.0), I'm not sure if it's feasible. I'm not going to invest the time to determine that, but you should feel free to take whatever you want from this PR and explore that.

@petergoldstein
Copy link
Contributor Author

Also worth noting that it runs green on my fork, including for 2.2 - petergoldstein#1

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.

2 participants