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

Include thread-safety rubocop #703

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft

Conversation

alexpark20
Copy link

No description provided.

@github-actions github-actions bot added the config change Changes the Rubocop config by enabling, disabling, or reconfiguring one or many cops label Mar 6, 2025
@alexpark20 alexpark20 force-pushed the thread-safety-rubocop branch 2 times, most recently from 3999c6e to 5ab601c Compare March 6, 2025 16:43
ThreadSafety/NewThread:
Description: Avoid starting new threads. Let a framework like Sidekiq handle the
threads.
Enabled: true
Copy link
Member

Choose a reason for hiding this comment

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

This should not be enabled

Copy link
Author

Choose a reason for hiding this comment

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

Right, we are not enabling it on SFR too. I will disable it 👍

Enabled: true
ThreadSafety/MutableClassInstanceVariable:
Description: Do not assign mutable objects to class instance variables.
Enabled: true
Copy link
Member

Choose a reason for hiding this comment

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

This cop is disallowing:

class FooTest < ActiveSupport::TestCase
  setup do
    @something = { a: "A" }
  end
end

Which doesn't have any thread safety issue.

We need to fix that in order to enable it.

Copy link
Author

Choose a reason for hiding this comment

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

I will not enable it yet. Good check, lets socialize how we can fix it 👍

@alexpark20 alexpark20 force-pushed the thread-safety-rubocop branch 2 times, most recently from 3da3d00 to 4c2b934 Compare March 7, 2025 15:26
@alexpark20 alexpark20 force-pushed the thread-safety-rubocop branch from 4c2b934 to 3cd22cb Compare March 7, 2025 15:29
@alexpark20 alexpark20 requested a review from rafaelfranca March 7, 2025 15:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
config change Changes the Rubocop config by enabling, disabling, or reconfiguring one or many cops
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants