danger-packwerk 0.7.0 → 0.7.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/danger-packwerk/packwerk_wrapper.rb +2 -2
- data/lib/danger-packwerk/version.rb +1 -1
- data/sorbet/config +1 -0
- data/sorbet/rbi/gems/actionview@7.0.4.rbi +11543 -0
- data/sorbet/rbi/gems/activesupport@7.0.4.rbi +12959 -0
- data/sorbet/rbi/gems/addressable@2.8.1.rbi +1505 -0
- data/sorbet/rbi/gems/ast@2.4.2.rbi +522 -0
- data/sorbet/rbi/gems/better_html@2.0.1.rbi +286 -0
- data/sorbet/rbi/gems/builder@3.2.4.rbi +8 -0
- data/sorbet/rbi/gems/claide-plugins@0.9.2.rbi +791 -0
- data/sorbet/rbi/gems/claide@1.1.0.rbi +1132 -0
- data/sorbet/rbi/gems/coderay@1.1.3.rbi +2256 -0
- data/sorbet/rbi/gems/colored2@3.1.2.rbi +130 -0
- data/sorbet/rbi/gems/concurrent-ruby@1.1.10.rbi +8695 -0
- data/sorbet/rbi/gems/cork@0.3.0.rbi +248 -0
- data/sorbet/rbi/gems/crass@1.0.6.rbi +436 -0
- data/sorbet/rbi/gems/danger-plugin-api@1.0.0.rbi +8 -0
- data/sorbet/rbi/gems/danger@9.0.0.rbi +4722 -0
- data/sorbet/rbi/gems/diff-lcs@1.5.0.rbi +862 -0
- data/sorbet/rbi/gems/erubi@1.11.0.rbi +102 -0
- data/sorbet/rbi/gems/faraday-em_http@1.0.0.rbi +266 -0
- data/sorbet/rbi/gems/faraday-em_synchrony@1.0.0.rbi +209 -0
- data/sorbet/rbi/gems/faraday-excon@1.1.0.rbi +212 -0
- data/sorbet/rbi/gems/faraday-http-cache@2.4.1.rbi +805 -0
- data/sorbet/rbi/gems/faraday-httpclient@1.0.1.rbi +221 -0
- data/sorbet/rbi/gems/faraday-multipart@1.0.4.rbi +266 -0
- data/sorbet/rbi/gems/faraday-net_http@1.0.1.rbi +216 -0
- data/sorbet/rbi/gems/faraday-net_http_persistent@1.2.0.rbi +206 -0
- data/sorbet/rbi/gems/faraday-patron@1.0.0.rbi +212 -0
- data/sorbet/rbi/gems/faraday-rack@1.0.0.rbi +225 -0
- data/sorbet/rbi/gems/faraday-retry@1.0.3.rbi +222 -0
- data/sorbet/rbi/gems/faraday@1.10.2.rbi +1862 -0
- data/sorbet/rbi/gems/git@1.12.0.rbi +1936 -0
- data/sorbet/rbi/gems/i18n@1.12.0.rbi +1643 -0
- data/sorbet/rbi/gems/json@2.6.2.rbi +1418 -0
- data/sorbet/rbi/gems/kramdown-parser-gfm@1.1.0.rbi +8 -0
- data/sorbet/rbi/gems/kramdown@2.4.0.rbi +2168 -0
- data/sorbet/rbi/gems/loofah@2.19.0.rbi +646 -0
- data/sorbet/rbi/gems/method_source@1.0.0.rbi +199 -0
- data/sorbet/rbi/gems/minitest@5.16.3.rbi +997 -0
- data/sorbet/rbi/gems/multipart-post@2.2.3.rbi +165 -0
- data/sorbet/rbi/gems/nap@1.1.0.rbi +351 -0
- data/sorbet/rbi/gems/no_proxy_fix@0.1.2.rbi +8 -0
- data/sorbet/rbi/gems/nokogiri@1.13.8.rbi +4916 -0
- data/sorbet/rbi/gems/octokit@5.6.1.rbi +8939 -0
- data/sorbet/rbi/gems/open4@1.3.4.rbi +8 -0
- data/sorbet/rbi/gems/{packwerk@2.1.1.rbi → packwerk@2.2.1.rbi} +602 -51
- data/sorbet/rbi/gems/parallel@1.22.1.rbi +163 -0
- data/sorbet/rbi/gems/parser@3.1.2.1.rbi +5988 -0
- data/sorbet/rbi/gems/pry@0.14.1.rbi +6969 -0
- data/sorbet/rbi/gems/public_suffix@5.0.0.rbi +779 -0
- data/sorbet/rbi/gems/racc@1.6.0.rbi +92 -0
- data/sorbet/rbi/gems/rails-dom-testing@2.0.3.rbi +8 -0
- data/sorbet/rbi/gems/rails-html-sanitizer@1.4.3.rbi +493 -0
- data/sorbet/rbi/gems/rainbow@3.1.1.rbi +227 -0
- data/sorbet/rbi/gems/rake@13.0.6.rbi +1865 -0
- data/sorbet/rbi/gems/rbi@0.0.14.rbi +2337 -0
- data/sorbet/rbi/gems/rchardet@1.8.0.rbi +587 -0
- data/sorbet/rbi/gems/regexp_parser@2.5.0.rbi +1851 -0
- data/sorbet/rbi/gems/rexml@3.2.5.rbi +3852 -0
- data/sorbet/rbi/gems/rspec-core@3.11.0.rbi +7725 -0
- data/sorbet/rbi/gems/rspec-expectations@3.11.0.rbi +6201 -0
- data/sorbet/rbi/gems/rspec-mocks@3.11.1.rbi +3625 -0
- data/sorbet/rbi/gems/rspec-support@3.11.0.rbi +1176 -0
- data/sorbet/rbi/gems/rspec@3.11.0.rbi +40 -0
- data/sorbet/rbi/gems/rubocop-ast@1.21.0.rbi +4193 -0
- data/sorbet/rbi/gems/rubocop-sorbet@0.6.8.rbi +677 -0
- data/sorbet/rbi/gems/rubocop@1.36.0.rbi +37914 -0
- data/sorbet/rbi/gems/ruby-progressbar@1.11.0.rbi +732 -0
- data/sorbet/rbi/gems/ruby2_keywords@0.0.5.rbi +8 -0
- data/sorbet/rbi/gems/sawyer@0.9.2.rbi +513 -0
- data/sorbet/rbi/gems/smart_properties@1.17.0.rbi +326 -0
- data/sorbet/rbi/gems/spoom@1.1.11.rbi +1600 -0
- data/sorbet/rbi/gems/tapioca@0.8.0.rbi +1959 -0
- data/sorbet/rbi/gems/terminal-table@3.0.2.rbi +438 -0
- data/sorbet/rbi/gems/thor@1.2.1.rbi +2921 -0
- data/sorbet/rbi/gems/tzinfo@2.0.5.rbi +4879 -0
- data/sorbet/rbi/gems/unicode-display_width@2.3.0.rbi +27 -0
- data/sorbet/rbi/gems/unparser@0.6.5.rbi +2789 -0
- data/sorbet/rbi/gems/webrick@1.7.0.rbi +1802 -0
- data/sorbet/rbi/gems/yard-sorbet@0.6.1.rbi +288 -0
- data/sorbet/rbi/gems/yard@0.9.27.rbi +12668 -0
- data/sorbet/rbi/todo.rbi +122 -0
- metadata +84 -7
- data/sorbet/rbi/gems/danger@8.5.0.rbi +0 -122
@@ -0,0 +1,677 @@
|
|
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
|
+
# Correct superclass `send` expressions by constant literals.
|
8
|
+
#
|
9
|
+
# Sorbet, the static checker, is not (yet) able to support constructs on the
|
10
|
+
# following form:
|
11
|
+
#
|
12
|
+
# ```ruby
|
13
|
+
# class Foo < send_expr; end
|
14
|
+
# ```
|
15
|
+
#
|
16
|
+
# Multiple occurences of this can be found in Shopify's code base like:
|
17
|
+
#
|
18
|
+
# ```ruby
|
19
|
+
# class ShopScope < Component::TrustedIdScope[ShopIdentity::ShopId]
|
20
|
+
# ```
|
21
|
+
# or
|
22
|
+
# ```ruby
|
23
|
+
# class ApiClientEligibility < Struct.new(:api_client, :match_results, :shop)
|
24
|
+
# ```
|
25
|
+
module RuboCop; end
|
26
|
+
|
27
|
+
module RuboCop::Cop; end
|
28
|
+
|
29
|
+
# @deprecated IgnoredMethods class has been replaced with AllowedMethods.
|
30
|
+
RuboCop::Cop::IgnoredMethods = RuboCop::Cop::AllowedMethods
|
31
|
+
|
32
|
+
# @deprecated IgnoredPattern class has been replaced with AllowedPattern.
|
33
|
+
RuboCop::Cop::IgnoredPattern = RuboCop::Cop::AllowedPattern
|
34
|
+
|
35
|
+
module RuboCop::Cop::Sorbet; end
|
36
|
+
|
37
|
+
# This cop disallows using `.override(allow_incompatible: true)`.
|
38
|
+
# Using `allow_incompatible` suggests a violation of the Liskov
|
39
|
+
# Substitution Principle, meaning that a subclass is not a valid
|
40
|
+
# subtype of it's superclass. This Cop prevents these design smells
|
41
|
+
# from occurring.
|
42
|
+
#
|
43
|
+
# @example
|
44
|
+
#
|
45
|
+
# # bad
|
46
|
+
# sig.override(allow_incompatible: true)
|
47
|
+
#
|
48
|
+
# # good
|
49
|
+
# sig.override
|
50
|
+
class RuboCop::Cop::Sorbet::AllowIncompatibleOverride < ::RuboCop::Cop::Cop
|
51
|
+
def allow_incompatible?(param0); end
|
52
|
+
def allow_incompatible_override?(param0 = T.unsafe(nil)); end
|
53
|
+
|
54
|
+
# @return [Boolean]
|
55
|
+
def not_nil?(node); end
|
56
|
+
|
57
|
+
def on_send(node); end
|
58
|
+
def sig?(param0); end
|
59
|
+
end
|
60
|
+
|
61
|
+
# This cop disallows binding the return value of `T.any`, `T.all`, `T.enum`
|
62
|
+
# to a constant directly. To bind the value, one must use `T.type_alias`.
|
63
|
+
#
|
64
|
+
# @example
|
65
|
+
#
|
66
|
+
# # bad
|
67
|
+
# FooOrBar = T.any(Foo, Bar)
|
68
|
+
#
|
69
|
+
# # good
|
70
|
+
# FooOrBar = T.type_alias { T.any(Foo, Bar) }
|
71
|
+
class RuboCop::Cop::Sorbet::BindingConstantWithoutTypeAlias < ::RuboCop::Cop::Cop
|
72
|
+
def autocorrect(node); end
|
73
|
+
def binding_unaliased_type?(param0 = T.unsafe(nil)); end
|
74
|
+
def dynamic_type_creation_with_block?(param0 = T.unsafe(nil)); end
|
75
|
+
def generic_parameter_decl_block_call?(param0 = T.unsafe(nil)); end
|
76
|
+
def generic_parameter_decl_call?(param0 = T.unsafe(nil)); end
|
77
|
+
def method_needing_aliasing_on_t?(param0); end
|
78
|
+
|
79
|
+
# @return [Boolean]
|
80
|
+
def not_dynamic_type_creation_with_block?(node); end
|
81
|
+
|
82
|
+
# @return [Boolean]
|
83
|
+
def not_generic_parameter_decl?(node); end
|
84
|
+
|
85
|
+
# @return [Boolean]
|
86
|
+
def not_nil?(node); end
|
87
|
+
|
88
|
+
# @return [Boolean]
|
89
|
+
def not_t_let?(node); end
|
90
|
+
|
91
|
+
def on_casgn(node); end
|
92
|
+
def t_let?(param0 = T.unsafe(nil)); end
|
93
|
+
def using_deprecated_type_alias_syntax?(param0 = T.unsafe(nil)); end
|
94
|
+
def using_type_alias?(param0 = T.unsafe(nil)); end
|
95
|
+
end
|
96
|
+
|
97
|
+
# This cop ensures that callback conditionals are bound to the right type
|
98
|
+
# so that they are type checked properly.
|
99
|
+
#
|
100
|
+
# Auto-correction is unsafe because other libraries define similar style callbacks as Rails, but don't always need
|
101
|
+
# binding to the attached class. Auto-correcting those usages can lead to false positives and auto-correction
|
102
|
+
# introduces new typing errors.
|
103
|
+
#
|
104
|
+
# @example
|
105
|
+
#
|
106
|
+
# # bad
|
107
|
+
# class Post < ApplicationRecord
|
108
|
+
# before_create :do_it, if: -> { should_do_it? }
|
109
|
+
#
|
110
|
+
# def should_do_it?
|
111
|
+
# true
|
112
|
+
# end
|
113
|
+
# end
|
114
|
+
#
|
115
|
+
# # good
|
116
|
+
# class Post < ApplicationRecord
|
117
|
+
# before_create :do_it, if: -> {
|
118
|
+
# T.bind(self, Post)
|
119
|
+
# should_do_it?
|
120
|
+
# }
|
121
|
+
#
|
122
|
+
# def should_do_it?
|
123
|
+
# true
|
124
|
+
# end
|
125
|
+
# end
|
126
|
+
class RuboCop::Cop::Sorbet::CallbackConditionalsBinding < ::RuboCop::Cop::Cop
|
127
|
+
def autocorrect(node); end
|
128
|
+
def on_send(node); end
|
129
|
+
end
|
130
|
+
|
131
|
+
RuboCop::Cop::Sorbet::CallbackConditionalsBinding::CALLBACKS = T.let(T.unsafe(nil), Array)
|
132
|
+
|
133
|
+
# This cop disallows the usage of `checked(true)`. This usage could cause
|
134
|
+
# confusion; it could lead some people to believe that a method would be checked
|
135
|
+
# even if runtime checks have not been enabled on the class or globally.
|
136
|
+
# Additionally, in the event where checks are enabled, `checked(true)` would
|
137
|
+
# be redundant; only `checked(false)` or `soft` would change the behaviour.
|
138
|
+
#
|
139
|
+
# @example
|
140
|
+
#
|
141
|
+
# # bad
|
142
|
+
# sig { void.checked(true) }
|
143
|
+
#
|
144
|
+
# # good
|
145
|
+
# sig { void }
|
146
|
+
class RuboCop::Cop::Sorbet::CheckedTrueInSignature < ::RuboCop::Cop::Sorbet::SignatureCop
|
147
|
+
include ::RuboCop::Cop::RangeHelp
|
148
|
+
|
149
|
+
def offending_node(param0); end
|
150
|
+
def on_signature(node); end
|
151
|
+
end
|
152
|
+
|
153
|
+
RuboCop::Cop::Sorbet::CheckedTrueInSignature::MESSAGE = T.let(T.unsafe(nil), String)
|
154
|
+
|
155
|
+
# This cop disallows the calls that are used to get constants fom Strings
|
156
|
+
# such as +constantize+, +const_get+, and +constants+.
|
157
|
+
#
|
158
|
+
# The goal of this cop is to make the code easier to statically analyze,
|
159
|
+
# more IDE-friendly, and more predictable. It leads to code that clearly
|
160
|
+
# expresses which values the constant can have.
|
161
|
+
#
|
162
|
+
# @example
|
163
|
+
#
|
164
|
+
# # bad
|
165
|
+
# class_name.constantize
|
166
|
+
#
|
167
|
+
# # bad
|
168
|
+
# constants.detect { |c| c.name == "User" }
|
169
|
+
#
|
170
|
+
# # bad
|
171
|
+
# const_get(class_name)
|
172
|
+
#
|
173
|
+
# # good
|
174
|
+
# case class_name
|
175
|
+
# when "User"
|
176
|
+
# User
|
177
|
+
# else
|
178
|
+
# raise ArgumentError
|
179
|
+
# end
|
180
|
+
#
|
181
|
+
# # good
|
182
|
+
# { "User" => User }.fetch(class_name)
|
183
|
+
class RuboCop::Cop::Sorbet::ConstantsFromStrings < ::RuboCop::Cop::Cop
|
184
|
+
def constant_from_string?(param0 = T.unsafe(nil)); end
|
185
|
+
def on_send(node); end
|
186
|
+
end
|
187
|
+
|
188
|
+
# This cop checks that the Sorbet sigil comes as the first magic comment in the file.
|
189
|
+
#
|
190
|
+
# The expected order for magic comments is: typed, (en)?coding, warn_indent then frozen_string_literal.
|
191
|
+
#
|
192
|
+
# For example, the following bad ordering:
|
193
|
+
#
|
194
|
+
# ```ruby
|
195
|
+
# class Foo; end
|
196
|
+
# ```
|
197
|
+
#
|
198
|
+
# Will be corrected as:
|
199
|
+
#
|
200
|
+
# ```ruby
|
201
|
+
# class Foo; end
|
202
|
+
# ```
|
203
|
+
#
|
204
|
+
# Only `typed`, `(en)?coding`, `warn_indent` and `frozen_string_literal` magic comments are considered,
|
205
|
+
# other comments or magic comments are left in the same place.
|
206
|
+
class RuboCop::Cop::Sorbet::EnforceSigilOrder < ::RuboCop::Cop::Sorbet::ValidSigil
|
207
|
+
include ::RuboCop::Cop::RangeHelp
|
208
|
+
|
209
|
+
def autocorrect(_node); end
|
210
|
+
def investigate(processed_source); end
|
211
|
+
|
212
|
+
protected
|
213
|
+
|
214
|
+
# checks
|
215
|
+
def check_magic_comments_order(tokens); end
|
216
|
+
|
217
|
+
# Get all the tokens in `processed_source` that match `MAGIC_REGEX`
|
218
|
+
def extract_magic_comments(processed_source); end
|
219
|
+
end
|
220
|
+
|
221
|
+
RuboCop::Cop::Sorbet::EnforceSigilOrder::CODING_REGEX = T.let(T.unsafe(nil), Regexp)
|
222
|
+
RuboCop::Cop::Sorbet::EnforceSigilOrder::FROZEN_REGEX = T.let(T.unsafe(nil), Regexp)
|
223
|
+
RuboCop::Cop::Sorbet::EnforceSigilOrder::INDENT_REGEX = T.let(T.unsafe(nil), Regexp)
|
224
|
+
RuboCop::Cop::Sorbet::EnforceSigilOrder::MAGIC_REGEX = T.let(T.unsafe(nil), Regexp)
|
225
|
+
RuboCop::Cop::Sorbet::EnforceSigilOrder::PREFERRED_ORDER = T.let(T.unsafe(nil), Hash)
|
226
|
+
|
227
|
+
# This cop checks that every method definition and attribute accessor has a Sorbet signature.
|
228
|
+
#
|
229
|
+
# It also suggest an autocorrect with placeholders so the following code:
|
230
|
+
#
|
231
|
+
# ```
|
232
|
+
# def foo(a, b, c); end
|
233
|
+
# ```
|
234
|
+
#
|
235
|
+
# Will be corrected as:
|
236
|
+
#
|
237
|
+
# ```
|
238
|
+
# sig { params(a: T.untyped, b: T.untyped, c: T.untyped).returns(T.untyped)
|
239
|
+
# def foo(a, b, c); end
|
240
|
+
# ```
|
241
|
+
#
|
242
|
+
# You can configure the placeholders used by changing the following options:
|
243
|
+
#
|
244
|
+
# * `ParameterTypePlaceholder`: placeholders used for parameter types (default: 'T.untyped')
|
245
|
+
# * `ReturnTypePlaceholder`: placeholders used for return types (default: 'T.untyped')
|
246
|
+
class RuboCop::Cop::Sorbet::EnforceSignatures < ::RuboCop::Cop::Sorbet::SignatureCop
|
247
|
+
# @return [EnforceSignatures] a new instance of EnforceSignatures
|
248
|
+
def initialize(config = T.unsafe(nil), options = T.unsafe(nil)); end
|
249
|
+
|
250
|
+
def accessor?(param0 = T.unsafe(nil)); end
|
251
|
+
def autocorrect(node); end
|
252
|
+
def on_def(node); end
|
253
|
+
def on_defs(node); end
|
254
|
+
def on_send(node); end
|
255
|
+
def on_signature(node); end
|
256
|
+
def scope(node); end
|
257
|
+
|
258
|
+
private
|
259
|
+
|
260
|
+
def check_node(node); end
|
261
|
+
def param_type_placeholder; end
|
262
|
+
def return_type_placeholder; end
|
263
|
+
end
|
264
|
+
|
265
|
+
class RuboCop::Cop::Sorbet::EnforceSignatures::SigSuggestion
|
266
|
+
# @return [SigSuggestion] a new instance of SigSuggestion
|
267
|
+
def initialize(indent, param_placeholder, return_placeholder); end
|
268
|
+
|
269
|
+
# Returns the value of attribute params.
|
270
|
+
def params; end
|
271
|
+
|
272
|
+
# Sets the attribute params
|
273
|
+
#
|
274
|
+
# @param value the value to set the attribute params to.
|
275
|
+
def params=(_arg0); end
|
276
|
+
|
277
|
+
# Returns the value of attribute returns.
|
278
|
+
def returns; end
|
279
|
+
|
280
|
+
# Sets the attribute returns
|
281
|
+
#
|
282
|
+
# @param value the value to set the attribute returns to.
|
283
|
+
def returns=(_arg0); end
|
284
|
+
|
285
|
+
def to_autocorrect; end
|
286
|
+
|
287
|
+
private
|
288
|
+
|
289
|
+
def generate_params; end
|
290
|
+
def generate_return; end
|
291
|
+
end
|
292
|
+
|
293
|
+
# This cop checks that there is only one Sorbet sigil in a given file
|
294
|
+
#
|
295
|
+
# For example, the following class with two sigils
|
296
|
+
#
|
297
|
+
# ```ruby
|
298
|
+
# class Foo; end
|
299
|
+
# ```
|
300
|
+
#
|
301
|
+
# Will be corrected as:
|
302
|
+
#
|
303
|
+
# ```ruby
|
304
|
+
# class Foo; end
|
305
|
+
# ```
|
306
|
+
#
|
307
|
+
# Other comments or magic comments are left in place.
|
308
|
+
class RuboCop::Cop::Sorbet::EnforceSingleSigil < ::RuboCop::Cop::Sorbet::ValidSigil
|
309
|
+
include ::RuboCop::Cop::RangeHelp
|
310
|
+
|
311
|
+
def autocorrect(_node); end
|
312
|
+
def investigate(processed_source); end
|
313
|
+
|
314
|
+
protected
|
315
|
+
|
316
|
+
def extract_all_sigils(processed_source); end
|
317
|
+
end
|
318
|
+
|
319
|
+
# This cop makes the Sorbet `false` sigil mandatory in all files.
|
320
|
+
class RuboCop::Cop::Sorbet::FalseSigil < ::RuboCop::Cop::Sorbet::HasSigil
|
321
|
+
def minimum_strictness; end
|
322
|
+
end
|
323
|
+
|
324
|
+
# This cop ensures RBI shims do not include a call to extend T::Sig
|
325
|
+
# or to extend T::Helpers
|
326
|
+
#
|
327
|
+
# @example
|
328
|
+
#
|
329
|
+
# # bad
|
330
|
+
# module SomeModule
|
331
|
+
# extend T::Sig
|
332
|
+
# extend T::Helpers
|
333
|
+
#
|
334
|
+
# sig { returns(String) }
|
335
|
+
# def foo; end
|
336
|
+
# end
|
337
|
+
#
|
338
|
+
# # good
|
339
|
+
# module SomeModule
|
340
|
+
# sig { returns(String) }
|
341
|
+
# def foo; end
|
342
|
+
# end
|
343
|
+
class RuboCop::Cop::Sorbet::ForbidExtendTSigHelpersInShims < ::RuboCop::Cop::Cop
|
344
|
+
include ::RuboCop::Cop::RangeHelp
|
345
|
+
|
346
|
+
def autocorrect(node); end
|
347
|
+
def extend_t_helpers?(param0 = T.unsafe(nil)); end
|
348
|
+
def extend_t_sig?(param0 = T.unsafe(nil)); end
|
349
|
+
def on_send(node); end
|
350
|
+
end
|
351
|
+
|
352
|
+
RuboCop::Cop::Sorbet::ForbidExtendTSigHelpersInShims::MSG = T.let(T.unsafe(nil), String)
|
353
|
+
RuboCop::Cop::Sorbet::ForbidExtendTSigHelpersInShims::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array)
|
354
|
+
|
355
|
+
class RuboCop::Cop::Sorbet::ForbidIncludeConstLiteral < ::RuboCop::Cop::Cop
|
356
|
+
# @return [ForbidIncludeConstLiteral] a new instance of ForbidIncludeConstLiteral
|
357
|
+
def initialize(*_arg0); end
|
358
|
+
|
359
|
+
def autocorrect(node); end
|
360
|
+
def not_lit_const_include?(param0 = T.unsafe(nil)); end
|
361
|
+
def on_send(node); end
|
362
|
+
|
363
|
+
# Returns the value of attribute used_names.
|
364
|
+
def used_names; end
|
365
|
+
|
366
|
+
# Sets the attribute used_names
|
367
|
+
#
|
368
|
+
# @param value the value to set the attribute used_names to.
|
369
|
+
def used_names=(_arg0); end
|
370
|
+
end
|
371
|
+
|
372
|
+
RuboCop::Cop::Sorbet::ForbidIncludeConstLiteral::MSG = T.let(T.unsafe(nil), String)
|
373
|
+
|
374
|
+
# This cop makes sure that RBI files are always located under the defined allowed paths.
|
375
|
+
#
|
376
|
+
# Options:
|
377
|
+
#
|
378
|
+
# * `AllowedPaths`: A list of the paths where RBI files are allowed (default: ["sorbet/rbi/**"])
|
379
|
+
#
|
380
|
+
# @example
|
381
|
+
# # bad
|
382
|
+
# # lib/some_file.rbi
|
383
|
+
# # other_file.rbi
|
384
|
+
#
|
385
|
+
# # good
|
386
|
+
# # sorbet/rbi/some_file.rbi
|
387
|
+
# # sorbet/rbi/any/path/for/file.rbi
|
388
|
+
class RuboCop::Cop::Sorbet::ForbidRBIOutsideOfAllowedPaths < ::RuboCop::Cop::Cop
|
389
|
+
include ::RuboCop::Cop::RangeHelp
|
390
|
+
|
391
|
+
def investigate(processed_source); end
|
392
|
+
|
393
|
+
private
|
394
|
+
|
395
|
+
def allowed_paths; end
|
396
|
+
end
|
397
|
+
|
398
|
+
class RuboCop::Cop::Sorbet::ForbidSuperclassConstLiteral < ::RuboCop::Cop::Cop
|
399
|
+
def not_lit_const_superclass?(param0 = T.unsafe(nil)); end
|
400
|
+
def on_class(node); end
|
401
|
+
end
|
402
|
+
|
403
|
+
RuboCop::Cop::Sorbet::ForbidSuperclassConstLiteral::MSG = T.let(T.unsafe(nil), String)
|
404
|
+
|
405
|
+
# This cop disallows using `T.unsafe` anywhere.
|
406
|
+
#
|
407
|
+
# @example
|
408
|
+
#
|
409
|
+
# # bad
|
410
|
+
# T.unsafe(foo)
|
411
|
+
#
|
412
|
+
# # good
|
413
|
+
# foo
|
414
|
+
class RuboCop::Cop::Sorbet::ForbidTUnsafe < ::RuboCop::Cop::Cop
|
415
|
+
def on_send(node); end
|
416
|
+
def t_unsafe?(param0 = T.unsafe(nil)); end
|
417
|
+
end
|
418
|
+
|
419
|
+
# This cop disallows use of `T.untyped` or `T.nilable(T.untyped)`
|
420
|
+
# as a prop type for `T::Struct`.
|
421
|
+
#
|
422
|
+
# @example
|
423
|
+
#
|
424
|
+
# # bad
|
425
|
+
# class SomeClass
|
426
|
+
# const :foo, T.untyped
|
427
|
+
# prop :bar, T.nilable(T.untyped)
|
428
|
+
# end
|
429
|
+
#
|
430
|
+
# # good
|
431
|
+
# class SomeClass
|
432
|
+
# const :foo, Integer
|
433
|
+
# prop :bar, T.nilable(String)
|
434
|
+
# end
|
435
|
+
class RuboCop::Cop::Sorbet::ForbidUntypedStructProps < ::RuboCop::Cop::Cop
|
436
|
+
def on_class(node); end
|
437
|
+
def subclass_of_t_struct?(param0 = T.unsafe(nil)); end
|
438
|
+
def t_nilable_untyped(param0 = T.unsafe(nil)); end
|
439
|
+
def t_struct(param0 = T.unsafe(nil)); end
|
440
|
+
def t_untyped(param0 = T.unsafe(nil)); end
|
441
|
+
def untyped_props(param0); end
|
442
|
+
end
|
443
|
+
|
444
|
+
RuboCop::Cop::Sorbet::ForbidUntypedStructProps::MSG = T.let(T.unsafe(nil), String)
|
445
|
+
|
446
|
+
# This cop makes the Sorbet typed sigil mandatory in all files.
|
447
|
+
#
|
448
|
+
# Options:
|
449
|
+
#
|
450
|
+
# * `SuggestedStrictness`: Sorbet strictness level suggested in offense messages (default: 'false')
|
451
|
+
# * `MinimumStrictness`: If set, make offense if the strictness level in the file is below this one
|
452
|
+
#
|
453
|
+
# If a `MinimumStrictness` level is specified, it will be used in offense messages and autocorrect.
|
454
|
+
class RuboCop::Cop::Sorbet::HasSigil < ::RuboCop::Cop::Sorbet::ValidSigil
|
455
|
+
# @return [Boolean]
|
456
|
+
def require_sigil_on_all_files?; end
|
457
|
+
end
|
458
|
+
|
459
|
+
# This cop makes the Sorbet `ignore` sigil mandatory in all files.
|
460
|
+
class RuboCop::Cop::Sorbet::IgnoreSigil < ::RuboCop::Cop::Sorbet::HasSigil
|
461
|
+
def minimum_strictness; end
|
462
|
+
end
|
463
|
+
|
464
|
+
# This cop checks for the ordering of keyword arguments required by
|
465
|
+
# sorbet-runtime. The ordering requires that all keyword arguments
|
466
|
+
# are at the end of the parameters list, and all keyword arguments
|
467
|
+
# with a default value must be after those without default values.
|
468
|
+
#
|
469
|
+
# @example
|
470
|
+
#
|
471
|
+
# # bad
|
472
|
+
# sig { params(a: Integer, b: String).void }
|
473
|
+
# def foo(a: 1, b:); end
|
474
|
+
#
|
475
|
+
# # good
|
476
|
+
# sig { params(b: String, a: Integer).void }
|
477
|
+
# def foo(b:, a: 1); end
|
478
|
+
class RuboCop::Cop::Sorbet::KeywordArgumentOrdering < ::RuboCop::Cop::Sorbet::SignatureCop
|
479
|
+
def on_signature(node); end
|
480
|
+
|
481
|
+
private
|
482
|
+
|
483
|
+
def check_order_for_kwoptargs(parameters); end
|
484
|
+
end
|
485
|
+
|
486
|
+
module RuboCop::Cop::Sorbet::MutableConstantSorbetAwareBehaviour
|
487
|
+
def on_assignment(value); end
|
488
|
+
|
489
|
+
class << self
|
490
|
+
def prepended(base); end
|
491
|
+
end
|
492
|
+
end
|
493
|
+
|
494
|
+
# This cop ensures one ancestor per requires_ancestor line
|
495
|
+
# rather than chaining them as a comma-separated list.
|
496
|
+
#
|
497
|
+
# @example
|
498
|
+
#
|
499
|
+
# # bad
|
500
|
+
# module SomeModule
|
501
|
+
# requires_ancestor Kernel, Minitest::Assertions
|
502
|
+
# end
|
503
|
+
#
|
504
|
+
# # good
|
505
|
+
# module SomeModule
|
506
|
+
# requires_ancestor Kernel
|
507
|
+
# requires_ancestor Minitest::Assertions
|
508
|
+
# end
|
509
|
+
class RuboCop::Cop::Sorbet::OneAncestorPerLine < ::RuboCop::Cop::Cop
|
510
|
+
def abstract?(param0); end
|
511
|
+
def autocorrect(node); end
|
512
|
+
def more_than_one_ancestor(param0 = T.unsafe(nil)); end
|
513
|
+
def on_class(node); end
|
514
|
+
def on_module(node); end
|
515
|
+
def requires_ancestors(param0); end
|
516
|
+
|
517
|
+
private
|
518
|
+
|
519
|
+
def new_ra_line(indent_count); end
|
520
|
+
def process_node(node); end
|
521
|
+
end
|
522
|
+
|
523
|
+
RuboCop::Cop::Sorbet::OneAncestorPerLine::MSG = T.let(T.unsafe(nil), String)
|
524
|
+
|
525
|
+
class RuboCop::Cop::Sorbet::SignatureBuildOrder < ::RuboCop::Cop::Sorbet::SignatureCop
|
526
|
+
def autocorrect(node); end
|
527
|
+
def on_signature(node); end
|
528
|
+
def root_call(param0); end
|
529
|
+
|
530
|
+
private
|
531
|
+
|
532
|
+
def call_chain(sig_child_node); end
|
533
|
+
|
534
|
+
# @return [Boolean]
|
535
|
+
def can_autocorrect?; end
|
536
|
+
|
537
|
+
# This method exists to reparse the current node with modern features enabled.
|
538
|
+
# Modern features include "index send" emitting, which is necessary to unparse
|
539
|
+
# "index sends" (i.e. `[]` calls) back to index accessors (i.e. as `foo[bar]``).
|
540
|
+
# Otherwise, we would get the unparsed node as `foo.[](bar)`.
|
541
|
+
def node_reparsed_with_modern_features(node); end
|
542
|
+
end
|
543
|
+
|
544
|
+
# Create a subclass of AST Builder that has modern features turned on
|
545
|
+
class RuboCop::Cop::Sorbet::SignatureBuildOrder::ModernBuilder < ::RuboCop::AST::Builder; end
|
546
|
+
|
547
|
+
RuboCop::Cop::Sorbet::SignatureBuildOrder::ORDER = T.let(T.unsafe(nil), Hash)
|
548
|
+
|
549
|
+
# Abstract cop specific to Sorbet signatures
|
550
|
+
#
|
551
|
+
# You can subclass it to use the `on_signature` trigger and the `signature?` node matcher.
|
552
|
+
class RuboCop::Cop::Sorbet::SignatureCop < ::RuboCop::Cop::Cop
|
553
|
+
def allowed_recv(recv); end
|
554
|
+
def on_block(node); end
|
555
|
+
def on_signature(_); end
|
556
|
+
def signature?(param0 = T.unsafe(nil)); end
|
557
|
+
def with_runtime?(param0 = T.unsafe(nil)); end
|
558
|
+
def without_runtime?(param0 = T.unsafe(nil)); end
|
559
|
+
end
|
560
|
+
|
561
|
+
# This cop ensures empty class/module definitions in RBI files are
|
562
|
+
# done on a single line rather than being split across multiple lines.
|
563
|
+
#
|
564
|
+
# @example
|
565
|
+
#
|
566
|
+
# # bad
|
567
|
+
# module SomeModule
|
568
|
+
# end
|
569
|
+
#
|
570
|
+
# # good
|
571
|
+
# module SomeModule; end
|
572
|
+
class RuboCop::Cop::Sorbet::SingleLineRbiClassModuleDefinitions < ::RuboCop::Cop::Cop
|
573
|
+
def autocorrect(node); end
|
574
|
+
def on_class(node); end
|
575
|
+
def on_module(node); end
|
576
|
+
|
577
|
+
protected
|
578
|
+
|
579
|
+
def convert_newlines(source); end
|
580
|
+
def process_node(node); end
|
581
|
+
end
|
582
|
+
|
583
|
+
RuboCop::Cop::Sorbet::SingleLineRbiClassModuleDefinitions::MSG = T.let(T.unsafe(nil), String)
|
584
|
+
|
585
|
+
# This cop makes the Sorbet `strict` sigil mandatory in all files.
|
586
|
+
class RuboCop::Cop::Sorbet::StrictSigil < ::RuboCop::Cop::Sorbet::HasSigil
|
587
|
+
def minimum_strictness; end
|
588
|
+
end
|
589
|
+
|
590
|
+
# This cop makes the Sorbet `strong` sigil mandatory in all files.
|
591
|
+
class RuboCop::Cop::Sorbet::StrongSigil < ::RuboCop::Cop::Sorbet::HasSigil
|
592
|
+
def minimum_strictness; end
|
593
|
+
end
|
594
|
+
|
595
|
+
# This cop makes the Sorbet `true` sigil mandatory in all files.
|
596
|
+
class RuboCop::Cop::Sorbet::TrueSigil < ::RuboCop::Cop::Sorbet::HasSigil
|
597
|
+
def minimum_strictness; end
|
598
|
+
end
|
599
|
+
|
600
|
+
# This cop ensures all constants used as `T.type_alias` are using CamelCase.
|
601
|
+
#
|
602
|
+
# @example
|
603
|
+
#
|
604
|
+
# # bad
|
605
|
+
# FOO_OR_BAR = T.type_alias { T.any(Foo, Bar) }
|
606
|
+
#
|
607
|
+
# # good
|
608
|
+
# FooOrBar = T.type_alias { T.any(Foo, Bar) }
|
609
|
+
class RuboCop::Cop::Sorbet::TypeAliasName < ::RuboCop::Cop::Cop
|
610
|
+
def casgn_type_alias?(param0 = T.unsafe(nil)); end
|
611
|
+
def on_casgn(node); end
|
612
|
+
end
|
613
|
+
|
614
|
+
RuboCop::Cop::Sorbet::TypeAliasName::MSG = T.let(T.unsafe(nil), String)
|
615
|
+
|
616
|
+
# This cop checks that every Ruby file contains a valid Sorbet sigil.
|
617
|
+
# Adapted from: https://gist.github.com/clarkdave/85aca4e16f33fd52aceb6a0a29936e52
|
618
|
+
#
|
619
|
+
# Options:
|
620
|
+
#
|
621
|
+
# * `RequireSigilOnAllFiles`: make offense if the Sorbet typed is not found in the file (default: false)
|
622
|
+
# * `SuggestedStrictness`: Sorbet strictness level suggested in offense messages (default: 'false')
|
623
|
+
# * `MinimumStrictness`: If set, make offense if the strictness level in the file is below this one
|
624
|
+
#
|
625
|
+
# If a `MinimumStrictness` level is specified, it will be used in offense messages and autocorrect.
|
626
|
+
class RuboCop::Cop::Sorbet::ValidSigil < ::RuboCop::Cop::Cop
|
627
|
+
def autocorrect(_node); end
|
628
|
+
def investigate(processed_source); end
|
629
|
+
|
630
|
+
protected
|
631
|
+
|
632
|
+
# checks
|
633
|
+
def check_sigil_present(sigil); end
|
634
|
+
|
635
|
+
def check_strictness_level(sigil, strictness); end
|
636
|
+
def check_strictness_not_empty(sigil, strictness); end
|
637
|
+
def check_strictness_valid(sigil, strictness); end
|
638
|
+
|
639
|
+
# extraction
|
640
|
+
def extract_sigil(processed_source); end
|
641
|
+
|
642
|
+
def extract_strictness(sigil); end
|
643
|
+
|
644
|
+
# Default is `nil`
|
645
|
+
def minimum_strictness; end
|
646
|
+
|
647
|
+
# Default is `false`
|
648
|
+
#
|
649
|
+
# @return [Boolean]
|
650
|
+
def require_sigil_on_all_files?; end
|
651
|
+
|
652
|
+
# Default is `'false'`
|
653
|
+
def suggested_strictness; end
|
654
|
+
|
655
|
+
def suggested_strictness_level(minimum_strictness, suggested_strictness); end
|
656
|
+
end
|
657
|
+
|
658
|
+
RuboCop::Cop::Sorbet::ValidSigil::SIGIL_REGEX = T.let(T.unsafe(nil), Regexp)
|
659
|
+
RuboCop::Cop::Sorbet::ValidSigil::STRICTNESS_LEVELS = T.let(T.unsafe(nil), Array)
|
660
|
+
RuboCop::NodePattern = RuboCop::AST::NodePattern
|
661
|
+
RuboCop::ProcessedSource = RuboCop::AST::ProcessedSource
|
662
|
+
module RuboCop::Sorbet; end
|
663
|
+
RuboCop::Sorbet::CONFIG = T.let(T.unsafe(nil), Hash)
|
664
|
+
RuboCop::Sorbet::CONFIG_DEFAULT = T.let(T.unsafe(nil), Pathname)
|
665
|
+
class RuboCop::Sorbet::Error < ::StandardError; end
|
666
|
+
|
667
|
+
# Because RuboCop doesn't yet support plugins, we have to monkey patch in a
|
668
|
+
# bit of our configuration.
|
669
|
+
module RuboCop::Sorbet::Inject
|
670
|
+
class << self
|
671
|
+
def defaults!; end
|
672
|
+
end
|
673
|
+
end
|
674
|
+
|
675
|
+
RuboCop::Sorbet::PROJECT_ROOT = T.let(T.unsafe(nil), Pathname)
|
676
|
+
RuboCop::Sorbet::VERSION = T.let(T.unsafe(nil), String)
|
677
|
+
RuboCop::Token = RuboCop::AST::Token
|