rubocop-sorbet 0.5.1 → 0.6.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/release.yml +23 -0
- data/.github/workflows/ci.yml +26 -0
- data/.gitignore +1 -0
- data/Gemfile +1 -0
- data/Gemfile.lock +25 -41
- data/README.md +22 -0
- data/Rakefile +12 -16
- data/bin/console +3 -3
- data/bin/rspec +6 -6
- data/bin/rubocop +29 -0
- data/config/default.yml +94 -10
- data/config/rbi.yml +262 -0
- data/dev.yml +1 -1
- data/lib/rubocop/cop/sorbet/binding_constants_without_type_alias.rb +4 -4
- data/lib/rubocop/cop/sorbet/callback_conditionals_binding.rb +142 -0
- data/lib/rubocop/cop/sorbet/constants_from_strings.rb +1 -1
- data/lib/rubocop/cop/sorbet/forbid_include_const_literal.rb +11 -2
- data/lib/rubocop/cop/sorbet/forbid_superclass_const_literal.rb +2 -2
- data/lib/rubocop/cop/sorbet/forbid_t_unsafe.rb +26 -0
- data/lib/rubocop/cop/sorbet/forbid_untyped_struct_props.rb +2 -2
- data/lib/rubocop/cop/sorbet/one_ancestor_per_line.rb +75 -0
- data/lib/rubocop/cop/sorbet/rbi/forbid_extend_t_sig_helpers_in_shims.rb +53 -0
- data/lib/rubocop/cop/sorbet/rbi/forbid_rbi_outside_of_allowed_paths.rb +47 -0
- data/lib/rubocop/cop/sorbet/rbi/single_line_rbi_class_module_definitions.rb +46 -0
- data/lib/rubocop/cop/sorbet/sigils/enforce_sigil_order.rb +6 -6
- data/lib/rubocop/cop/sorbet/sigils/enforce_single_sigil.rb +63 -0
- data/lib/rubocop/cop/sorbet/sigils/false_sigil.rb +3 -3
- data/lib/rubocop/cop/sorbet/sigils/has_sigil.rb +2 -2
- data/lib/rubocop/cop/sorbet/sigils/ignore_sigil.rb +3 -3
- data/lib/rubocop/cop/sorbet/sigils/strict_sigil.rb +3 -3
- data/lib/rubocop/cop/sorbet/sigils/strong_sigil.rb +3 -3
- data/lib/rubocop/cop/sorbet/sigils/true_sigil.rb +3 -3
- data/lib/rubocop/cop/sorbet/sigils/valid_sigil.rb +10 -8
- data/lib/rubocop/cop/sorbet/signatures/allow_incompatible_override.rb +3 -3
- data/lib/rubocop/cop/sorbet/signatures/checked_true_in_signature.rb +6 -6
- data/lib/rubocop/cop/sorbet/signatures/enforce_signatures.rb +30 -21
- data/lib/rubocop/cop/sorbet/signatures/keyword_argument_ordering.rb +3 -3
- data/lib/rubocop/cop/sorbet/signatures/signature_build_order.rb +24 -15
- data/lib/rubocop/cop/sorbet/signatures/signature_cop.rb +17 -2
- data/lib/rubocop/cop/sorbet_cops.rb +26 -19
- data/lib/rubocop/sorbet/version.rb +1 -1
- data/lib/rubocop/sorbet.rb +1 -1
- data/lib/rubocop-sorbet.rb +5 -5
- data/manual/cops.md +7 -1
- data/manual/cops_sorbet.md +247 -14
- data/rubocop-sorbet.gemspec +2 -2
- data/service.yml +0 -5
- data/tasks/cops_documentation.rake +60 -62
- metadata +20 -12
- data/.shopify-build/VERSION +0 -1
- data/.shopify-build/rubocop-sorbet.yml +0 -16
- data/lib/rubocop/cop/sorbet/signatures/parameters_ordering_in_signature.rb +0 -70
@@ -1,22 +1,29 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
-
require_relative
|
3
|
-
require_relative
|
4
|
-
require_relative
|
5
|
-
require_relative
|
6
|
-
require_relative
|
2
|
+
require_relative "sorbet/binding_constants_without_type_alias"
|
3
|
+
require_relative "sorbet/constants_from_strings"
|
4
|
+
require_relative "sorbet/forbid_superclass_const_literal"
|
5
|
+
require_relative "sorbet/forbid_include_const_literal"
|
6
|
+
require_relative "sorbet/forbid_untyped_struct_props"
|
7
|
+
require_relative "sorbet/one_ancestor_per_line"
|
8
|
+
require_relative "sorbet/callback_conditionals_binding"
|
9
|
+
require_relative "sorbet/forbid_t_unsafe"
|
7
10
|
|
8
|
-
require_relative
|
9
|
-
require_relative
|
10
|
-
require_relative
|
11
|
-
require_relative 'sorbet/signatures/parameters_ordering_in_signature'
|
12
|
-
require_relative 'sorbet/signatures/signature_build_order'
|
13
|
-
require_relative 'sorbet/signatures/enforce_signatures'
|
11
|
+
require_relative "sorbet/rbi/forbid_extend_t_sig_helpers_in_shims"
|
12
|
+
require_relative "sorbet/rbi/forbid_rbi_outside_of_allowed_paths"
|
13
|
+
require_relative "sorbet/rbi/single_line_rbi_class_module_definitions"
|
14
14
|
|
15
|
-
require_relative
|
16
|
-
require_relative
|
17
|
-
require_relative
|
18
|
-
require_relative
|
19
|
-
require_relative
|
20
|
-
|
21
|
-
require_relative
|
22
|
-
require_relative
|
15
|
+
require_relative "sorbet/signatures/allow_incompatible_override"
|
16
|
+
require_relative "sorbet/signatures/checked_true_in_signature"
|
17
|
+
require_relative "sorbet/signatures/keyword_argument_ordering"
|
18
|
+
require_relative "sorbet/signatures/signature_build_order"
|
19
|
+
require_relative "sorbet/signatures/enforce_signatures"
|
20
|
+
|
21
|
+
require_relative "sorbet/sigils/valid_sigil"
|
22
|
+
require_relative "sorbet/sigils/has_sigil"
|
23
|
+
require_relative "sorbet/sigils/ignore_sigil"
|
24
|
+
require_relative "sorbet/sigils/false_sigil"
|
25
|
+
require_relative "sorbet/sigils/true_sigil"
|
26
|
+
require_relative "sorbet/sigils/strict_sigil"
|
27
|
+
require_relative "sorbet/sigils/strong_sigil"
|
28
|
+
require_relative "sorbet/sigils/enforce_sigil_order"
|
29
|
+
require_relative "sorbet/sigils/enforce_single_sigil"
|
data/lib/rubocop/sorbet.rb
CHANGED
@@ -7,7 +7,7 @@ module RuboCop
|
|
7
7
|
class Error < StandardError; end
|
8
8
|
|
9
9
|
PROJECT_ROOT = Pathname.new(__dir__).parent.parent.expand_path.freeze
|
10
|
-
CONFIG_DEFAULT = PROJECT_ROOT.join(
|
10
|
+
CONFIG_DEFAULT = PROJECT_ROOT.join("config", "default.yml").freeze
|
11
11
|
CONFIG = YAML.safe_load(CONFIG_DEFAULT.read).freeze
|
12
12
|
|
13
13
|
private_constant(:CONFIG_DEFAULT, :PROJECT_ROOT)
|
data/lib/rubocop-sorbet.rb
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require
|
3
|
+
require "rubocop"
|
4
4
|
|
5
|
-
require_relative
|
6
|
-
require_relative
|
7
|
-
require_relative
|
5
|
+
require_relative "rubocop/sorbet"
|
6
|
+
require_relative "rubocop/sorbet/version"
|
7
|
+
require_relative "rubocop/sorbet/inject"
|
8
8
|
|
9
9
|
RuboCop::Sorbet::Inject.defaults!
|
10
10
|
|
11
|
-
require_relative
|
11
|
+
require_relative "rubocop/cop/sorbet_cops"
|
data/manual/cops.md
CHANGED
@@ -7,20 +7,26 @@ In the following section you find all available cops:
|
|
7
7
|
|
8
8
|
* [Sorbet/AllowIncompatibleOverride](cops_sorbet.md#sorbetallowincompatibleoverride)
|
9
9
|
* [Sorbet/BindingConstantWithoutTypeAlias](cops_sorbet.md#sorbetbindingconstantwithouttypealias)
|
10
|
+
* [Sorbet/CallbackConditionalsBinding](cops_sorbet.md#sorbetcallbackconditionalsbinding)
|
10
11
|
* [Sorbet/CheckedTrueInSignature](cops_sorbet.md#sorbetcheckedtrueinsignature)
|
11
12
|
* [Sorbet/ConstantsFromStrings](cops_sorbet.md#sorbetconstantsfromstrings)
|
12
13
|
* [Sorbet/EnforceSigilOrder](cops_sorbet.md#sorbetenforcesigilorder)
|
13
14
|
* [Sorbet/EnforceSignatures](cops_sorbet.md#sorbetenforcesignatures)
|
15
|
+
* [Sorbet/EnforceSingleSigil](cops_sorbet.md#sorbetenforcesinglesigil)
|
14
16
|
* [Sorbet/FalseSigil](cops_sorbet.md#sorbetfalsesigil)
|
17
|
+
* [Sorbet/ForbidExtendTSigHelpersInShims](cops_sorbet.md#sorbetforbidextendtsighelpersinshims)
|
15
18
|
* [Sorbet/ForbidIncludeConstLiteral](cops_sorbet.md#sorbetforbidincludeconstliteral)
|
19
|
+
* [Sorbet/ForbidRBIOutsideOfAllowedPaths](cops_sorbet.md#sorbetforbidrbioutsideofallowedpaths)
|
16
20
|
* [Sorbet/ForbidSuperclassConstLiteral](cops_sorbet.md#sorbetforbidsuperclassconstliteral)
|
21
|
+
* [Sorbet/ForbidTUnsafe](cops_sorbet.md#sorbetforbidtunsafe)
|
17
22
|
* [Sorbet/ForbidUntypedStructProps](cops_sorbet.md#sorbetforbiduntypedstructprops)
|
18
23
|
* [Sorbet/HasSigil](cops_sorbet.md#sorbethassigil)
|
19
24
|
* [Sorbet/IgnoreSigil](cops_sorbet.md#sorbetignoresigil)
|
20
25
|
* [Sorbet/KeywordArgumentOrdering](cops_sorbet.md#sorbetkeywordargumentordering)
|
21
|
-
* [Sorbet/
|
26
|
+
* [Sorbet/OneAncestorPerLine](cops_sorbet.md#sorbetoneancestorperline)
|
22
27
|
* [Sorbet/SignatureBuildOrder](cops_sorbet.md#sorbetsignaturebuildorder)
|
23
28
|
* [Sorbet/SignatureCop](cops_sorbet.md#sorbetsignaturecop)
|
29
|
+
* [Sorbet/SingleLineRbiClassModuleDefinitions](cops_sorbet.md#sorbetsinglelinerbiclassmoduledefinitions)
|
24
30
|
* [Sorbet/StrictSigil](cops_sorbet.md#sorbetstrictsigil)
|
25
31
|
* [Sorbet/StrongSigil](cops_sorbet.md#sorbetstrongsigil)
|
26
32
|
* [Sorbet/TrueSigil](cops_sorbet.md#sorbettruesigil)
|
data/manual/cops_sorbet.md
CHANGED
@@ -41,6 +41,44 @@ FooOrBar = T.any(Foo, Bar)
|
|
41
41
|
FooOrBar = T.type_alias { T.any(Foo, Bar) }
|
42
42
|
```
|
43
43
|
|
44
|
+
## Sorbet/CallbackConditionalsBinding
|
45
|
+
|
46
|
+
Enabled by default | Safe | Supports autocorrection | VersionAdded | VersionChanged
|
47
|
+
--- | --- | --- | --- | ---
|
48
|
+
Disabled | No | Yes | 0.7.0 | -
|
49
|
+
|
50
|
+
This cop ensures that callback conditionals are bound to the right type
|
51
|
+
so that they are type checked properly.
|
52
|
+
|
53
|
+
Auto-correction is unsafe because other libraries define similar style callbacks as Rails, but don't always need
|
54
|
+
binding to the attached class. Auto-correcting those usages can lead to false positives and auto-correction
|
55
|
+
introduces new typing errors.
|
56
|
+
|
57
|
+
### Examples
|
58
|
+
|
59
|
+
```ruby
|
60
|
+
# bad
|
61
|
+
class Post < ApplicationRecord
|
62
|
+
before_create :do_it, if: -> { should_do_it? }
|
63
|
+
|
64
|
+
def should_do_it?
|
65
|
+
true
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
# good
|
70
|
+
class Post < ApplicationRecord
|
71
|
+
before_create :do_it, if: -> {
|
72
|
+
T.bind(self, Post)
|
73
|
+
should_do_it?
|
74
|
+
}
|
75
|
+
|
76
|
+
def should_do_it?
|
77
|
+
true
|
78
|
+
end
|
79
|
+
end
|
80
|
+
```
|
81
|
+
|
44
82
|
## Sorbet/CheckedTrueInSignature
|
45
83
|
|
46
84
|
Enabled by default | Safe | Supports autocorrection | VersionAdded | VersionChanged
|
@@ -155,6 +193,33 @@ You can configure the placeholders used by changing the following options:
|
|
155
193
|
* `ParameterTypePlaceholder`: placeholders used for parameter types (default: 'T.untyped')
|
156
194
|
* `ReturnTypePlaceholder`: placeholders used for return types (default: 'T.untyped')
|
157
195
|
|
196
|
+
## Sorbet/EnforceSingleSigil
|
197
|
+
|
198
|
+
Enabled by default | Safe | Supports autocorrection | VersionAdded | VersionChanged
|
199
|
+
--- | --- | --- | --- | ---
|
200
|
+
Enabled | Yes | Yes | <<next>> | -
|
201
|
+
|
202
|
+
This cop checks that there is only one Sorbet sigil in a given file
|
203
|
+
|
204
|
+
For example, the following class with two sigils
|
205
|
+
|
206
|
+
```ruby
|
207
|
+
# typed: true
|
208
|
+
# typed: true
|
209
|
+
# frozen_string_literal: true
|
210
|
+
class Foo; end
|
211
|
+
```
|
212
|
+
|
213
|
+
Will be corrected as:
|
214
|
+
|
215
|
+
```ruby
|
216
|
+
# typed: true
|
217
|
+
# frozen_string_literal: true
|
218
|
+
class Foo; end
|
219
|
+
```
|
220
|
+
|
221
|
+
Other comments or magic comments are left in place.
|
222
|
+
|
158
223
|
## Sorbet/FalseSigil
|
159
224
|
|
160
225
|
Enabled by default | Safe | Supports autocorrection | VersionAdded | VersionChanged
|
@@ -167,31 +232,120 @@ This cop makes the Sorbet `false` sigil mandatory in all files.
|
|
167
232
|
|
168
233
|
Name | Default value | Configurable values
|
169
234
|
--- | --- | ---
|
170
|
-
SuggestedStrictness | `
|
171
|
-
Include | `**/*.rb
|
235
|
+
SuggestedStrictness | `false` | String
|
236
|
+
Include | `**/*.{rb,rbi,rake,ru}` | Array
|
172
237
|
Exclude | `bin/**/*`, `db/**/*.rb`, `script/**/*` | Array
|
173
238
|
|
239
|
+
## Sorbet/ForbidExtendTSigHelpersInShims
|
240
|
+
|
241
|
+
Enabled by default | Safe | Supports autocorrection | VersionAdded | VersionChanged
|
242
|
+
--- | --- | --- | --- | ---
|
243
|
+
Enabled | Yes | Yes | 0.6.0 | -
|
244
|
+
|
245
|
+
This cop ensures RBI shims do not include a call to extend T::Sig
|
246
|
+
or to extend T::Helpers
|
247
|
+
|
248
|
+
### Examples
|
249
|
+
|
250
|
+
```ruby
|
251
|
+
# bad
|
252
|
+
module SomeModule
|
253
|
+
extend T::Sig
|
254
|
+
extend T::Helpers
|
255
|
+
|
256
|
+
sig { returns(String) }
|
257
|
+
def foo; end
|
258
|
+
end
|
259
|
+
|
260
|
+
# good
|
261
|
+
module SomeModule
|
262
|
+
sig { returns(String) }
|
263
|
+
def foo; end
|
264
|
+
end
|
265
|
+
```
|
266
|
+
|
267
|
+
### Configurable attributes
|
268
|
+
|
269
|
+
Name | Default value | Configurable values
|
270
|
+
--- | --- | ---
|
271
|
+
Include | `**/*.rbi` | Array
|
272
|
+
|
174
273
|
## Sorbet/ForbidIncludeConstLiteral
|
175
274
|
|
176
275
|
Enabled by default | Safe | Supports autocorrection | VersionAdded | VersionChanged
|
177
276
|
--- | --- | --- | --- | ---
|
178
|
-
Disabled | Yes | No
|
277
|
+
Disabled | Yes | No | 0.2.0 | 0.5.0
|
179
278
|
|
180
279
|
No documentation
|
181
280
|
|
281
|
+
## Sorbet/ForbidRBIOutsideOfAllowedPaths
|
282
|
+
|
283
|
+
Enabled by default | Safe | Supports autocorrection | VersionAdded | VersionChanged
|
284
|
+
--- | --- | --- | --- | ---
|
285
|
+
Enabled | Yes | No | 0.6.1 | -
|
286
|
+
|
287
|
+
This cop makes sure that RBI files are always located under the defined allowed paths
|
288
|
+
|
289
|
+
Options:
|
290
|
+
|
291
|
+
* `AllowedPaths`: A list of the paths where RBI files are allowed (default: ["sorbet/rbi/**"])
|
292
|
+
|
293
|
+
### Examples
|
294
|
+
|
295
|
+
```ruby
|
296
|
+
# bad
|
297
|
+
# lib/some_file.rbi
|
298
|
+
# other_file.rbi
|
299
|
+
|
300
|
+
# good
|
301
|
+
# sorbet/rbi/some_file.rbi
|
302
|
+
# sorbet/rbi/any/path/for/file.rbi
|
303
|
+
```
|
304
|
+
|
305
|
+
### Configurable attributes
|
306
|
+
|
307
|
+
Name | Default value | Configurable values
|
308
|
+
--- | --- | ---
|
309
|
+
AllowedPaths | `sorbet/rbi/**` | Array
|
310
|
+
Include | `**/*.rbi` | Array
|
311
|
+
|
182
312
|
## Sorbet/ForbidSuperclassConstLiteral
|
183
313
|
|
184
314
|
Enabled by default | Safe | Supports autocorrection | VersionAdded | VersionChanged
|
185
315
|
--- | --- | --- | --- | ---
|
186
|
-
Disabled | Yes | No
|
316
|
+
Disabled | Yes | No | 0.2.0 | 0.6.1
|
187
317
|
|
188
318
|
No documentation
|
189
319
|
|
320
|
+
### Configurable attributes
|
321
|
+
|
322
|
+
Name | Default value | Configurable values
|
323
|
+
--- | --- | ---
|
324
|
+
Exclude | `db/migrate/*.rb` | Array
|
325
|
+
|
326
|
+
## Sorbet/ForbidTUnsafe
|
327
|
+
|
328
|
+
Enabled by default | Safe | Supports autocorrection | VersionAdded | VersionChanged
|
329
|
+
--- | --- | --- | --- | ---
|
330
|
+
Disabled | Yes | No | 0.7.0 | 0.7.0
|
331
|
+
|
332
|
+
This cop disallows using `T.unsafe` anywhere.
|
333
|
+
|
334
|
+
### Examples
|
335
|
+
|
336
|
+
```ruby
|
337
|
+
# bad
|
338
|
+
T.unsafe(foo)
|
339
|
+
|
340
|
+
# good
|
341
|
+
foo
|
342
|
+
```
|
343
|
+
|
190
344
|
## Sorbet/ForbidUntypedStructProps
|
191
345
|
|
192
346
|
Enabled by default | Safe | Supports autocorrection | VersionAdded | VersionChanged
|
193
347
|
--- | --- | --- | --- | ---
|
194
|
-
Enabled | Yes | No | 0.
|
348
|
+
Enabled | Yes | No | 0.4.0 | -
|
195
349
|
|
196
350
|
This cop disallows use of `T.untyped` or `T.nilable(T.untyped)`
|
197
351
|
as a prop type for `T::Struct`.
|
@@ -227,6 +381,15 @@ Options:
|
|
227
381
|
|
228
382
|
If a `MinimumStrictness` level is specified, it will be used in offense messages and autocorrect.
|
229
383
|
|
384
|
+
### Configurable attributes
|
385
|
+
|
386
|
+
Name | Default value | Configurable values
|
387
|
+
--- | --- | ---
|
388
|
+
SuggestedStrictness | `false` | String
|
389
|
+
MinimumStrictness | `false` | String
|
390
|
+
Include | `**/*.{rb,rbi,rake,ru}` | Array
|
391
|
+
Exclude | `bin/**/*`, `db/**/*.rb`, `script/**/*` | Array
|
392
|
+
|
230
393
|
## Sorbet/IgnoreSigil
|
231
394
|
|
232
395
|
Enabled by default | Safe | Supports autocorrection | VersionAdded | VersionChanged
|
@@ -235,6 +398,14 @@ Disabled | Yes | Yes | 0.3.3 | -
|
|
235
398
|
|
236
399
|
This cop makes the Sorbet `ignore` sigil mandatory in all files.
|
237
400
|
|
401
|
+
### Configurable attributes
|
402
|
+
|
403
|
+
Name | Default value | Configurable values
|
404
|
+
--- | --- | ---
|
405
|
+
SuggestedStrictness | `ignore` | String
|
406
|
+
Include | `**/*.{rb,rbi,rake,ru}` | Array
|
407
|
+
Exclude | `bin/**/*`, `db/**/*.rb`, `script/**/*` | Array
|
408
|
+
|
238
409
|
## Sorbet/KeywordArgumentOrdering
|
239
410
|
|
240
411
|
Enabled by default | Safe | Supports autocorrection | VersionAdded | VersionChanged
|
@@ -258,26 +429,28 @@ sig { params(b: String, a: Integer).void }
|
|
258
429
|
def foo(b:, a: 1); end
|
259
430
|
```
|
260
431
|
|
261
|
-
## Sorbet/
|
432
|
+
## Sorbet/OneAncestorPerLine
|
262
433
|
|
263
434
|
Enabled by default | Safe | Supports autocorrection | VersionAdded | VersionChanged
|
264
435
|
--- | --- | --- | --- | ---
|
265
|
-
|
436
|
+
Disabled | Yes | Yes | 0.6.0 | -
|
266
437
|
|
267
|
-
This cop
|
268
|
-
|
269
|
-
when such inconsistency occurs.
|
438
|
+
This cop ensures one ancestor per requires_ancestor line
|
439
|
+
rather than chaining them as a comma-separated list.
|
270
440
|
|
271
441
|
### Examples
|
272
442
|
|
273
443
|
```ruby
|
274
444
|
# bad
|
275
|
-
|
276
|
-
|
445
|
+
module SomeModule
|
446
|
+
requires_ancestor Kernel, Minitest::Assertions
|
447
|
+
end
|
277
448
|
|
278
449
|
# good
|
279
|
-
|
280
|
-
|
450
|
+
module SomeModule
|
451
|
+
requires_ancestor Kernel
|
452
|
+
requires_ancestor Minitest::Assertions
|
453
|
+
end
|
281
454
|
```
|
282
455
|
|
283
456
|
## Sorbet/SignatureBuildOrder
|
@@ -298,6 +471,32 @@ Abstract cop specific to Sorbet signatures
|
|
298
471
|
|
299
472
|
You can subclass it to use the `on_signature` trigger and the `signature?` node matcher.
|
300
473
|
|
474
|
+
## Sorbet/SingleLineRbiClassModuleDefinitions
|
475
|
+
|
476
|
+
Enabled by default | Safe | Supports autocorrection | VersionAdded | VersionChanged
|
477
|
+
--- | --- | --- | --- | ---
|
478
|
+
Disabled | Yes | Yes | 0.6.0 | -
|
479
|
+
|
480
|
+
This cop ensures empty class/module definitions in RBI files are
|
481
|
+
done on a single line rather than being split across multiple lines.
|
482
|
+
|
483
|
+
### Examples
|
484
|
+
|
485
|
+
```ruby
|
486
|
+
# bad
|
487
|
+
module SomeModule
|
488
|
+
end
|
489
|
+
|
490
|
+
# good
|
491
|
+
module SomeModule; end
|
492
|
+
```
|
493
|
+
|
494
|
+
### Configurable attributes
|
495
|
+
|
496
|
+
Name | Default value | Configurable values
|
497
|
+
--- | --- | ---
|
498
|
+
Include | `**/*.rbi` | Array
|
499
|
+
|
301
500
|
## Sorbet/StrictSigil
|
302
501
|
|
303
502
|
Enabled by default | Safe | Supports autocorrection | VersionAdded | VersionChanged
|
@@ -306,6 +505,14 @@ Disabled | Yes | Yes | 0.3.3 | -
|
|
306
505
|
|
307
506
|
This cop makes the Sorbet `strict` sigil mandatory in all files.
|
308
507
|
|
508
|
+
### Configurable attributes
|
509
|
+
|
510
|
+
Name | Default value | Configurable values
|
511
|
+
--- | --- | ---
|
512
|
+
SuggestedStrictness | `strict` | String
|
513
|
+
Include | `**/*.{rb,rbi,rake,ru}` | Array
|
514
|
+
Exclude | `bin/**/*`, `db/**/*.rb`, `script/**/*` | Array
|
515
|
+
|
309
516
|
## Sorbet/StrongSigil
|
310
517
|
|
311
518
|
Enabled by default | Safe | Supports autocorrection | VersionAdded | VersionChanged
|
@@ -314,6 +521,14 @@ Disabled | Yes | Yes | 0.3.3 | -
|
|
314
521
|
|
315
522
|
This cop makes the Sorbet `strong` sigil mandatory in all files.
|
316
523
|
|
524
|
+
### Configurable attributes
|
525
|
+
|
526
|
+
Name | Default value | Configurable values
|
527
|
+
--- | --- | ---
|
528
|
+
SuggestedStrictness | `strong` | String
|
529
|
+
Include | `**/*.{rb,rbi,rake,ru}` | Array
|
530
|
+
Exclude | `bin/**/*`, `db/**/*.rb`, `script/**/*` | Array
|
531
|
+
|
317
532
|
## Sorbet/TrueSigil
|
318
533
|
|
319
534
|
Enabled by default | Safe | Supports autocorrection | VersionAdded | VersionChanged
|
@@ -322,6 +537,14 @@ Disabled | Yes | Yes | 0.3.3 | -
|
|
322
537
|
|
323
538
|
This cop makes the Sorbet `true` sigil mandatory in all files.
|
324
539
|
|
540
|
+
### Configurable attributes
|
541
|
+
|
542
|
+
Name | Default value | Configurable values
|
543
|
+
--- | --- | ---
|
544
|
+
SuggestedStrictness | `true` | String
|
545
|
+
Include | `**/*.{rb,rbi,rake,ru}` | Array
|
546
|
+
Exclude | `bin/**/*`, `db/**/*.rb`, `script/**/*` | Array
|
547
|
+
|
325
548
|
## Sorbet/ValidSigil
|
326
549
|
|
327
550
|
Enabled by default | Safe | Supports autocorrection | VersionAdded | VersionChanged
|
@@ -338,3 +561,13 @@ Options:
|
|
338
561
|
* `MinimumStrictness`: If set, make offense if the strictness level in the file is below this one
|
339
562
|
|
340
563
|
If a `MinimumStrictness` level is specified, it will be used in offense messages and autocorrect.
|
564
|
+
|
565
|
+
### Configurable attributes
|
566
|
+
|
567
|
+
Name | Default value | Configurable values
|
568
|
+
--- | --- | ---
|
569
|
+
RequireSigilOnAllFiles | `false` | Boolean
|
570
|
+
SuggestedStrictness | `false` | String
|
571
|
+
MinimumStrictness | `false` | String
|
572
|
+
Include | `**/*.{rb,rbi,rake,ru}` | Array
|
573
|
+
Exclude | `bin/**/*`, `db/**/*.rb`, `script/**/*` | Array
|
data/rubocop-sorbet.gemspec
CHANGED
@@ -25,7 +25,7 @@ Gem::Specification.new do |spec|
|
|
25
25
|
spec.require_paths = ["lib"]
|
26
26
|
|
27
27
|
spec.add_development_dependency("rspec", "~> 3.7")
|
28
|
-
spec.add_development_dependency("unparser")
|
28
|
+
spec.add_development_dependency("unparser", "~> 0.6")
|
29
29
|
|
30
|
-
spec.add_runtime_dependency("rubocop")
|
30
|
+
spec.add_runtime_dependency("rubocop", ">= 0.90.0")
|
31
31
|
end
|