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

Improve performance with RESTRICT_ON_SEND #7

Merged
merged 1 commit into from
May 18, 2022
Merged

Conversation

bquorning
Copy link

@bquorning bquorning commented May 17, 2022

https://github.com/rubocop/rubocop/blob/master/docs/modules/ROOT/pages/development.adoc#implementation mentions:

The on_send callback is the most used and can be optimized by restricting the acceptable method names with a constant RESTRICT_ON_SEND.

Blocked by #3.

@koic
Copy link
Member

koic commented May 18, 2022

RESTRICT_ON_SEND was introduced in RuboCop 0.90.
e.g. rubocop/rubocop-performance#180

It will need to update the following runtime dependency.

diff --git a/rubocop-thread_safety.gemspec b/rubocop-thread_safety.gemspec
index 613da28..4606d72 100644
--- a/rubocop-thread_safety.gemspec
+++ b/rubocop-thread_safety.gemspec
@@ -28,7 +28,7 @@ Gem::Specification.new do |spec|

   spec.required_ruby_version = '>= 2.3.0'

-  spec.add_runtime_dependency 'rubocop', '>= 0.53.0'
+  spec.add_runtime_dependency 'rubocop', '>= 0.90.0'

   spec.add_development_dependency 'appraisal'
   spec.add_development_dependency 'bundler', '>= 1.10', '< 3'

https://github.com/rubocop/rubocop/blob/master/docs/modules/ROOT/pages/
development.adoc#implementation mentions:

> The `on_send` callback is the most used and can be optimized
> by restricting the acceptable method names with a constant
> `RESTRICT_ON_SEND`.
@mikegee
Copy link
Collaborator

mikegee commented May 18, 2022

did all the checks run twice, on push and pull_request? 🤔

@bquorning
Copy link
Author

Yes, it looks like they do. Maybe we should copy this part of rubocop-rspec's CI config.

koic added a commit to koic/rubocop-thread_safety that referenced this pull request May 18, 2022
Follow rubocop/rubocop#7868.

The legacy `Cop::Cop` API is soft deprecated and this PR use new `Cop::Base` API instead.

> maintain any RuboCop extensions, as the legacy API will be removed in RuboCop 2.0.

https://metaredux.com/posts/2020/10/21/rubocop-1-0.html

This new API requires RuboCop 0.87 or higher.
https://github.com/rubocop/rubocop/blob/master/CHANGELOG.md#0870-2020-07-06

That dependent version update will be resolved in rubocop#7, so there are no updates in this PR.
@mikegee mikegee merged commit 79d2dcf into master May 18, 2022
@mikegee mikegee deleted the restrict-on-send branch May 18, 2022 17:00
koic added a commit to koic/rubocop-thread_safety that referenced this pull request May 18, 2022
Follow rubocop/rubocop#7868.

The legacy `Cop::Cop` API is soft deprecated and this PR use new `Cop::Base` API instead.

> maintain any RuboCop extensions, as the legacy API will be removed in RuboCop 2.0.

https://metaredux.com/posts/2020/10/21/rubocop-1-0.html

This new API requires RuboCop 0.87 or higher.
https://github.com/rubocop/rubocop/blob/master/CHANGELOG.md#0870-2020-07-06

That dependent version update will be resolved in rubocop#7, so there are no updates in this PR.
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.

3 participants