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