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

Implement ThreadSafety/RackMiddlewareInstanceVariable cop #52

Conversation

viralpraxis
Copy link
Collaborator

@viralpraxis viralpraxis commented Sep 22, 2024

Resolves #15

This [baseline] implementation is pretty straightforward. I applied two heuristic here:

  1. we find "rack application" variable (usually named app) and do not report it;
  2. we track instance variables initialized in constructor with values which are known to have thread-safe semantics and do not report them.

This cop also supports AllowedIdentifiers concern.

@viralpraxis viralpraxis self-assigned this Sep 22, 2024
@viralpraxis viralpraxis force-pushed the implement-rack-middleware-instance-variable-cop branch from ff04bb7 to 480c556 Compare September 24, 2024 12:00
@viralpraxis viralpraxis force-pushed the implement-rack-middleware-instance-variable-cop branch from 561304a to abe9970 Compare September 25, 2024 07:03
@viralpraxis viralpraxis changed the title Implement rack middleware instance variable cop Implement ThreadSafety/RackMiddlewareInstanceVariable cop Sep 25, 2024
@viralpraxis viralpraxis marked this pull request as ready for review September 25, 2024 08:09
@viralpraxis viralpraxis requested a review from mikegee September 25, 2024 08:09
@viralpraxis viralpraxis merged commit 49dd078 into rubocop:master Sep 26, 2024
18 checks passed
@synth
Copy link

synth commented Sep 27, 2024

Amazing! Thank you!

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.

Detect ivars in Rack middleware
3 participants