5 files changed +49
-3
lines changed Original file line number Diff line number Diff line change 3
3
specs:
4
4
rubocop-shopify (2.15.1 )
5
5
rubocop (~> 1.62 )
6
+ rubocop-thread_safety
6
7
7
8
GEM
8
9
remote: https://rubygems.org/
44
45
unicode-display_width (>= 2.4.0 , < 4.0 )
45
46
rubocop-ast (1.38.1 )
46
47
parser (>= 3.3.1.0 )
48
+ rubocop-thread_safety (0.7.0 )
49
+ lint_roller (~> 1.1 )
50
+ rubocop (~> 1.72 , >= 1.72.1 )
47
51
ruby-progressbar (1.13.0 )
48
52
unicode-display_width (3.1.4 )
49
53
unicode-emoji (~> 4.0 , >= 4.0.4 )
Original file line number Diff line number Diff line change @@ -58,7 +58,7 @@ def sort_cops(file_path)
58
58
end
59
59
60
60
if ARGV . empty?
61
- puts "Usage: ruby sort_cops.rb path/to/rubocop.yml"
61
+ puts "Usage: ruby sort-cops path/to/rubocop.yml"
62
62
exit 1
63
63
end
64
64
Original file line number Diff line number Diff line change @@ -24,4 +24,5 @@ Gem::Specification.new do |s|
24
24
s . required_ruby_version = ">= 3.1.0"
25
25
26
26
s . add_dependency ( "rubocop" , "~> 1.62" )
27
+ s . add_dependency ( "rubocop-thread_safety" )
27
28
end
Original file line number Diff line number Diff line change @@ -9,6 +9,8 @@ inherit_mode:
9
9
- Exclude
10
10
- Include
11
11
12
+ plugins : rubocop-thread_safety
13
+
12
14
AllCops :
13
15
StyleGuideBaseURL : https://shopify.github.io/ruby-style-guide/
14
16
NewCops : disable # New cops will be triaged by style guide maintainers instead.
@@ -1165,7 +1167,7 @@ Style/MultipleComparison:
1165
1167
Enabled : false
1166
1168
1167
1169
Style/MutableConstant :
1168
- Enabled : false
1170
+ Enabled : true
1169
1171
1170
1172
Style/NegatedIf :
1171
1173
Enabled : false
@@ -1549,3 +1551,8 @@ Style/YodaCondition:
1549
1551
1550
1552
Style/ZeroLengthPredicate :
1551
1553
Enabled : false
1554
+
1555
+ <% if rubocop_version >= "1.71" % >
1556
+ ThreadSafety :
1557
+ Enabled : true
1558
+ <% end % >
Original file line number Diff line number Diff line change @@ -3526,7 +3526,7 @@ Style/MultipleComparison:
3526
3526
ComparisonsThreshold : 2
3527
3527
Style/MutableConstant :
3528
3528
Description : Do not assign mutable objects to constants.
3529
- Enabled : false
3529
+ Enabled : true
3530
3530
VersionAdded : ' 0.34'
3531
3531
VersionChanged : ' 1.8'
3532
3532
SafeAutoCorrect : false
@@ -4523,7 +4523,41 @@ Style/ZeroLengthPredicate:
4523
4523
Safe : false
4524
4524
VersionAdded : ' 0.37'
4525
4525
VersionChanged : ' 0.39'
4526
+ ThreadSafety/ClassAndModuleAttributes :
4527
+ Description : Avoid mutating class and module attributes.
4528
+ Enabled : true
4529
+ ActiveSupportClassAttributeAllowed : false
4530
+ ThreadSafety/InstanceVariableInClassMethod :
4531
+ Description : Avoid using instance variables in class methods.
4532
+ Enabled : true
4533
+ ThreadSafety/MutableClassInstanceVariable :
4534
+ Description : Do not assign mutable objects to class instance variables.
4535
+ Enabled : true
4536
+ EnforcedStyle : literals
4537
+ SafeAutoCorrect : false
4538
+ SupportedStyles :
4539
+ - literals
4540
+ - strict
4541
+ ThreadSafety/NewThread :
4542
+ Description : Avoid starting new threads. Let a framework like Sidekiq handle the
4543
+ threads.
4544
+ Enabled : true
4545
+ ThreadSafety/DirChdir :
4546
+ Description : Avoid using `Dir.chdir` due to its process-wide effect.
4547
+ Enabled : true
4548
+ AllowCallWithBlock : false
4549
+ ThreadSafety/RackMiddlewareInstanceVariable :
4550
+ Description : Avoid instance variables in Rack middleware.
4551
+ Enabled : true
4552
+ Include :
4553
+ - app/middleware/**/*.rb
4554
+ - lib/middleware/**/*.rb
4555
+ - app/middlewares/**/*.rb
4556
+ - lib/middlewares/**/*.rb
4557
+ AllowedIdentifiers : []
4526
4558
inherit_mode :
4527
4559
merge :
4528
4560
- Exclude
4529
4561
- Include
4562
+ ThreadSafety :
4563
+ Enabled : true
0 commit comments