categoria 0.1.0.pre.beta0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.rubocop.yml +34 -0
- data/.ruby-version +1 -0
- data/CHANGELOG.md +5 -0
- data/LICENSE.txt +21 -0
- data/README.md +33 -0
- data/Rakefile +12 -0
- data/categoria.gemspec +48 -0
- data/lib/categoria/version.rb +6 -0
- data/lib/categoria.rb +9 -0
- data/lib/generators/categoria/command_generator.rb +8 -0
- data/lib/generators/categoria/domain_generator.rb +35 -0
- data/lib/generators/categoria/model_generator.rb +8 -0
- data/lib/generators/categoria/templates/domain_module.rb.erb +6 -0
- data/sig/categoria.rbs +4 -0
- data/sorbet/config +4 -0
- data/sorbet/rbi/annotations/.gitattributes +1 -0
- data/sorbet/rbi/annotations/actionmailer.rbi +10 -0
- data/sorbet/rbi/annotations/actionpack.rbi +429 -0
- data/sorbet/rbi/annotations/actionview.rbi +75 -0
- data/sorbet/rbi/annotations/activejob.rbi +44 -0
- data/sorbet/rbi/annotations/activemodel.rbi +89 -0
- data/sorbet/rbi/annotations/activerecord.rbi +92 -0
- data/sorbet/rbi/annotations/activesupport.rbi +421 -0
- data/sorbet/rbi/annotations/globalid.rbi +30 -0
- data/sorbet/rbi/annotations/railties.rbi +61 -0
- data/sorbet/rbi/annotations/rainbow.rbi +269 -0
- data/sorbet/rbi/gems/.gitattributes +1 -0
- data/sorbet/rbi/gems/actioncable@7.1.3.3.rbi +9 -0
- data/sorbet/rbi/gems/actionmailbox@7.1.3.3.rbi +9 -0
- data/sorbet/rbi/gems/actionmailer@7.1.3.3.rbi +9 -0
- data/sorbet/rbi/gems/actionpack@7.1.3.3.rbi +9 -0
- data/sorbet/rbi/gems/actiontext@7.1.3.3.rbi +9 -0
- data/sorbet/rbi/gems/actionview@7.1.3.3.rbi +9 -0
- data/sorbet/rbi/gems/activejob@7.1.3.3.rbi +9 -0
- data/sorbet/rbi/gems/activemodel@7.1.3.3.rbi +9 -0
- data/sorbet/rbi/gems/activerecord@7.1.3.3.rbi +9 -0
- data/sorbet/rbi/gems/activestorage@7.1.3.3.rbi +9 -0
- data/sorbet/rbi/gems/activesupport@7.1.3.3.rbi +11 -0
- data/sorbet/rbi/gems/ast@2.4.2.rbi +585 -0
- data/sorbet/rbi/gems/base64@0.2.0.rbi +9 -0
- data/sorbet/rbi/gems/bigdecimal@3.1.8.rbi +9 -0
- data/sorbet/rbi/gems/builder@3.2.4.rbi +9 -0
- data/sorbet/rbi/gems/concurrent-ruby@1.3.1.rbi +9 -0
- data/sorbet/rbi/gems/connection_pool@2.4.1.rbi +9 -0
- data/sorbet/rbi/gems/crass@1.0.6.rbi +9 -0
- data/sorbet/rbi/gems/date@3.3.4.rbi +73 -0
- data/sorbet/rbi/gems/drb@2.2.1.rbi +9 -0
- data/sorbet/rbi/gems/erubi@1.12.0.rbi +146 -0
- data/sorbet/rbi/gems/globalid@1.2.1.rbi +9 -0
- data/sorbet/rbi/gems/i18n@1.14.5.rbi +9 -0
- data/sorbet/rbi/gems/io-console@0.7.2.rbi +9 -0
- data/sorbet/rbi/gems/json@2.7.2.rbi +1562 -0
- data/sorbet/rbi/gems/language_server-protocol@3.17.0.3.rbi +14238 -0
- data/sorbet/rbi/gems/loofah@2.22.0.rbi +9 -0
- data/sorbet/rbi/gems/mail@2.8.1.rbi +9 -0
- data/sorbet/rbi/gems/marcel@1.0.4.rbi +9 -0
- data/sorbet/rbi/gems/mini_mime@1.1.5.rbi +9 -0
- data/sorbet/rbi/gems/minitest@5.23.1.rbi +1555 -0
- data/sorbet/rbi/gems/mutex_m@0.2.0.rbi +9 -0
- data/sorbet/rbi/gems/net-imap@0.4.11.rbi +9 -0
- data/sorbet/rbi/gems/net-pop@0.1.2.rbi +9 -0
- data/sorbet/rbi/gems/net-protocol@0.2.2.rbi +282 -0
- data/sorbet/rbi/gems/net-smtp@0.5.0.rbi +9 -0
- data/sorbet/rbi/gems/netrc@0.11.0.rbi +159 -0
- data/sorbet/rbi/gems/nio4r@2.7.3.rbi +9 -0
- data/sorbet/rbi/gems/nokogiri@1.16.5.rbi +9 -0
- data/sorbet/rbi/gems/parallel@1.24.0.rbi +281 -0
- data/sorbet/rbi/gems/parser@3.3.2.0.rbi +5519 -0
- data/sorbet/rbi/gems/prism@0.29.0.rbi +37987 -0
- data/sorbet/rbi/gems/psych@5.1.2.rbi +1732 -0
- data/sorbet/rbi/gems/racc@1.8.0.rbi +162 -0
- data/sorbet/rbi/gems/rack-session@2.0.0.rbi +9 -0
- data/sorbet/rbi/gems/rack-test@2.1.0.rbi +9 -0
- data/sorbet/rbi/gems/rack@3.0.11.rbi +2910 -0
- data/sorbet/rbi/gems/rackup@2.1.0.rbi +390 -0
- data/sorbet/rbi/gems/rails-dom-testing@2.2.0.rbi +9 -0
- data/sorbet/rbi/gems/rails-html-sanitizer@1.6.0.rbi +9 -0
- data/sorbet/rbi/gems/rails@7.1.3.3.rbi +9 -0
- data/sorbet/rbi/gems/railties@7.1.3.3.rbi +9 -0
- data/sorbet/rbi/gems/rainbow@3.1.1.rbi +403 -0
- data/sorbet/rbi/gems/rake@13.2.1.rbi +3028 -0
- data/sorbet/rbi/gems/rbi@0.1.13.rbi +3078 -0
- data/sorbet/rbi/gems/rdoc@6.7.0.rbi +12719 -0
- data/sorbet/rbi/gems/regexp_parser@2.9.2.rbi +3772 -0
- data/sorbet/rbi/gems/reline@0.5.8.rbi +9 -0
- data/sorbet/rbi/gems/rexml@3.2.8.rbi +4794 -0
- data/sorbet/rbi/gems/rubocop-ast@1.31.3.rbi +7045 -0
- data/sorbet/rbi/gems/rubocop-minitest@0.35.0.rbi +2611 -0
- data/sorbet/rbi/gems/rubocop-rake@0.6.0.rbi +329 -0
- data/sorbet/rbi/gems/rubocop-sorbet@0.8.3.rbi +1607 -0
- data/sorbet/rbi/gems/rubocop@1.64.1.rbi +58104 -0
- data/sorbet/rbi/gems/ruby-progressbar@1.13.0.rbi +1318 -0
- data/sorbet/rbi/gems/spoom@1.3.2.rbi +4421 -0
- data/sorbet/rbi/gems/stringio@3.1.0.rbi +9 -0
- data/sorbet/rbi/gems/strscan@3.1.0.rbi +9 -0
- data/sorbet/rbi/gems/tapioca@0.14.3.rbi +3534 -0
- data/sorbet/rbi/gems/thor@1.3.1.rbi +4352 -0
- data/sorbet/rbi/gems/timeout@0.4.1.rbi +143 -0
- data/sorbet/rbi/gems/tzinfo@2.0.6.rbi +9 -0
- data/sorbet/rbi/gems/unicode-display_width@2.5.0.rbi +66 -0
- data/sorbet/rbi/gems/webrick@1.8.1.rbi +2607 -0
- data/sorbet/rbi/gems/websocket-driver@0.7.6.rbi +9 -0
- data/sorbet/rbi/gems/websocket-extensions@0.1.5.rbi +9 -0
- data/sorbet/rbi/gems/yard-sorbet@0.8.1.rbi +429 -0
- data/sorbet/rbi/gems/yard@0.9.36.rbi +18412 -0
- data/sorbet/rbi/gems/zeitwerk@2.6.15.rbi +9 -0
- data/sorbet/rbi/todo.rbi +46 -0
- data/sorbet/tapioca/config.yml +13 -0
- data/sorbet/tapioca/require.rb +4 -0
- metadata +339 -0
@@ -0,0 +1,1607 @@
|
|
1
|
+
# typed: true
|
2
|
+
|
3
|
+
# DO NOT EDIT MANUALLY
|
4
|
+
# This is an autogenerated file for types exported from the `rubocop-sorbet` gem.
|
5
|
+
# Please instead update this file by running `bin/tapioca gem rubocop-sorbet`.
|
6
|
+
|
7
|
+
|
8
|
+
# source://rubocop-sorbet//lib/rubocop/sorbet/version.rb#3
|
9
|
+
module RuboCop; end
|
10
|
+
|
11
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/mixin/target_sorbet_version.rb#4
|
12
|
+
module RuboCop::Cop; end
|
13
|
+
|
14
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/mixin/target_sorbet_version.rb#5
|
15
|
+
module RuboCop::Cop::Sorbet; end
|
16
|
+
|
17
|
+
# Disallows using `.override(allow_incompatible: true)`.
|
18
|
+
# Using `allow_incompatible` suggests a violation of the Liskov
|
19
|
+
# Substitution Principle, meaning that a subclass is not a valid
|
20
|
+
# subtype of its superclass. This Cop prevents these design smells
|
21
|
+
# from occurring.
|
22
|
+
#
|
23
|
+
# @example
|
24
|
+
#
|
25
|
+
# # bad
|
26
|
+
# sig.override(allow_incompatible: true)
|
27
|
+
#
|
28
|
+
# # good
|
29
|
+
# sig.override
|
30
|
+
#
|
31
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/signatures/allow_incompatible_override.rb#21
|
32
|
+
class RuboCop::Cop::Sorbet::AllowIncompatibleOverride < ::RuboCop::Cop::Base
|
33
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/signatures/allow_incompatible_override.rb#55
|
34
|
+
def on_block(node); end
|
35
|
+
|
36
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/signatures/allow_incompatible_override.rb#55
|
37
|
+
def on_numblock(node); end
|
38
|
+
|
39
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/signatures/allow_incompatible_override.rb#49
|
40
|
+
def on_send(node); end
|
41
|
+
|
42
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/signatures/allow_incompatible_override.rb#41
|
43
|
+
def override?(param0 = T.unsafe(nil)); end
|
44
|
+
|
45
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/signatures/allow_incompatible_override.rb#36
|
46
|
+
def sig?(param0); end
|
47
|
+
|
48
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/signatures/allow_incompatible_override.rb#27
|
49
|
+
def sig_dot_override?(param0 = T.unsafe(nil)); end
|
50
|
+
end
|
51
|
+
|
52
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/signatures/allow_incompatible_override.rb#22
|
53
|
+
RuboCop::Cop::Sorbet::AllowIncompatibleOverride::MSG = T.let(T.unsafe(nil), String)
|
54
|
+
|
55
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/signatures/allow_incompatible_override.rb#24
|
56
|
+
RuboCop::Cop::Sorbet::AllowIncompatibleOverride::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array)
|
57
|
+
|
58
|
+
# Disallows binding the return value of `T.any`, `T.all`, `T.enum`
|
59
|
+
# to a constant directly. To bind the value, one must use `T.type_alias`.
|
60
|
+
#
|
61
|
+
# @example
|
62
|
+
#
|
63
|
+
# # bad
|
64
|
+
# FooOrBar = T.any(Foo, Bar)
|
65
|
+
#
|
66
|
+
# # good
|
67
|
+
# FooOrBar = T.type_alias { T.any(Foo, Bar) }
|
68
|
+
#
|
69
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/binding_constant_without_type_alias.rb#18
|
70
|
+
class RuboCop::Cop::Sorbet::BindingConstantWithoutTypeAlias < ::RuboCop::Cop::Base
|
71
|
+
extend ::RuboCop::Cop::AutoCorrector
|
72
|
+
|
73
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/binding_constant_without_type_alias.rb#65
|
74
|
+
def on_casgn(node); end
|
75
|
+
|
76
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/binding_constant_without_type_alias.rb#48
|
77
|
+
def requires_type_alias?(param0 = T.unsafe(nil)); end
|
78
|
+
|
79
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/binding_constant_without_type_alias.rb#38
|
80
|
+
def type_alias_with_block?(param0 = T.unsafe(nil)); end
|
81
|
+
|
82
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/binding_constant_without_type_alias.rb#29
|
83
|
+
def type_alias_without_block(param0 = T.unsafe(nil)); end
|
84
|
+
|
85
|
+
private
|
86
|
+
|
87
|
+
# Given nested send nodes, returns the leaf with explicit receiver.
|
88
|
+
#
|
89
|
+
# i.e. in Ruby
|
90
|
+
#
|
91
|
+
# a.b.c.d.e.f
|
92
|
+
# ^^^
|
93
|
+
#
|
94
|
+
# i.e. in AST
|
95
|
+
#
|
96
|
+
# (send (send (send (send (send (send nil :a) :b) :c) :d) :e) :f)
|
97
|
+
# ^^^^^^^^^^^^^^^^^^^^^^^
|
98
|
+
#
|
99
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/binding_constant_without_type_alias.rb#98
|
100
|
+
def send_leaf(node); end
|
101
|
+
end
|
102
|
+
|
103
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/binding_constant_without_type_alias.rb#21
|
104
|
+
RuboCop::Cop::Sorbet::BindingConstantWithoutTypeAlias::MSG = T.let(T.unsafe(nil), String)
|
105
|
+
|
106
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/binding_constant_without_type_alias.rb#23
|
107
|
+
RuboCop::Cop::Sorbet::BindingConstantWithoutTypeAlias::WITHOUT_BLOCK_MSG = T.let(T.unsafe(nil), String)
|
108
|
+
|
109
|
+
# Checks for the a mistaken variant of the "obsolete memoization pattern" that used to be required
|
110
|
+
# on every call, causing the memoized value to be discarded and recomputed on every call.
|
111
|
+
#
|
112
|
+
# This cop will correct it to read from the ivar instead of `nil`, which will memoize it correctly.
|
113
|
+
#
|
114
|
+
# The result of this correction will be the "obsolete memoization pattern", which can further be corrected by
|
115
|
+
# the `Sorbet/ObsoleteStrictMemoization` cop.
|
116
|
+
#
|
117
|
+
# See `Sorbet/ObsoleteStrictMemoization` for more details.
|
118
|
+
#
|
119
|
+
# @example
|
120
|
+
# # bad
|
121
|
+
# sig { returns(Foo) }
|
122
|
+
# def foo
|
123
|
+
# # This `nil` is likely a mistake, causing the memoized value to be discarded and recomputed on every call.
|
124
|
+
# @foo = T.let(nil, T.nilable(Foo))
|
125
|
+
# @foo ||= some_computation
|
126
|
+
# end
|
127
|
+
#
|
128
|
+
# # good
|
129
|
+
# sig { returns(Foo) }
|
130
|
+
# def foo
|
131
|
+
# # This will now memoize the value as was likely intended, so `some_computation` is only ever called once.
|
132
|
+
# # ⚠️If `some_computation` has side effects, this might be a breaking change!
|
133
|
+
# @foo = T.let(@foo, T.nilable(Foo))
|
134
|
+
# @foo ||= some_computation
|
135
|
+
# end
|
136
|
+
# @see Sorbet/ObsoleteStrictMemoization
|
137
|
+
#
|
138
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/buggy_obsolete_strict_memoization.rb#42
|
139
|
+
class RuboCop::Cop::Sorbet::BuggyObsoleteStrictMemoization < ::RuboCop::Cop::Base
|
140
|
+
include ::RuboCop::Cop::RangeHelp
|
141
|
+
include ::RuboCop::Cop::MatchRange
|
142
|
+
include ::RuboCop::Cop::Alignment
|
143
|
+
include ::RuboCop::Cop::LineLengthHelp
|
144
|
+
include ::RuboCop::Cop::Sorbet::TargetSorbetVersion
|
145
|
+
extend ::RuboCop::Cop::AutoCorrector
|
146
|
+
extend ::RuboCop::Cop::Sorbet::TargetSorbetVersion::ClassMethods
|
147
|
+
|
148
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/buggy_obsolete_strict_memoization.rb#55
|
149
|
+
def buggy_legacy_memoization_pattern?(param0 = T.unsafe(nil)); end
|
150
|
+
|
151
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/buggy_obsolete_strict_memoization.rb#66
|
152
|
+
def on_begin(node); end
|
153
|
+
|
154
|
+
# @return [Boolean]
|
155
|
+
#
|
156
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/buggy_obsolete_strict_memoization.rb#77
|
157
|
+
def relevant_file?(file); end
|
158
|
+
end
|
159
|
+
|
160
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/buggy_obsolete_strict_memoization.rb#51
|
161
|
+
RuboCop::Cop::Sorbet::BuggyObsoleteStrictMemoization::MSG = T.let(T.unsafe(nil), String)
|
162
|
+
|
163
|
+
# Ensures that callback conditionals are bound to the right type
|
164
|
+
# so that they are type checked properly.
|
165
|
+
#
|
166
|
+
# Auto-correction is unsafe because other libraries define similar style callbacks as Rails, but don't always need
|
167
|
+
# binding to the attached class. Auto-correcting those usages can lead to false positives and auto-correction
|
168
|
+
# introduces new typing errors.
|
169
|
+
#
|
170
|
+
# @example
|
171
|
+
#
|
172
|
+
# # bad
|
173
|
+
# class Post < ApplicationRecord
|
174
|
+
# before_create :do_it, if: -> { should_do_it? }
|
175
|
+
#
|
176
|
+
# def should_do_it?
|
177
|
+
# true
|
178
|
+
# end
|
179
|
+
# end
|
180
|
+
#
|
181
|
+
# # good
|
182
|
+
# class Post < ApplicationRecord
|
183
|
+
# before_create :do_it, if: -> {
|
184
|
+
# T.bind(self, Post)
|
185
|
+
# should_do_it?
|
186
|
+
# }
|
187
|
+
#
|
188
|
+
# def should_do_it?
|
189
|
+
# true
|
190
|
+
# end
|
191
|
+
# end
|
192
|
+
#
|
193
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/callback_conditionals_binding.rb#35
|
194
|
+
class RuboCop::Cop::Sorbet::CallbackConditionalsBinding < ::RuboCop::Cop::Base
|
195
|
+
include ::RuboCop::Cop::Alignment
|
196
|
+
extend ::RuboCop::Cop::AutoCorrector
|
197
|
+
|
198
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/callback_conditionals_binding.rb#81
|
199
|
+
def argumentless_unbound_callable_callback_conditional?(param0 = T.unsafe(nil)); end
|
200
|
+
|
201
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/callback_conditionals_binding.rb#91
|
202
|
+
def on_send(node); end
|
203
|
+
|
204
|
+
private
|
205
|
+
|
206
|
+
# Find the immediately enclosing class or module name.
|
207
|
+
# Returns `nil`` if the immediate parent (skipping begin if present) is not a class or module.
|
208
|
+
#
|
209
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/callback_conditionals_binding.rb#128
|
210
|
+
def immediately_enclosing_module_name(node); end
|
211
|
+
end
|
212
|
+
|
213
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/callback_conditionals_binding.rb#39
|
214
|
+
RuboCop::Cop::Sorbet::CallbackConditionalsBinding::MSG = T.let(T.unsafe(nil), String)
|
215
|
+
|
216
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/callback_conditionals_binding.rb#41
|
217
|
+
RuboCop::Cop::Sorbet::CallbackConditionalsBinding::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array)
|
218
|
+
|
219
|
+
# Disallows the usage of `checked(true)`. This usage could cause
|
220
|
+
# confusion; it could lead some people to believe that a method would be checked
|
221
|
+
# even if runtime checks have not been enabled on the class or globally.
|
222
|
+
# Additionally, in the event where checks are enabled, `checked(true)` would
|
223
|
+
# be redundant; only `checked(false)` or `soft` would change the behaviour.
|
224
|
+
#
|
225
|
+
# @example
|
226
|
+
#
|
227
|
+
# # bad
|
228
|
+
# sig { void.checked(true) }
|
229
|
+
#
|
230
|
+
# # good
|
231
|
+
# sig { void }
|
232
|
+
#
|
233
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/signatures/checked_true_in_signature.rb#19
|
234
|
+
class RuboCop::Cop::Sorbet::CheckedTrueInSignature < ::RuboCop::Cop::Cop
|
235
|
+
include ::RuboCop::Cop::RangeHelp
|
236
|
+
include ::RuboCop::Cop::Sorbet::SignatureHelp
|
237
|
+
|
238
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/signatures/checked_true_in_signature.rb#24
|
239
|
+
def offending_node(param0); end
|
240
|
+
|
241
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/signatures/checked_true_in_signature.rb#35
|
242
|
+
def on_signature(node); end
|
243
|
+
end
|
244
|
+
|
245
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/signatures/checked_true_in_signature.rb#28
|
246
|
+
RuboCop::Cop::Sorbet::CheckedTrueInSignature::MESSAGE = T.let(T.unsafe(nil), String)
|
247
|
+
|
248
|
+
# Disallows the calls that are used to get constants fom Strings
|
249
|
+
# such as +constantize+, +const_get+, and +constants+.
|
250
|
+
#
|
251
|
+
# The goal of this cop is to make the code easier to statically analyze,
|
252
|
+
# more IDE-friendly, and more predictable. It leads to code that clearly
|
253
|
+
# expresses which values the constant can have.
|
254
|
+
#
|
255
|
+
# @example
|
256
|
+
#
|
257
|
+
# # bad
|
258
|
+
# class_name.constantize
|
259
|
+
#
|
260
|
+
# # bad
|
261
|
+
# constants.detect { |c| c.name == "User" }
|
262
|
+
#
|
263
|
+
# # bad
|
264
|
+
# const_get(class_name)
|
265
|
+
#
|
266
|
+
# # good
|
267
|
+
# case class_name
|
268
|
+
# when "User"
|
269
|
+
# User
|
270
|
+
# else
|
271
|
+
# raise ArgumentError
|
272
|
+
# end
|
273
|
+
#
|
274
|
+
# # good
|
275
|
+
# { "User" => User }.fetch(class_name)
|
276
|
+
#
|
277
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/constants_from_strings.rb#36
|
278
|
+
class RuboCop::Cop::Sorbet::ConstantsFromStrings < ::RuboCop::Cop::Base
|
279
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/constants_from_strings.rb#46
|
280
|
+
def on_send(node); end
|
281
|
+
end
|
282
|
+
|
283
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/constants_from_strings.rb#37
|
284
|
+
RuboCop::Cop::Sorbet::ConstantsFromStrings::MSG = T.let(T.unsafe(nil), String)
|
285
|
+
|
286
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/constants_from_strings.rb#40
|
287
|
+
RuboCop::Cop::Sorbet::ConstantsFromStrings::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array)
|
288
|
+
|
289
|
+
# Checks for blank lines after signatures.
|
290
|
+
#
|
291
|
+
# @example
|
292
|
+
# # bad
|
293
|
+
# sig { void }
|
294
|
+
#
|
295
|
+
# def foo; end
|
296
|
+
#
|
297
|
+
# # good
|
298
|
+
# sig { void }
|
299
|
+
# def foo; end
|
300
|
+
#
|
301
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/signatures/empty_line_after_sig.rb#17
|
302
|
+
class RuboCop::Cop::Sorbet::EmptyLineAfterSig < ::RuboCop::Cop::Base
|
303
|
+
include ::RuboCop::Cop::RangeHelp
|
304
|
+
include ::RuboCop::Cop::Sorbet::SignatureHelp
|
305
|
+
extend ::RuboCop::Cop::AutoCorrector
|
306
|
+
|
307
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/signatures/empty_line_after_sig.rb#34
|
308
|
+
def on_signature(sig); end
|
309
|
+
|
310
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/signatures/empty_line_after_sig.rb#25
|
311
|
+
def sig_or_signable_method_definition?(param0 = T.unsafe(nil)); end
|
312
|
+
|
313
|
+
private
|
314
|
+
|
315
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/signatures/empty_line_after_sig.rb#57
|
316
|
+
def lines_between(node1, node2, buffer: T.unsafe(nil)); end
|
317
|
+
|
318
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/signatures/empty_line_after_sig.rb#53
|
319
|
+
def next_sibling(node); end
|
320
|
+
end
|
321
|
+
|
322
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/signatures/empty_line_after_sig.rb#22
|
323
|
+
RuboCop::Cop::Sorbet::EmptyLineAfterSig::MSG = T.let(T.unsafe(nil), String)
|
324
|
+
|
325
|
+
# Checks that the Sorbet sigil comes as the first magic comment in the file.
|
326
|
+
#
|
327
|
+
# The expected order for magic comments is: (en)?coding, typed, warn_indent then frozen_string_literal.
|
328
|
+
#
|
329
|
+
# For example, the following bad ordering:
|
330
|
+
#
|
331
|
+
# ```ruby
|
332
|
+
# class Foo; end
|
333
|
+
# ```
|
334
|
+
#
|
335
|
+
# Will be corrected as:
|
336
|
+
#
|
337
|
+
# ```ruby
|
338
|
+
# class Foo; end
|
339
|
+
# ```
|
340
|
+
#
|
341
|
+
# Only `(en)?coding`, `typed`, `warn_indent` and `frozen_string_literal` magic comments are considered,
|
342
|
+
# other comments or magic comments are left in the same place.
|
343
|
+
#
|
344
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/sigils/enforce_sigil_order.rb#30
|
345
|
+
class RuboCop::Cop::Sorbet::EnforceSigilOrder < ::RuboCop::Cop::Sorbet::ValidSigil
|
346
|
+
include ::RuboCop::Cop::RangeHelp
|
347
|
+
|
348
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/sigils/enforce_sigil_order.rb#42
|
349
|
+
def autocorrect(_node); end
|
350
|
+
|
351
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/sigils/enforce_sigil_order.rb#33
|
352
|
+
def investigate(processed_source); end
|
353
|
+
|
354
|
+
protected
|
355
|
+
|
356
|
+
# checks
|
357
|
+
#
|
358
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/sigils/enforce_sigil_order.rb#92
|
359
|
+
def check_magic_comments_order(tokens); end
|
360
|
+
|
361
|
+
# Get all the tokens in `processed_source` that match `MAGIC_REGEX`
|
362
|
+
#
|
363
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/sigils/enforce_sigil_order.rb#84
|
364
|
+
def extract_magic_comments(processed_source); end
|
365
|
+
end
|
366
|
+
|
367
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/sigils/enforce_sigil_order.rb#68
|
368
|
+
RuboCop::Cop::Sorbet::EnforceSigilOrder::CODING_REGEX = T.let(T.unsafe(nil), Regexp)
|
369
|
+
|
370
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/sigils/enforce_sigil_order.rb#70
|
371
|
+
RuboCop::Cop::Sorbet::EnforceSigilOrder::FROZEN_REGEX = T.let(T.unsafe(nil), Regexp)
|
372
|
+
|
373
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/sigils/enforce_sigil_order.rb#69
|
374
|
+
RuboCop::Cop::Sorbet::EnforceSigilOrder::INDENT_REGEX = T.let(T.unsafe(nil), Regexp)
|
375
|
+
|
376
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/sigils/enforce_sigil_order.rb#79
|
377
|
+
RuboCop::Cop::Sorbet::EnforceSigilOrder::MAGIC_REGEX = T.let(T.unsafe(nil), Regexp)
|
378
|
+
|
379
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/sigils/enforce_sigil_order.rb#72
|
380
|
+
RuboCop::Cop::Sorbet::EnforceSigilOrder::PREFERRED_ORDER = T.let(T.unsafe(nil), Hash)
|
381
|
+
|
382
|
+
# Checks that every method definition and attribute accessor has a Sorbet signature.
|
383
|
+
#
|
384
|
+
# It also suggest an autocorrect with placeholders so the following code:
|
385
|
+
#
|
386
|
+
# ```
|
387
|
+
# def foo(a, b, c); end
|
388
|
+
# ```
|
389
|
+
#
|
390
|
+
# Will be corrected as:
|
391
|
+
#
|
392
|
+
# ```
|
393
|
+
# sig { params(a: T.untyped, b: T.untyped, c: T.untyped).returns(T.untyped)
|
394
|
+
# def foo(a, b, c); end
|
395
|
+
# ```
|
396
|
+
#
|
397
|
+
# You can configure the placeholders used by changing the following options:
|
398
|
+
#
|
399
|
+
# * `ParameterTypePlaceholder`: placeholders used for parameter types (default: 'T.untyped')
|
400
|
+
# * `ReturnTypePlaceholder`: placeholders used for return types (default: 'T.untyped')
|
401
|
+
#
|
402
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/signatures/enforce_signatures.rb#27
|
403
|
+
class RuboCop::Cop::Sorbet::EnforceSignatures < ::RuboCop::Cop::Cop
|
404
|
+
include ::RuboCop::Cop::Sorbet::SignatureHelp
|
405
|
+
|
406
|
+
# @return [EnforceSignatures] a new instance of EnforceSignatures
|
407
|
+
#
|
408
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/signatures/enforce_signatures.rb#30
|
409
|
+
def initialize(config = T.unsafe(nil), options = T.unsafe(nil)); end
|
410
|
+
|
411
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/signatures/enforce_signatures.rb#36
|
412
|
+
def accessor?(param0 = T.unsafe(nil)); end
|
413
|
+
|
414
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/signatures/enforce_signatures.rb#56
|
415
|
+
def autocorrect(node); end
|
416
|
+
|
417
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/signatures/enforce_signatures.rb#40
|
418
|
+
def on_def(node); end
|
419
|
+
|
420
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/signatures/enforce_signatures.rb#44
|
421
|
+
def on_defs(node); end
|
422
|
+
|
423
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/signatures/enforce_signatures.rb#48
|
424
|
+
def on_send(node); end
|
425
|
+
|
426
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/signatures/enforce_signatures.rb#52
|
427
|
+
def on_signature(node); end
|
428
|
+
|
429
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/signatures/enforce_signatures.rb#75
|
430
|
+
def scope(node); end
|
431
|
+
|
432
|
+
private
|
433
|
+
|
434
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/signatures/enforce_signatures.rb#84
|
435
|
+
def check_node(node); end
|
436
|
+
|
437
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/signatures/enforce_signatures.rb#95
|
438
|
+
def param_type_placeholder; end
|
439
|
+
|
440
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/signatures/enforce_signatures.rb#99
|
441
|
+
def return_type_placeholder; end
|
442
|
+
end
|
443
|
+
|
444
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/signatures/enforce_signatures.rb#103
|
445
|
+
class RuboCop::Cop::Sorbet::EnforceSignatures::SigSuggestion
|
446
|
+
# @return [SigSuggestion] a new instance of SigSuggestion
|
447
|
+
#
|
448
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/signatures/enforce_signatures.rb#106
|
449
|
+
def initialize(indent, param_placeholder, return_placeholder); end
|
450
|
+
|
451
|
+
# Returns the value of attribute params.
|
452
|
+
#
|
453
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/signatures/enforce_signatures.rb#104
|
454
|
+
def params; end
|
455
|
+
|
456
|
+
# Sets the attribute params
|
457
|
+
#
|
458
|
+
# @param value the value to set the attribute params to.
|
459
|
+
#
|
460
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/signatures/enforce_signatures.rb#104
|
461
|
+
def params=(_arg0); end
|
462
|
+
|
463
|
+
# Returns the value of attribute returns.
|
464
|
+
#
|
465
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/signatures/enforce_signatures.rb#104
|
466
|
+
def returns; end
|
467
|
+
|
468
|
+
# Sets the attribute returns
|
469
|
+
#
|
470
|
+
# @param value the value to set the attribute returns to.
|
471
|
+
#
|
472
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/signatures/enforce_signatures.rb#104
|
473
|
+
def returns=(_arg0); end
|
474
|
+
|
475
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/signatures/enforce_signatures.rb#114
|
476
|
+
def to_autocorrect; end
|
477
|
+
|
478
|
+
private
|
479
|
+
|
480
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/signatures/enforce_signatures.rb#126
|
481
|
+
def generate_params; end
|
482
|
+
|
483
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/signatures/enforce_signatures.rb#138
|
484
|
+
def generate_return; end
|
485
|
+
end
|
486
|
+
|
487
|
+
# Checks that there is only one Sorbet sigil in a given file
|
488
|
+
#
|
489
|
+
# For example, the following class with two sigils
|
490
|
+
#
|
491
|
+
# ```ruby
|
492
|
+
# class Foo; end
|
493
|
+
# ```
|
494
|
+
#
|
495
|
+
# Will be corrected as:
|
496
|
+
#
|
497
|
+
# ```ruby
|
498
|
+
# class Foo; end
|
499
|
+
# ```
|
500
|
+
#
|
501
|
+
# Other comments or magic comments are left in place.
|
502
|
+
#
|
503
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/sigils/enforce_single_sigil.rb#26
|
504
|
+
class RuboCop::Cop::Sorbet::EnforceSingleSigil < ::RuboCop::Cop::Sorbet::ValidSigil
|
505
|
+
include ::RuboCop::Cop::RangeHelp
|
506
|
+
|
507
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/sigils/enforce_single_sigil.rb#40
|
508
|
+
def autocorrect(_node); end
|
509
|
+
|
510
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/sigils/enforce_single_sigil.rb#29
|
511
|
+
def investigate(processed_source); end
|
512
|
+
|
513
|
+
protected
|
514
|
+
|
515
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/sigils/enforce_single_sigil.rb#56
|
516
|
+
def extract_all_sigils(processed_source); end
|
517
|
+
end
|
518
|
+
|
519
|
+
# Makes the Sorbet `false` sigil mandatory in all files.
|
520
|
+
#
|
521
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/sigils/false_sigil.rb#10
|
522
|
+
class RuboCop::Cop::Sorbet::FalseSigil < ::RuboCop::Cop::Sorbet::HasSigil
|
523
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/sigils/false_sigil.rb#11
|
524
|
+
def minimum_strictness; end
|
525
|
+
end
|
526
|
+
|
527
|
+
# Disallow including the `Comparable` module in `T::Enum`.
|
528
|
+
#
|
529
|
+
# @example
|
530
|
+
#
|
531
|
+
# # bad
|
532
|
+
# class Priority < T::Enum
|
533
|
+
# include Comparable
|
534
|
+
#
|
535
|
+
# enums do
|
536
|
+
# High = new(3)
|
537
|
+
# Medium = new(2)
|
538
|
+
# Low = new(1)
|
539
|
+
# end
|
540
|
+
#
|
541
|
+
# def <=>(other)
|
542
|
+
# serialize <=> other.serialize
|
543
|
+
# end
|
544
|
+
# end
|
545
|
+
#
|
546
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/t_enum/forbid_comparable_t_enum.rb#24
|
547
|
+
class RuboCop::Cop::Sorbet::ForbidComparableTEnum < ::RuboCop::Cop::Base
|
548
|
+
include ::RuboCop::Cop::Sorbet::TEnum
|
549
|
+
|
550
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/t_enum/forbid_comparable_t_enum.rb#32
|
551
|
+
def mix_in_comparable?(param0 = T.unsafe(nil)); end
|
552
|
+
|
553
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/t_enum/forbid_comparable_t_enum.rb#36
|
554
|
+
def on_send(node); end
|
555
|
+
end
|
556
|
+
|
557
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/t_enum/forbid_comparable_t_enum.rb#27
|
558
|
+
RuboCop::Cop::Sorbet::ForbidComparableTEnum::MSG = T.let(T.unsafe(nil), String)
|
559
|
+
|
560
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/t_enum/forbid_comparable_t_enum.rb#29
|
561
|
+
RuboCop::Cop::Sorbet::ForbidComparableTEnum::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array)
|
562
|
+
|
563
|
+
# Ensures RBI shims do not include a call to extend T::Sig
|
564
|
+
# or to extend T::Helpers
|
565
|
+
#
|
566
|
+
# @example
|
567
|
+
#
|
568
|
+
# # bad
|
569
|
+
# module SomeModule
|
570
|
+
# extend T::Sig
|
571
|
+
# extend T::Helpers
|
572
|
+
#
|
573
|
+
# sig { returns(String) }
|
574
|
+
# def foo; end
|
575
|
+
# end
|
576
|
+
#
|
577
|
+
# # good
|
578
|
+
# module SomeModule
|
579
|
+
# sig { returns(String) }
|
580
|
+
# def foo; end
|
581
|
+
# end
|
582
|
+
#
|
583
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/rbi/forbid_extend_t_sig_helpers_in_shims.rb#25
|
584
|
+
class RuboCop::Cop::Sorbet::ForbidExtendTSigHelpersInShims < ::RuboCop::Cop::Base
|
585
|
+
include ::RuboCop::Cop::RangeHelp
|
586
|
+
extend ::RuboCop::Cop::AutoCorrector
|
587
|
+
|
588
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/rbi/forbid_extend_t_sig_helpers_in_shims.rb#33
|
589
|
+
def extend_t_sig_or_helpers?(param0 = T.unsafe(nil)); end
|
590
|
+
|
591
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/rbi/forbid_extend_t_sig_helpers_in_shims.rb#37
|
592
|
+
def on_send(node); end
|
593
|
+
end
|
594
|
+
|
595
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/rbi/forbid_extend_t_sig_helpers_in_shims.rb#29
|
596
|
+
RuboCop::Cop::Sorbet::ForbidExtendTSigHelpersInShims::MSG = T.let(T.unsafe(nil), String)
|
597
|
+
|
598
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/rbi/forbid_extend_t_sig_helpers_in_shims.rb#30
|
599
|
+
RuboCop::Cop::Sorbet::ForbidExtendTSigHelpersInShims::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array)
|
600
|
+
|
601
|
+
# Correct `send` expressions in include statements by constant literals.
|
602
|
+
#
|
603
|
+
# Sorbet, the static checker, is not (yet) able to support constructs on the
|
604
|
+
# following form:
|
605
|
+
#
|
606
|
+
# ```ruby
|
607
|
+
# class MyClass
|
608
|
+
# include send_expr
|
609
|
+
# end
|
610
|
+
# ```
|
611
|
+
#
|
612
|
+
# Multiple occurences of this can be found in Shopify's code base like:
|
613
|
+
#
|
614
|
+
# ```ruby
|
615
|
+
# include Rails.application.routes.url_helpers
|
616
|
+
# ```
|
617
|
+
# or
|
618
|
+
# ```ruby
|
619
|
+
# include Polaris::Engine.helpers
|
620
|
+
# ```
|
621
|
+
#
|
622
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/forbid_include_const_literal.rb#29
|
623
|
+
class RuboCop::Cop::Sorbet::ForbidIncludeConstLiteral < ::RuboCop::Cop::Base
|
624
|
+
extend ::RuboCop::Cop::AutoCorrector
|
625
|
+
|
626
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/forbid_include_const_literal.rb#36
|
627
|
+
def dynamic_inclusion?(param0 = T.unsafe(nil)); end
|
628
|
+
|
629
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/forbid_include_const_literal.rb#40
|
630
|
+
def on_send(node); end
|
631
|
+
|
632
|
+
private
|
633
|
+
|
634
|
+
# @return [Boolean]
|
635
|
+
#
|
636
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/forbid_include_const_literal.rb#52
|
637
|
+
def neither_const_nor_self?(node); end
|
638
|
+
|
639
|
+
# Returns true if the node is within a module declaration that is not anonymous.
|
640
|
+
#
|
641
|
+
# @return [Boolean]
|
642
|
+
#
|
643
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/forbid_include_const_literal.rb#57
|
644
|
+
def within_onymous_module?(node); end
|
645
|
+
end
|
646
|
+
|
647
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/forbid_include_const_literal.rb#32
|
648
|
+
RuboCop::Cop::Sorbet::ForbidIncludeConstLiteral::MSG = T.let(T.unsafe(nil), String)
|
649
|
+
|
650
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/forbid_include_const_literal.rb#33
|
651
|
+
RuboCop::Cop::Sorbet::ForbidIncludeConstLiteral::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array)
|
652
|
+
|
653
|
+
# Makes sure that RBI files are always located under the defined allowed paths.
|
654
|
+
#
|
655
|
+
# Options:
|
656
|
+
#
|
657
|
+
# * `AllowedPaths`: A list of the paths where RBI files are allowed (default: ["rbi/**", "sorbet/rbi/**"])
|
658
|
+
#
|
659
|
+
# @example
|
660
|
+
# # bad
|
661
|
+
# # lib/some_file.rbi
|
662
|
+
# # other_file.rbi
|
663
|
+
#
|
664
|
+
# # good
|
665
|
+
# # rbi/external_interface.rbi
|
666
|
+
# # sorbet/rbi/some_file.rbi
|
667
|
+
# # sorbet/rbi/any/path/for/file.rbi
|
668
|
+
#
|
669
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/rbi/forbid_rbi_outside_of_allowed_paths.rb#23
|
670
|
+
class RuboCop::Cop::Sorbet::ForbidRBIOutsideOfAllowedPaths < ::RuboCop::Cop::Cop
|
671
|
+
include ::RuboCop::Cop::RangeHelp
|
672
|
+
|
673
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/rbi/forbid_rbi_outside_of_allowed_paths.rb#26
|
674
|
+
def investigate(processed_source); end
|
675
|
+
|
676
|
+
private
|
677
|
+
|
678
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/rbi/forbid_rbi_outside_of_allowed_paths.rb#58
|
679
|
+
def allowed_paths; end
|
680
|
+
end
|
681
|
+
|
682
|
+
# Correct superclass `send` expressions by constant literals.
|
683
|
+
#
|
684
|
+
# Sorbet, the static checker, is not (yet) able to support constructs on the
|
685
|
+
# following form:
|
686
|
+
#
|
687
|
+
# ```ruby
|
688
|
+
# class Foo < send_expr; end
|
689
|
+
# ```
|
690
|
+
#
|
691
|
+
# Multiple occurences of this can be found in Shopify's code base like:
|
692
|
+
#
|
693
|
+
# ```ruby
|
694
|
+
# class ShopScope < Component::TrustedIdScope[ShopIdentity::ShopId]
|
695
|
+
# ```
|
696
|
+
# or
|
697
|
+
# ```ruby
|
698
|
+
# class ApiClientEligibility < Struct.new(:api_client, :match_results, :shop)
|
699
|
+
# ```
|
700
|
+
#
|
701
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/forbid_superclass_const_literal.rb#28
|
702
|
+
class RuboCop::Cop::Sorbet::ForbidSuperclassConstLiteral < ::RuboCop::Cop::Base
|
703
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/forbid_superclass_const_literal.rb#32
|
704
|
+
def dynamic_superclass?(param0 = T.unsafe(nil)); end
|
705
|
+
|
706
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/forbid_superclass_const_literal.rb#36
|
707
|
+
def on_class(node); end
|
708
|
+
end
|
709
|
+
|
710
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/forbid_superclass_const_literal.rb#29
|
711
|
+
RuboCop::Cop::Sorbet::ForbidSuperclassConstLiteral::MSG = T.let(T.unsafe(nil), String)
|
712
|
+
|
713
|
+
# Disallow using `T::Struct` and `T::Props`.
|
714
|
+
#
|
715
|
+
# @example
|
716
|
+
#
|
717
|
+
# # bad
|
718
|
+
# class MyStruct < T::Struct
|
719
|
+
# const :foo, String
|
720
|
+
# prop :bar, Integer, default: 0
|
721
|
+
#
|
722
|
+
# def some_method; end
|
723
|
+
# end
|
724
|
+
#
|
725
|
+
# # good
|
726
|
+
# class MyStruct
|
727
|
+
# extend T::Sig
|
728
|
+
#
|
729
|
+
# sig { returns(String) }
|
730
|
+
# attr_reader :foo
|
731
|
+
#
|
732
|
+
# sig { returns(Integer) }
|
733
|
+
# attr_accessor :bar
|
734
|
+
#
|
735
|
+
# sig { params(foo: String, bar: Integer) }
|
736
|
+
# def initialize(foo:, bar: 0)
|
737
|
+
# @foo = foo
|
738
|
+
# @bar = bar
|
739
|
+
# end
|
740
|
+
#
|
741
|
+
# def some_method; end
|
742
|
+
# end
|
743
|
+
#
|
744
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/forbid_t_struct.rb#38
|
745
|
+
class RuboCop::Cop::Sorbet::ForbidTStruct < ::RuboCop::Cop::Base
|
746
|
+
include ::RuboCop::Cop::Alignment
|
747
|
+
include ::RuboCop::Cop::RangeHelp
|
748
|
+
include ::RuboCop::Cop::CommentsHelp
|
749
|
+
extend ::RuboCop::Cop::AutoCorrector
|
750
|
+
|
751
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/forbid_t_struct.rb#169
|
752
|
+
def on_class(node); end
|
753
|
+
|
754
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/forbid_t_struct.rb#210
|
755
|
+
def on_send(node); end
|
756
|
+
|
757
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/forbid_t_struct.rb#167
|
758
|
+
def t_props?(param0 = T.unsafe(nil)); end
|
759
|
+
|
760
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/forbid_t_struct.rb#162
|
761
|
+
def t_struct?(param0 = T.unsafe(nil)); end
|
762
|
+
|
763
|
+
private
|
764
|
+
|
765
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/forbid_t_struct.rb#218
|
766
|
+
def initialize_method(indent, props); end
|
767
|
+
|
768
|
+
# @return [Boolean]
|
769
|
+
#
|
770
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/forbid_t_struct.rb#258
|
771
|
+
def previous_line_blank?(node); end
|
772
|
+
end
|
773
|
+
|
774
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/forbid_t_struct.rb#47
|
775
|
+
RuboCop::Cop::Sorbet::ForbidTStruct::MSG_PROPS = T.let(T.unsafe(nil), String)
|
776
|
+
|
777
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/forbid_t_struct.rb#46
|
778
|
+
RuboCop::Cop::Sorbet::ForbidTStruct::MSG_STRUCT = T.let(T.unsafe(nil), String)
|
779
|
+
|
780
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/forbid_t_struct.rb#104
|
781
|
+
class RuboCop::Cop::Sorbet::ForbidTStruct::Property
|
782
|
+
# @return [Property] a new instance of Property
|
783
|
+
#
|
784
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/forbid_t_struct.rb#107
|
785
|
+
def initialize(node, kind, name, type, default:, factory:); end
|
786
|
+
|
787
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/forbid_t_struct.rb#123
|
788
|
+
def attr_accessor; end
|
789
|
+
|
790
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/forbid_t_struct.rb#119
|
791
|
+
def attr_sig; end
|
792
|
+
|
793
|
+
# Returns the value of attribute default.
|
794
|
+
#
|
795
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/forbid_t_struct.rb#105
|
796
|
+
def default; end
|
797
|
+
|
798
|
+
# Returns the value of attribute factory.
|
799
|
+
#
|
800
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/forbid_t_struct.rb#105
|
801
|
+
def factory; end
|
802
|
+
|
803
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/forbid_t_struct.rb#144
|
804
|
+
def initialize_assign; end
|
805
|
+
|
806
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/forbid_t_struct.rb#131
|
807
|
+
def initialize_param; end
|
808
|
+
|
809
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/forbid_t_struct.rb#127
|
810
|
+
def initialize_sig_param; end
|
811
|
+
|
812
|
+
# Returns the value of attribute kind.
|
813
|
+
#
|
814
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/forbid_t_struct.rb#105
|
815
|
+
def kind; end
|
816
|
+
|
817
|
+
# Returns the value of attribute name.
|
818
|
+
#
|
819
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/forbid_t_struct.rb#105
|
820
|
+
def name; end
|
821
|
+
|
822
|
+
# @return [Boolean]
|
823
|
+
#
|
824
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/forbid_t_struct.rb#151
|
825
|
+
def nilable?; end
|
826
|
+
|
827
|
+
# Returns the value of attribute node.
|
828
|
+
#
|
829
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/forbid_t_struct.rb#105
|
830
|
+
def node; end
|
831
|
+
|
832
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/forbid_t_struct.rb#155
|
833
|
+
def type; end
|
834
|
+
end
|
835
|
+
|
836
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/forbid_t_struct.rb#44
|
837
|
+
RuboCop::Cop::Sorbet::ForbidTStruct::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array)
|
838
|
+
|
839
|
+
# This class walks down the class body of a T::Struct and collects all the properties that will need to be
|
840
|
+
# translated into `attr_reader` and `attr_accessor` methods.
|
841
|
+
#
|
842
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/forbid_t_struct.rb#51
|
843
|
+
class RuboCop::Cop::Sorbet::ForbidTStruct::TStructWalker
|
844
|
+
include ::RuboCop::AST::Traversal
|
845
|
+
extend ::RuboCop::AST::NodePattern::Macros
|
846
|
+
|
847
|
+
# @return [TStructWalker] a new instance of TStructWalker
|
848
|
+
#
|
849
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/forbid_t_struct.rb#57
|
850
|
+
def initialize; end
|
851
|
+
|
852
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/forbid_t_struct.rb#63
|
853
|
+
def extend_t_sig?(param0 = T.unsafe(nil)); end
|
854
|
+
|
855
|
+
# Returns the value of attribute has_extend_t_sig.
|
856
|
+
#
|
857
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/forbid_t_struct.rb#55
|
858
|
+
def has_extend_t_sig; end
|
859
|
+
|
860
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/forbid_t_struct.rb#72
|
861
|
+
def on_send(node); end
|
862
|
+
|
863
|
+
# Returns the value of attribute props.
|
864
|
+
#
|
865
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/forbid_t_struct.rb#55
|
866
|
+
def props; end
|
867
|
+
|
868
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/forbid_t_struct.rb#68
|
869
|
+
def t_struct_prop?(param0 = T.unsafe(nil)); end
|
870
|
+
end
|
871
|
+
|
872
|
+
# Disallows using `T.unsafe` anywhere.
|
873
|
+
#
|
874
|
+
# @example
|
875
|
+
#
|
876
|
+
# # bad
|
877
|
+
# T.unsafe(foo)
|
878
|
+
#
|
879
|
+
# # good
|
880
|
+
# foo
|
881
|
+
#
|
882
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/forbid_t_unsafe.rb#17
|
883
|
+
class RuboCop::Cop::Sorbet::ForbidTUnsafe < ::RuboCop::Cop::Base
|
884
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/forbid_t_unsafe.rb#24
|
885
|
+
def on_send(node); end
|
886
|
+
|
887
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/forbid_t_unsafe.rb#22
|
888
|
+
def t_unsafe?(param0 = T.unsafe(nil)); end
|
889
|
+
end
|
890
|
+
|
891
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/forbid_t_unsafe.rb#18
|
892
|
+
RuboCop::Cop::Sorbet::ForbidTUnsafe::MSG = T.let(T.unsafe(nil), String)
|
893
|
+
|
894
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/forbid_t_unsafe.rb#19
|
895
|
+
RuboCop::Cop::Sorbet::ForbidTUnsafe::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array)
|
896
|
+
|
897
|
+
# Disallows using `T.untyped` anywhere.
|
898
|
+
#
|
899
|
+
# @example
|
900
|
+
#
|
901
|
+
# # bad
|
902
|
+
# sig { params(my_argument: T.untyped).void }
|
903
|
+
# def foo(my_argument); end
|
904
|
+
#
|
905
|
+
# # good
|
906
|
+
# sig { params(my_argument: String).void }
|
907
|
+
# def foo(my_argument); end
|
908
|
+
#
|
909
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/forbid_t_untyped.rb#20
|
910
|
+
class RuboCop::Cop::Sorbet::ForbidTUntyped < ::RuboCop::Cop::Base
|
911
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/forbid_t_untyped.rb#27
|
912
|
+
def on_send(node); end
|
913
|
+
|
914
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/forbid_t_untyped.rb#25
|
915
|
+
def t_untyped?(param0 = T.unsafe(nil)); end
|
916
|
+
end
|
917
|
+
|
918
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/forbid_t_untyped.rb#21
|
919
|
+
RuboCop::Cop::Sorbet::ForbidTUntyped::MSG = T.let(T.unsafe(nil), String)
|
920
|
+
|
921
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/forbid_t_untyped.rb#22
|
922
|
+
RuboCop::Cop::Sorbet::ForbidTUntyped::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array)
|
923
|
+
|
924
|
+
# Disallows defining type aliases that contain shapes
|
925
|
+
#
|
926
|
+
# @example
|
927
|
+
#
|
928
|
+
# # bad
|
929
|
+
# Foo = T.type_alias { { foo: Integer } }
|
930
|
+
#
|
931
|
+
# # good
|
932
|
+
# class Foo
|
933
|
+
# extend T::Sig
|
934
|
+
#
|
935
|
+
# sig { params(foo: Integer).void }
|
936
|
+
# def initialize(foo)
|
937
|
+
# @foo = foo
|
938
|
+
# end
|
939
|
+
# end
|
940
|
+
#
|
941
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/forbid_type_aliased_shapes.rb#24
|
942
|
+
class RuboCop::Cop::Sorbet::ForbidTypeAliasedShapes < ::RuboCop::Cop::Base
|
943
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/forbid_type_aliased_shapes.rb#36
|
944
|
+
def on_block(node); end
|
945
|
+
|
946
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/forbid_type_aliased_shapes.rb#36
|
947
|
+
def on_numblock(node); end
|
948
|
+
|
949
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/forbid_type_aliased_shapes.rb#28
|
950
|
+
def shape_type_alias?(param0 = T.unsafe(nil)); end
|
951
|
+
end
|
952
|
+
|
953
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/forbid_type_aliased_shapes.rb#25
|
954
|
+
RuboCop::Cop::Sorbet::ForbidTypeAliasedShapes::MSG = T.let(T.unsafe(nil), String)
|
955
|
+
|
956
|
+
# Disallows use of `T.untyped` or `T.nilable(T.untyped)`
|
957
|
+
# as a prop type for `T::Struct` or `T::ImmutableStruct`.
|
958
|
+
#
|
959
|
+
# @example
|
960
|
+
#
|
961
|
+
# # bad
|
962
|
+
# class SomeClass < T::Struct
|
963
|
+
# const :foo, T.untyped
|
964
|
+
# prop :bar, T.nilable(T.untyped)
|
965
|
+
# end
|
966
|
+
#
|
967
|
+
# # good
|
968
|
+
# class SomeClass < T::Struct
|
969
|
+
# const :foo, Integer
|
970
|
+
# prop :bar, T.nilable(String)
|
971
|
+
# end
|
972
|
+
#
|
973
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/forbid_untyped_struct_props.rb#25
|
974
|
+
class RuboCop::Cop::Sorbet::ForbidUntypedStructProps < ::RuboCop::Cop::Base
|
975
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/forbid_untyped_struct_props.rb#54
|
976
|
+
def on_class(node); end
|
977
|
+
|
978
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/forbid_untyped_struct_props.rb#44
|
979
|
+
def subclass_of_t_struct?(param0 = T.unsafe(nil)); end
|
980
|
+
|
981
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/forbid_untyped_struct_props.rb#39
|
982
|
+
def t_nilable_untyped(param0 = T.unsafe(nil)); end
|
983
|
+
|
984
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/forbid_untyped_struct_props.rb#29
|
985
|
+
def t_struct(param0 = T.unsafe(nil)); end
|
986
|
+
|
987
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/forbid_untyped_struct_props.rb#34
|
988
|
+
def t_untyped(param0 = T.unsafe(nil)); end
|
989
|
+
|
990
|
+
# Search for untyped prop/const declarations and capture their types
|
991
|
+
#
|
992
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/forbid_untyped_struct_props.rb#50
|
993
|
+
def untyped_props(param0); end
|
994
|
+
end
|
995
|
+
|
996
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/forbid_untyped_struct_props.rb#26
|
997
|
+
RuboCop::Cop::Sorbet::ForbidUntypedStructProps::MSG = T.let(T.unsafe(nil), String)
|
998
|
+
|
999
|
+
# Makes the Sorbet typed sigil mandatory in all files.
|
1000
|
+
#
|
1001
|
+
# Options:
|
1002
|
+
#
|
1003
|
+
# * `SuggestedStrictness`: Sorbet strictness level suggested in offense messages (default: 'false')
|
1004
|
+
# * `MinimumStrictness`: If set, make offense if the strictness level in the file is below this one
|
1005
|
+
#
|
1006
|
+
# If a `MinimumStrictness` level is specified, it will be used in offense messages and autocorrect.
|
1007
|
+
#
|
1008
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/sigils/has_sigil.rb#17
|
1009
|
+
class RuboCop::Cop::Sorbet::HasSigil < ::RuboCop::Cop::Sorbet::ValidSigil
|
1010
|
+
# @return [Boolean]
|
1011
|
+
#
|
1012
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/sigils/has_sigil.rb#20
|
1013
|
+
def require_sigil_on_all_files?; end
|
1014
|
+
end
|
1015
|
+
|
1016
|
+
# Makes the Sorbet `ignore` sigil mandatory in all files.
|
1017
|
+
#
|
1018
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/sigils/ignore_sigil.rb#10
|
1019
|
+
class RuboCop::Cop::Sorbet::IgnoreSigil < ::RuboCop::Cop::Sorbet::HasSigil
|
1020
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/sigils/ignore_sigil.rb#11
|
1021
|
+
def minimum_strictness; end
|
1022
|
+
end
|
1023
|
+
|
1024
|
+
# Disallows declaring implicit conversion methods.
|
1025
|
+
# Since Sorbet is a nominal (not structural) type system,
|
1026
|
+
# implicit conversion is currently unsupported.
|
1027
|
+
#
|
1028
|
+
# @example
|
1029
|
+
#
|
1030
|
+
# # bad
|
1031
|
+
# def to_str; end
|
1032
|
+
#
|
1033
|
+
# # good
|
1034
|
+
# def to_str(x); end
|
1035
|
+
#
|
1036
|
+
# # bad
|
1037
|
+
# def self.to_str; end
|
1038
|
+
#
|
1039
|
+
# # good
|
1040
|
+
# def self.to_str(x); end
|
1041
|
+
#
|
1042
|
+
# # bad
|
1043
|
+
# alias to_str to_s
|
1044
|
+
# @note Since the arity of aliased methods is not checked, false positives may result.
|
1045
|
+
# @see https://docs.ruby-lang.org/en/master/implicit_conversion_rdoc.html
|
1046
|
+
#
|
1047
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/implicit_conversion_method.rb#31
|
1048
|
+
class RuboCop::Cop::Sorbet::ImplicitConversionMethod < ::RuboCop::Cop::Base
|
1049
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/implicit_conversion_method.rb#37
|
1050
|
+
def on_alias(node); end
|
1051
|
+
|
1052
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/implicit_conversion_method.rb#42
|
1053
|
+
def on_def(node); end
|
1054
|
+
|
1055
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/implicit_conversion_method.rb#42
|
1056
|
+
def on_defs(node); end
|
1057
|
+
|
1058
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/implicit_conversion_method.rb#50
|
1059
|
+
def on_send(node); end
|
1060
|
+
end
|
1061
|
+
|
1062
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/implicit_conversion_method.rb#32
|
1063
|
+
RuboCop::Cop::Sorbet::ImplicitConversionMethod::IMPLICIT_CONVERSION_METHODS = T.let(T.unsafe(nil), Array)
|
1064
|
+
|
1065
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/implicit_conversion_method.rb#33
|
1066
|
+
RuboCop::Cop::Sorbet::ImplicitConversionMethod::MSG = T.let(T.unsafe(nil), String)
|
1067
|
+
|
1068
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/implicit_conversion_method.rb#35
|
1069
|
+
RuboCop::Cop::Sorbet::ImplicitConversionMethod::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array)
|
1070
|
+
|
1071
|
+
# Checks for the ordering of keyword arguments required by
|
1072
|
+
# sorbet-runtime. The ordering requires that all keyword arguments
|
1073
|
+
# are at the end of the parameters list, and all keyword arguments
|
1074
|
+
# with a default value must be after those without default values.
|
1075
|
+
#
|
1076
|
+
# @example
|
1077
|
+
#
|
1078
|
+
# # bad
|
1079
|
+
# sig { params(a: Integer, b: String).void }
|
1080
|
+
# def foo(a: 1, b:); end
|
1081
|
+
#
|
1082
|
+
# # good
|
1083
|
+
# sig { params(b: String, a: Integer).void }
|
1084
|
+
# def foo(b:, a: 1); end
|
1085
|
+
#
|
1086
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/signatures/keyword_argument_ordering.rb#20
|
1087
|
+
class RuboCop::Cop::Sorbet::KeywordArgumentOrdering < ::RuboCop::Cop::Cop
|
1088
|
+
include ::RuboCop::Cop::Sorbet::SignatureHelp
|
1089
|
+
|
1090
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/signatures/keyword_argument_ordering.rb#23
|
1091
|
+
def on_signature(node); end
|
1092
|
+
|
1093
|
+
private
|
1094
|
+
|
1095
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/signatures/keyword_argument_ordering.rb#34
|
1096
|
+
def check_order_for_kwoptargs(parameters); end
|
1097
|
+
end
|
1098
|
+
|
1099
|
+
# Disallow creating a `T::Enum` with less than two values.
|
1100
|
+
#
|
1101
|
+
# @example
|
1102
|
+
#
|
1103
|
+
# # bad
|
1104
|
+
# class ErrorMessages < T::Enum
|
1105
|
+
# enums do
|
1106
|
+
# ServerError = new("There was a server error.")
|
1107
|
+
# end
|
1108
|
+
# end
|
1109
|
+
#
|
1110
|
+
# # good
|
1111
|
+
# class ErrorMessages < T::Enum
|
1112
|
+
# enums do
|
1113
|
+
# ServerError = new("There was a server error.")
|
1114
|
+
# NotFound = new("The resource was not found.")
|
1115
|
+
# end
|
1116
|
+
# end
|
1117
|
+
#
|
1118
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/t_enum/multiple_t_enum_values.rb#24
|
1119
|
+
class RuboCop::Cop::Sorbet::MultipleTEnumValues < ::RuboCop::Cop::Base
|
1120
|
+
include ::RuboCop::Cop::Sorbet::TEnum
|
1121
|
+
|
1122
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/t_enum/multiple_t_enum_values.rb#30
|
1123
|
+
def enums_block?(param0 = T.unsafe(nil)); end
|
1124
|
+
|
1125
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/t_enum/multiple_t_enum_values.rb#40
|
1126
|
+
def on_block(node); end
|
1127
|
+
|
1128
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/t_enum/multiple_t_enum_values.rb#34
|
1129
|
+
def on_class(node); end
|
1130
|
+
end
|
1131
|
+
|
1132
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/t_enum/multiple_t_enum_values.rb#27
|
1133
|
+
RuboCop::Cop::Sorbet::MultipleTEnumValues::MSG = T.let(T.unsafe(nil), String)
|
1134
|
+
|
1135
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/mutable_constant_sorbet_aware_behaviour.rb#8
|
1136
|
+
module RuboCop::Cop::Sorbet::MutableConstantSorbetAwareBehaviour
|
1137
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/mutable_constant_sorbet_aware_behaviour.rb#18
|
1138
|
+
def on_assignment(value); end
|
1139
|
+
|
1140
|
+
class << self
|
1141
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/mutable_constant_sorbet_aware_behaviour.rb#10
|
1142
|
+
def prepended(base); end
|
1143
|
+
end
|
1144
|
+
end
|
1145
|
+
|
1146
|
+
# Checks for the obsolete pattern for initializing instance variables that was required for older Sorbet
|
1147
|
+
#
|
1148
|
+
# It's no longer required, as of Sorbet 0.5.10210
|
1149
|
+
# See https://sorbet.org/docs/type-assertions#put-type-assertions-behind-memoization
|
1150
|
+
#
|
1151
|
+
# @example
|
1152
|
+
#
|
1153
|
+
# # bad
|
1154
|
+
# sig { returns(Foo) }
|
1155
|
+
# def foo
|
1156
|
+
# @foo = T.let(@foo, T.nilable(Foo))
|
1157
|
+
# @foo ||= Foo.new
|
1158
|
+
# end
|
1159
|
+
#
|
1160
|
+
# # bad
|
1161
|
+
# sig { returns(Foo) }
|
1162
|
+
# def foo
|
1163
|
+
# # This would have been a mistake, causing the memoized value to be discarded and recomputed on every call.
|
1164
|
+
# @foo = T.let(nil, T.nilable(Foo))
|
1165
|
+
# @foo ||= Foo.new
|
1166
|
+
# end
|
1167
|
+
#
|
1168
|
+
# # good
|
1169
|
+
# sig { returns(Foo) }
|
1170
|
+
# def foo
|
1171
|
+
# @foo ||= T.let(Foo.new, T.nilable(Foo))
|
1172
|
+
# end
|
1173
|
+
#
|
1174
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/obsolete_strict_memoization.rb#37
|
1175
|
+
class RuboCop::Cop::Sorbet::ObsoleteStrictMemoization < ::RuboCop::Cop::Base
|
1176
|
+
include ::RuboCop::Cop::RangeHelp
|
1177
|
+
include ::RuboCop::Cop::MatchRange
|
1178
|
+
include ::RuboCop::Cop::Alignment
|
1179
|
+
include ::RuboCop::Cop::LineLengthHelp
|
1180
|
+
include ::RuboCop::Cop::Sorbet::TargetSorbetVersion
|
1181
|
+
extend ::RuboCop::Cop::AutoCorrector
|
1182
|
+
extend ::RuboCop::Cop::Sorbet::TargetSorbetVersion::ClassMethods
|
1183
|
+
|
1184
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/obsolete_strict_memoization.rb#51
|
1185
|
+
def legacy_memoization_pattern?(param0 = T.unsafe(nil)); end
|
1186
|
+
|
1187
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/obsolete_strict_memoization.rb#62
|
1188
|
+
def on_begin(node); end
|
1189
|
+
|
1190
|
+
# @return [Boolean]
|
1191
|
+
#
|
1192
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/obsolete_strict_memoization.rb#86
|
1193
|
+
def relevant_file?(file); end
|
1194
|
+
end
|
1195
|
+
|
1196
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/obsolete_strict_memoization.rb#47
|
1197
|
+
RuboCop::Cop::Sorbet::ObsoleteStrictMemoization::MSG = T.let(T.unsafe(nil), String)
|
1198
|
+
|
1199
|
+
# Forbids the use of redundant `extend T::Sig`. Only for use in
|
1200
|
+
# applications that monkey patch `Module.include(T::Sig)` globally,
|
1201
|
+
# which would make it redundant.
|
1202
|
+
#
|
1203
|
+
# @example
|
1204
|
+
# # bad
|
1205
|
+
# class Example
|
1206
|
+
# extend T::Sig
|
1207
|
+
# sig { void }
|
1208
|
+
# def no_op; end
|
1209
|
+
# end
|
1210
|
+
#
|
1211
|
+
# # good
|
1212
|
+
# class Example
|
1213
|
+
# sig { void }
|
1214
|
+
# def no_op; end
|
1215
|
+
# end
|
1216
|
+
#
|
1217
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/redundant_extend_t_sig.rb#28
|
1218
|
+
class RuboCop::Cop::Sorbet::RedundantExtendTSig < ::RuboCop::Cop::Base
|
1219
|
+
include ::RuboCop::Cop::RangeHelp
|
1220
|
+
extend ::RuboCop::Cop::AutoCorrector
|
1221
|
+
|
1222
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/redundant_extend_t_sig.rb#36
|
1223
|
+
def extend_t_sig?(param0 = T.unsafe(nil)); end
|
1224
|
+
|
1225
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/redundant_extend_t_sig.rb#40
|
1226
|
+
def on_send(node); end
|
1227
|
+
end
|
1228
|
+
|
1229
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/redundant_extend_t_sig.rb#32
|
1230
|
+
RuboCop::Cop::Sorbet::RedundantExtendTSig::MSG = T.let(T.unsafe(nil), String)
|
1231
|
+
|
1232
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/redundant_extend_t_sig.rb#33
|
1233
|
+
RuboCop::Cop::Sorbet::RedundantExtendTSig::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array)
|
1234
|
+
|
1235
|
+
# Checks for the correct order of `sig` builder methods.
|
1236
|
+
#
|
1237
|
+
# Options:
|
1238
|
+
#
|
1239
|
+
# * `Order`: The order in which to enforce the builder methods are called.
|
1240
|
+
#
|
1241
|
+
# @example
|
1242
|
+
# # bad
|
1243
|
+
# sig { void.abstract }
|
1244
|
+
#
|
1245
|
+
# # good
|
1246
|
+
# sig { abstract.void }
|
1247
|
+
#
|
1248
|
+
# # bad
|
1249
|
+
# sig { returns(Integer).params(x: Integer) }
|
1250
|
+
#
|
1251
|
+
# # good
|
1252
|
+
# sig { params(x: Integer).returns(Integer) }
|
1253
|
+
#
|
1254
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/signatures/signature_build_order.rb#24
|
1255
|
+
class RuboCop::Cop::Sorbet::SignatureBuildOrder < ::RuboCop::Cop::Base
|
1256
|
+
include ::RuboCop::Cop::Sorbet::SignatureHelp
|
1257
|
+
extend ::RuboCop::Cop::AutoCorrector
|
1258
|
+
|
1259
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/signatures/signature_build_order.rb#33
|
1260
|
+
def on_signature(node); end
|
1261
|
+
|
1262
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/signatures/signature_build_order.rb#29
|
1263
|
+
def root_call(param0); end
|
1264
|
+
|
1265
|
+
private
|
1266
|
+
|
1267
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/signatures/signature_build_order.rb#96
|
1268
|
+
def builder_method_indexes; end
|
1269
|
+
|
1270
|
+
# Split foo.bar.baz into [foo, foo.bar, foo.bar.baz]
|
1271
|
+
#
|
1272
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/signatures/signature_build_order.rb#83
|
1273
|
+
def call_chain(node); end
|
1274
|
+
|
1275
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/signatures/signature_build_order.rb#70
|
1276
|
+
def expected_source(expected_calls_and_indexes); end
|
1277
|
+
end
|
1278
|
+
|
1279
|
+
# Mixin for writing cops for signatures, providing a `signature?` node matcher and an `on_signature` trigger.
|
1280
|
+
#
|
1281
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/mixin/signature_help.rb#7
|
1282
|
+
module RuboCop::Cop::Sorbet::SignatureHelp
|
1283
|
+
extend ::RuboCop::AST::NodePattern::Macros
|
1284
|
+
|
1285
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/mixin/signature_help.rb#29
|
1286
|
+
def on_block(node); end
|
1287
|
+
|
1288
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/mixin/signature_help.rb#29
|
1289
|
+
def on_numblock(node); end
|
1290
|
+
|
1291
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/mixin/signature_help.rb#35
|
1292
|
+
def on_signature(_node); end
|
1293
|
+
|
1294
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/mixin/signature_help.rb#11
|
1295
|
+
def signature?(param0 = T.unsafe(nil)); end
|
1296
|
+
|
1297
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/mixin/signature_help.rb#20
|
1298
|
+
def with_runtime?(param0 = T.unsafe(nil)); end
|
1299
|
+
|
1300
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/mixin/signature_help.rb#25
|
1301
|
+
def without_runtime?(param0 = T.unsafe(nil)); end
|
1302
|
+
end
|
1303
|
+
|
1304
|
+
# Ensures empty class/module definitions in RBI files are
|
1305
|
+
# done on a single line rather than being split across multiple lines.
|
1306
|
+
#
|
1307
|
+
# @example
|
1308
|
+
#
|
1309
|
+
# # bad
|
1310
|
+
# module SomeModule
|
1311
|
+
# end
|
1312
|
+
#
|
1313
|
+
# # good
|
1314
|
+
# module SomeModule; end
|
1315
|
+
#
|
1316
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/rbi/single_line_rbi_class_module_definitions.rb#17
|
1317
|
+
class RuboCop::Cop::Sorbet::SingleLineRbiClassModuleDefinitions < ::RuboCop::Cop::Base
|
1318
|
+
extend ::RuboCop::Cop::AutoCorrector
|
1319
|
+
|
1320
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/rbi/single_line_rbi_class_module_definitions.rb#22
|
1321
|
+
def on_class(node); end
|
1322
|
+
|
1323
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/rbi/single_line_rbi_class_module_definitions.rb#22
|
1324
|
+
def on_module(node); end
|
1325
|
+
|
1326
|
+
private
|
1327
|
+
|
1328
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/rbi/single_line_rbi_class_module_definitions.rb#34
|
1329
|
+
def convert_newlines_to_semicolons(source); end
|
1330
|
+
end
|
1331
|
+
|
1332
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/rbi/single_line_rbi_class_module_definitions.rb#20
|
1333
|
+
RuboCop::Cop::Sorbet::SingleLineRbiClassModuleDefinitions::MSG = T.let(T.unsafe(nil), String)
|
1334
|
+
|
1335
|
+
# Makes the Sorbet `strict` sigil mandatory in all files.
|
1336
|
+
#
|
1337
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/sigils/strict_sigil.rb#10
|
1338
|
+
class RuboCop::Cop::Sorbet::StrictSigil < ::RuboCop::Cop::Sorbet::HasSigil
|
1339
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/sigils/strict_sigil.rb#11
|
1340
|
+
def minimum_strictness; end
|
1341
|
+
end
|
1342
|
+
|
1343
|
+
# Makes the Sorbet `strong` sigil mandatory in all files.
|
1344
|
+
#
|
1345
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/sigils/strong_sigil.rb#10
|
1346
|
+
class RuboCop::Cop::Sorbet::StrongSigil < ::RuboCop::Cop::Sorbet::HasSigil
|
1347
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/sigils/strong_sigil.rb#11
|
1348
|
+
def minimum_strictness; end
|
1349
|
+
end
|
1350
|
+
|
1351
|
+
# Mixing for writing cops that deal with `T::Enum`s
|
1352
|
+
#
|
1353
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/mixin/t_enum.rb#7
|
1354
|
+
module RuboCop::Cop::Sorbet::TEnum
|
1355
|
+
extend ::RuboCop::AST::NodePattern::Macros
|
1356
|
+
|
1357
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/mixin/t_enum.rb#9
|
1358
|
+
def initialize(*_arg0); end
|
1359
|
+
|
1360
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/mixin/t_enum.rb#23
|
1361
|
+
def after_class(node); end
|
1362
|
+
|
1363
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/mixin/t_enum.rb#19
|
1364
|
+
def on_class(node); end
|
1365
|
+
|
1366
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/mixin/t_enum.rb#15
|
1367
|
+
def t_enum?(param0 = T.unsafe(nil)); end
|
1368
|
+
|
1369
|
+
private
|
1370
|
+
|
1371
|
+
# @return [Boolean]
|
1372
|
+
#
|
1373
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/mixin/t_enum.rb#29
|
1374
|
+
def in_t_enum_class?; end
|
1375
|
+
end
|
1376
|
+
|
1377
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/mixin/target_sorbet_version.rb#6
|
1378
|
+
module RuboCop::Cop::Sorbet::TargetSorbetVersion
|
1379
|
+
mixes_in_class_methods ::RuboCop::Cop::Sorbet::TargetSorbetVersion::ClassMethods
|
1380
|
+
|
1381
|
+
# @return [Boolean]
|
1382
|
+
#
|
1383
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/mixin/target_sorbet_version.rb#28
|
1384
|
+
def enabled_for_sorbet_static_version?; end
|
1385
|
+
|
1386
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/mixin/target_sorbet_version.rb#44
|
1387
|
+
def read_sorbet_static_version_from_bundler_lock_file; end
|
1388
|
+
|
1389
|
+
# @return [Boolean]
|
1390
|
+
#
|
1391
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/mixin/target_sorbet_version.rb#24
|
1392
|
+
def sorbet_enabled?; end
|
1393
|
+
|
1394
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/mixin/target_sorbet_version.rb#35
|
1395
|
+
def target_sorbet_static_version_from_bundler_lock_file; end
|
1396
|
+
|
1397
|
+
class << self
|
1398
|
+
# @private
|
1399
|
+
#
|
1400
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/mixin/target_sorbet_version.rb#8
|
1401
|
+
def included(target); end
|
1402
|
+
end
|
1403
|
+
end
|
1404
|
+
|
1405
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/mixin/target_sorbet_version.rb#13
|
1406
|
+
module RuboCop::Cop::Sorbet::TargetSorbetVersion::ClassMethods
|
1407
|
+
# Sets the version of the Sorbet static type checker required by this cop
|
1408
|
+
#
|
1409
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/mixin/target_sorbet_version.rb#15
|
1410
|
+
def minimum_target_sorbet_static_version(version); end
|
1411
|
+
|
1412
|
+
# @return [Boolean]
|
1413
|
+
#
|
1414
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/mixin/target_sorbet_version.rb#19
|
1415
|
+
def supports_target_sorbet_static_version?(version); end
|
1416
|
+
end
|
1417
|
+
|
1418
|
+
# Makes the Sorbet `true` sigil mandatory in all files.
|
1419
|
+
#
|
1420
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/sigils/true_sigil.rb#10
|
1421
|
+
class RuboCop::Cop::Sorbet::TrueSigil < ::RuboCop::Cop::Sorbet::HasSigil
|
1422
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/sigils/true_sigil.rb#11
|
1423
|
+
def minimum_strictness; end
|
1424
|
+
end
|
1425
|
+
|
1426
|
+
# Ensures all constants used as `T.type_alias` are using CamelCase.
|
1427
|
+
#
|
1428
|
+
# @example
|
1429
|
+
#
|
1430
|
+
# # bad
|
1431
|
+
# FOO_OR_BAR = T.type_alias { T.any(Foo, Bar) }
|
1432
|
+
#
|
1433
|
+
# # good
|
1434
|
+
# FooOrBar = T.type_alias { T.any(Foo, Bar) }
|
1435
|
+
#
|
1436
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/type_alias_name.rb#17
|
1437
|
+
class RuboCop::Cop::Sorbet::TypeAliasName < ::RuboCop::Cop::Base
|
1438
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/type_alias_name.rb#32
|
1439
|
+
def on_casgn(node); end
|
1440
|
+
|
1441
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/type_alias_name.rb#21
|
1442
|
+
def underscored_type_alias?(param0 = T.unsafe(nil)); end
|
1443
|
+
end
|
1444
|
+
|
1445
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/type_alias_name.rb#18
|
1446
|
+
RuboCop::Cop::Sorbet::TypeAliasName::MSG = T.let(T.unsafe(nil), String)
|
1447
|
+
|
1448
|
+
# Checks that every Ruby file contains a valid Sorbet sigil.
|
1449
|
+
# Adapted from: https://gist.github.com/clarkdave/85aca4e16f33fd52aceb6a0a29936e52
|
1450
|
+
#
|
1451
|
+
# Options:
|
1452
|
+
#
|
1453
|
+
# * `RequireSigilOnAllFiles`: make offense if the Sorbet typed is not found in the file (default: false)
|
1454
|
+
# * `SuggestedStrictness`: Sorbet strictness level suggested in offense messages (default: 'false')
|
1455
|
+
# * `MinimumStrictness`: If set, make offense if the strictness level in the file is below this one
|
1456
|
+
# * `ExactStrictness`: If set, make offense if the strictness level in the file is different than this one
|
1457
|
+
#
|
1458
|
+
# If an `ExactStrictness` level is specified, it will be used in offense messages and autocorrect.
|
1459
|
+
# Otherwise, if a `MinimumStrictness` level is specified, it will be used in offense messages and autocorrect.
|
1460
|
+
#
|
1461
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/sigils/valid_sigil.rb#20
|
1462
|
+
class RuboCop::Cop::Sorbet::ValidSigil < ::RuboCop::Cop::Cop
|
1463
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/sigils/valid_sigil.rb#36
|
1464
|
+
def autocorrect(_node); end
|
1465
|
+
|
1466
|
+
# So we can properly subclass this cop
|
1467
|
+
#
|
1468
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/sigils/valid_sigil.rb#23
|
1469
|
+
def investigate(processed_source); end
|
1470
|
+
|
1471
|
+
protected
|
1472
|
+
|
1473
|
+
# checks
|
1474
|
+
#
|
1475
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/sigils/valid_sigil.rb#71
|
1476
|
+
def check_sigil_present(sigil); end
|
1477
|
+
|
1478
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/sigils/valid_sigil.rb#131
|
1479
|
+
def check_strictness_level(sigil, strictness); end
|
1480
|
+
|
1481
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/sigils/valid_sigil.rb#109
|
1482
|
+
def check_strictness_not_empty(sigil, strictness); end
|
1483
|
+
|
1484
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/sigils/valid_sigil.rb#120
|
1485
|
+
def check_strictness_valid(sigil, strictness); end
|
1486
|
+
|
1487
|
+
# Default is `nil`
|
1488
|
+
#
|
1489
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/sigils/valid_sigil.rb#181
|
1490
|
+
def exact_strictness; end
|
1491
|
+
|
1492
|
+
# extraction
|
1493
|
+
#
|
1494
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/sigils/valid_sigil.rb#59
|
1495
|
+
def extract_sigil(processed_source); end
|
1496
|
+
|
1497
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/sigils/valid_sigil.rb#65
|
1498
|
+
def extract_strictness(sigil); end
|
1499
|
+
|
1500
|
+
# Default is `nil`
|
1501
|
+
#
|
1502
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/sigils/valid_sigil.rb#175
|
1503
|
+
def minimum_strictness; end
|
1504
|
+
|
1505
|
+
# Default is `false`
|
1506
|
+
#
|
1507
|
+
# @return [Boolean]
|
1508
|
+
#
|
1509
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/sigils/valid_sigil.rb#164
|
1510
|
+
def require_sigil_on_all_files?; end
|
1511
|
+
|
1512
|
+
# Default is `'false'`
|
1513
|
+
#
|
1514
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/sigils/valid_sigil.rb#169
|
1515
|
+
def suggested_strictness; end
|
1516
|
+
|
1517
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/sigils/valid_sigil.rb#87
|
1518
|
+
def suggested_strictness_level; end
|
1519
|
+
end
|
1520
|
+
|
1521
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/sigils/valid_sigil.rb#55
|
1522
|
+
RuboCop::Cop::Sorbet::ValidSigil::SIGIL_REGEX = T.let(T.unsafe(nil), Regexp)
|
1523
|
+
|
1524
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/sigils/valid_sigil.rb#54
|
1525
|
+
RuboCop::Cop::Sorbet::ValidSigil::STRICTNESS_LEVELS = T.let(T.unsafe(nil), Array)
|
1526
|
+
|
1527
|
+
# Disallows the usage of `.void.checked(:tests)`.
|
1528
|
+
#
|
1529
|
+
# Using `.void` changes the value returned from the method, but only if
|
1530
|
+
# runtime type checking is enabled for the method. Methods marked `.void`
|
1531
|
+
# will return different values in tests compared with non-test
|
1532
|
+
# environments. This is particularly troublesome if branching on the
|
1533
|
+
# result of a `.void` method, because the returned value in test code
|
1534
|
+
# will be the truthy `VOID` value, while the non-test return value may be
|
1535
|
+
# falsy depending on the method's implementation.
|
1536
|
+
#
|
1537
|
+
# - Use `.returns(T.anything).checked(:tests)` to keep the runtime type
|
1538
|
+
# checking for the rest of the parameters.
|
1539
|
+
# - Use `.void.checked(:never)` if you are on an older version of Sorbet
|
1540
|
+
# which does not have `T.anything` (meaning versions 0.5.10781 or
|
1541
|
+
# earlier. Versions released after 2023-04-14 include `T.anything`.)
|
1542
|
+
#
|
1543
|
+
# @example
|
1544
|
+
#
|
1545
|
+
# # bad
|
1546
|
+
# sig { void.checked(:tests) }
|
1547
|
+
#
|
1548
|
+
# # good
|
1549
|
+
# sig { void }
|
1550
|
+
# sig { returns(T.anything).checked(:tests) }
|
1551
|
+
# sig { void.checked(:never) }
|
1552
|
+
#
|
1553
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/signatures/void_checked_tests.rb#31
|
1554
|
+
class RuboCop::Cop::Sorbet::VoidCheckedTests < ::RuboCop::Cop::Base
|
1555
|
+
include ::RuboCop::Cop::RangeHelp
|
1556
|
+
include ::RuboCop::Cop::Sorbet::SignatureHelp
|
1557
|
+
extend ::RuboCop::Cop::AutoCorrector
|
1558
|
+
|
1559
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/signatures/void_checked_tests.rb#37
|
1560
|
+
def checked_tests(param0); end
|
1561
|
+
|
1562
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/signatures/void_checked_tests.rb#58
|
1563
|
+
def on_signature(node); end
|
1564
|
+
|
1565
|
+
private
|
1566
|
+
|
1567
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/signatures/void_checked_tests.rb#48
|
1568
|
+
def top_level_void(node); end
|
1569
|
+
end
|
1570
|
+
|
1571
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/signatures/void_checked_tests.rb#41
|
1572
|
+
RuboCop::Cop::Sorbet::VoidCheckedTests::MESSAGE = T.let(T.unsafe(nil), String)
|
1573
|
+
|
1574
|
+
module RuboCop::Cop::Style; end
|
1575
|
+
|
1576
|
+
class RuboCop::Cop::Style::MutableConstant < ::RuboCop::Cop::Base
|
1577
|
+
include ::RuboCop::Cop::Sorbet::MutableConstantSorbetAwareBehaviour
|
1578
|
+
end
|
1579
|
+
|
1580
|
+
# source://rubocop-sorbet//lib/rubocop/sorbet/version.rb#4
|
1581
|
+
module RuboCop::Sorbet; end
|
1582
|
+
|
1583
|
+
# source://rubocop-sorbet//lib/rubocop/sorbet.rb#12
|
1584
|
+
RuboCop::Sorbet::CONFIG = T.let(T.unsafe(nil), Hash)
|
1585
|
+
|
1586
|
+
# source://rubocop-sorbet//lib/rubocop/sorbet.rb#11
|
1587
|
+
RuboCop::Sorbet::CONFIG_DEFAULT = T.let(T.unsafe(nil), Pathname)
|
1588
|
+
|
1589
|
+
# source://rubocop-sorbet//lib/rubocop/sorbet.rb#8
|
1590
|
+
class RuboCop::Sorbet::Error < ::StandardError; end
|
1591
|
+
|
1592
|
+
# Because RuboCop doesn't yet support plugins, we have to monkey patch in a
|
1593
|
+
# bit of our configuration.
|
1594
|
+
#
|
1595
|
+
# source://rubocop-sorbet//lib/rubocop/sorbet/inject.rb#9
|
1596
|
+
module RuboCop::Sorbet::Inject
|
1597
|
+
class << self
|
1598
|
+
# source://rubocop-sorbet//lib/rubocop/sorbet/inject.rb#11
|
1599
|
+
def defaults!; end
|
1600
|
+
end
|
1601
|
+
end
|
1602
|
+
|
1603
|
+
# source://rubocop-sorbet//lib/rubocop/sorbet.rb#10
|
1604
|
+
RuboCop::Sorbet::PROJECT_ROOT = T.let(T.unsafe(nil), Pathname)
|
1605
|
+
|
1606
|
+
# source://rubocop-sorbet//lib/rubocop/sorbet/version.rb#5
|
1607
|
+
RuboCop::Sorbet::VERSION = T.let(T.unsafe(nil), String)
|