rubocop-sorbet 0.8.4 → 0.8.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/dependabot.yml +5 -0
- data/.github/workflows/dependabot_automerge.yml +65 -0
- data/Gemfile.lock +8 -12
- data/config/default.yml +8 -0
- data/config/rbi.yml +16 -0
- data/lib/rubocop/cop/sorbet/constants_from_strings.rb +1 -0
- data/lib/rubocop/cop/sorbet/mixin/target_sorbet_version.rb +1 -1
- data/lib/rubocop/cop/sorbet/rbi/forbid_rbi_outside_of_allowed_paths.rb +4 -11
- data/lib/rubocop/cop/sorbet/rbi_versioning/gem_version_annotation_helper.rb +27 -0
- data/lib/rubocop/cop/sorbet/rbi_versioning/valid_gem_version_annotations.rb +62 -0
- data/lib/rubocop/cop/sorbet/refinement.rb +52 -0
- data/lib/rubocop/cop/sorbet/t_enum/forbid_comparable_t_enum.rb +1 -1
- data/lib/rubocop/cop/sorbet/t_enum/multiple_t_enum_values.rb +1 -1
- data/lib/rubocop/cop/sorbet_cops.rb +4 -0
- data/lib/rubocop/sorbet/inject.rb +8 -0
- data/lib/rubocop/sorbet/version.rb +1 -1
- data/manual/cops.md +2 -0
- data/manual/cops_sorbet.md +61 -0
- metadata +7 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5eabd8cb864c16962c3d9f7ca1cb64bd9a811424bc480df6f976f28c2741eb97
|
4
|
+
data.tar.gz: c25050b4162e19a06c525e7e008a79ed8ffd1217c24e57cd03e4af88f4194abf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2cbc0786d76687e380eb8252a580bbfa06fb893d0b283ca7a04516f85f77ccec4ec39d5d6eaecdda31fc1cc5ffa0a2d9b3b6f3357dd1a9a4bd83aa1f0265d617
|
7
|
+
data.tar.gz: a22169eca15cf38a85cbf234c73cf26aed164460af125ed15978feab77cc7fdf2555b5f71037ba4a5c938e3861d0bee6d8141bfe5ee30a37bcf3fa71bcc37fd7
|
data/.github/dependabot.yml
CHANGED
@@ -0,0 +1,65 @@
|
|
1
|
+
name: Dependabot auto-merge
|
2
|
+
on: pull_request_target
|
3
|
+
|
4
|
+
permissions:
|
5
|
+
pull-requests: write
|
6
|
+
contents: write
|
7
|
+
|
8
|
+
jobs:
|
9
|
+
dependabot:
|
10
|
+
runs-on: ubuntu-latest
|
11
|
+
if: ${{ github.event.pull_request.user.login == 'dependabot[bot]' }}
|
12
|
+
steps:
|
13
|
+
- name: Dependabot metadata
|
14
|
+
id: metadata
|
15
|
+
uses: dependabot/fetch-metadata@v2
|
16
|
+
with:
|
17
|
+
github-token: "${{ secrets.GITHUB_TOKEN }}"
|
18
|
+
- name: Enable auto-merge for Dependabot PRs
|
19
|
+
if: ${{ steps.metadata.outputs.update-type != 'version-update:semver-major' }}
|
20
|
+
uses: actions/github-script@v7
|
21
|
+
with:
|
22
|
+
github-token: "${{ secrets.GITHUB_TOKEN }}"
|
23
|
+
script: |
|
24
|
+
const getPullRequestIdQuery = `query GetPullRequestId($owner: String!, $repo: String!, $pullRequestNumber: Int!) {
|
25
|
+
repository(owner: $owner, name: $repo) {
|
26
|
+
pullRequest(number: $pullRequestNumber) {
|
27
|
+
id
|
28
|
+
}
|
29
|
+
}
|
30
|
+
}`
|
31
|
+
const repoInfo = {
|
32
|
+
owner: context.repo.owner,
|
33
|
+
repo: context.repo.repo,
|
34
|
+
pullRequestNumber: context.issue.number,
|
35
|
+
}
|
36
|
+
const response = await github.graphql(getPullRequestIdQuery, repoInfo)
|
37
|
+
|
38
|
+
await github.rest.pulls.createReview({
|
39
|
+
pull_number: context.issue.number,
|
40
|
+
owner: context.repo.owner,
|
41
|
+
repo: context.repo.repo,
|
42
|
+
event: 'APPROVE',
|
43
|
+
})
|
44
|
+
|
45
|
+
const enableAutoMergeQuery = `mutation ($pullRequestId: ID!, $mergeMethod: PullRequestMergeMethod!) {
|
46
|
+
enablePullRequestAutoMerge(input: {
|
47
|
+
pullRequestId: $pullRequestId,
|
48
|
+
mergeMethod: $mergeMethod
|
49
|
+
}) {
|
50
|
+
pullRequest {
|
51
|
+
autoMergeRequest {
|
52
|
+
enabledAt
|
53
|
+
enabledBy {
|
54
|
+
login
|
55
|
+
}
|
56
|
+
}
|
57
|
+
}
|
58
|
+
}
|
59
|
+
}`
|
60
|
+
const data = {
|
61
|
+
pullRequestId: response.repository.pullRequest.id,
|
62
|
+
mergeMethod: 'MERGE',
|
63
|
+
}
|
64
|
+
|
65
|
+
await github.graphql(enableAutoMergeQuery, data)
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
rubocop-sorbet (0.8.
|
4
|
+
rubocop-sorbet (0.8.6)
|
5
5
|
rubocop (>= 1)
|
6
6
|
|
7
7
|
GEM
|
@@ -18,13 +18,13 @@ GEM
|
|
18
18
|
reline (>= 0.4.2)
|
19
19
|
json (2.7.2)
|
20
20
|
language_server-protocol (3.17.0.3)
|
21
|
-
parallel (1.
|
22
|
-
parser (3.3.
|
21
|
+
parallel (1.26.3)
|
22
|
+
parser (3.3.5.0)
|
23
23
|
ast (~> 2.4.1)
|
24
24
|
racc
|
25
25
|
psych (5.1.2)
|
26
26
|
stringio
|
27
|
-
racc (1.8.
|
27
|
+
racc (1.8.1)
|
28
28
|
rainbow (3.1.1)
|
29
29
|
rake (13.2.1)
|
30
30
|
rdoc (6.6.3.1)
|
@@ -32,8 +32,6 @@ GEM
|
|
32
32
|
regexp_parser (2.9.2)
|
33
33
|
reline (0.5.1)
|
34
34
|
io-console (~> 0.5)
|
35
|
-
rexml (3.3.1)
|
36
|
-
strscan
|
37
35
|
rspec (3.13.0)
|
38
36
|
rspec-core (~> 3.13.0)
|
39
37
|
rspec-expectations (~> 3.13.0)
|
@@ -47,26 +45,24 @@ GEM
|
|
47
45
|
diff-lcs (>= 1.2.0, < 2.0)
|
48
46
|
rspec-support (~> 3.13.0)
|
49
47
|
rspec-support (3.13.1)
|
50
|
-
rubocop (1.
|
48
|
+
rubocop (1.66.1)
|
51
49
|
json (~> 2.3)
|
52
50
|
language_server-protocol (>= 3.17.0)
|
53
51
|
parallel (~> 1.10)
|
54
52
|
parser (>= 3.3.0.2)
|
55
53
|
rainbow (>= 2.2.2, < 4.0)
|
56
54
|
regexp_parser (>= 2.4, < 3.0)
|
57
|
-
|
58
|
-
rubocop-ast (>= 1.31.1, < 2.0)
|
55
|
+
rubocop-ast (>= 1.32.2, < 2.0)
|
59
56
|
ruby-progressbar (~> 1.7)
|
60
57
|
unicode-display_width (>= 2.4.0, < 3.0)
|
61
|
-
rubocop-ast (1.
|
58
|
+
rubocop-ast (1.32.3)
|
62
59
|
parser (>= 3.3.1.0)
|
63
60
|
rubocop-shopify (2.15.1)
|
64
61
|
rubocop (~> 1.51)
|
65
62
|
ruby-progressbar (1.13.0)
|
66
63
|
stringio (3.1.0)
|
67
|
-
strscan (3.1.0)
|
68
64
|
unicode-display_width (2.5.0)
|
69
|
-
yard (0.9.
|
65
|
+
yard (0.9.37)
|
70
66
|
|
71
67
|
PLATFORMS
|
72
68
|
ruby
|
data/config/default.yml
CHANGED
@@ -1,3 +1,11 @@
|
|
1
|
+
Sorbet/Refinement:
|
2
|
+
Description: >-
|
3
|
+
Checks for the use of Ruby Refinements library. Refinements add
|
4
|
+
complexity and incur a performance penalty that can be significant
|
5
|
+
for large code bases. They are also not supported by Sorbet.
|
6
|
+
Enabled: pending
|
7
|
+
VersionAdded: '<<next>>'
|
8
|
+
|
1
9
|
inherit_mode:
|
2
10
|
merge:
|
3
11
|
- Exclude
|
data/config/rbi.yml
CHANGED
@@ -169,9 +169,15 @@ Layout/SpaceBeforeFirstArg:
|
|
169
169
|
Layout/SpaceBeforeSemicolon:
|
170
170
|
Enabled: true
|
171
171
|
|
172
|
+
Layout/SpaceInsideBlockBraces:
|
173
|
+
Enabled: true
|
174
|
+
|
172
175
|
Layout/SpaceInsideParens:
|
173
176
|
Enabled: true
|
174
177
|
|
178
|
+
Layout/SpaceInsideReferenceBrackets:
|
179
|
+
Enabled: true
|
180
|
+
|
175
181
|
Layout/TrailingEmptyLines:
|
176
182
|
Enabled: true
|
177
183
|
EnforcedStyle: final_newline
|
@@ -220,6 +226,16 @@ Sorbet/SingleLineRbiClassModuleDefinitions:
|
|
220
226
|
Sorbet/TypeAliasName:
|
221
227
|
Enabled: true
|
222
228
|
|
229
|
+
Sorbet/ValidGemVersionAnnotations:
|
230
|
+
Description: >-
|
231
|
+
Ensures all gem version annotations in RBI files are correctly formatted per
|
232
|
+
Ruby's gem version specification guidelines.
|
233
|
+
|
234
|
+
See the rubygems.org documentation for more information on how to format gem
|
235
|
+
versions: https://guides.rubygems.org/patterns/#pessimistic-version-constraint
|
236
|
+
Enabled: false
|
237
|
+
VersionAdded: 0.8.5
|
238
|
+
|
223
239
|
Sorbet/ValidSigil:
|
224
240
|
Enabled: true
|
225
241
|
RequireSigilOnAllFiles: true
|
@@ -44,7 +44,7 @@ module RuboCop
|
|
44
44
|
def read_sorbet_static_version_from_bundler_lock_file
|
45
45
|
require "bundler"
|
46
46
|
::Bundler.locked_gems.specs.find { |spec| spec.name == "sorbet-static" }&.version
|
47
|
-
rescue LoadError, Bundler::GemfileNotFound
|
47
|
+
rescue LoadError, ::Bundler::GemfileNotFound
|
48
48
|
nil
|
49
49
|
end
|
50
50
|
end
|
@@ -27,16 +27,10 @@ module RuboCop
|
|
27
27
|
paths = allowed_paths
|
28
28
|
|
29
29
|
if paths.nil?
|
30
|
-
|
31
|
-
source_range(processed_source.buffer, 1, 0),
|
32
|
-
message: "AllowedPaths expects an array",
|
33
|
-
)
|
30
|
+
add_global_offense("AllowedPaths expects an array")
|
34
31
|
return
|
35
32
|
elsif paths.empty?
|
36
|
-
|
37
|
-
source_range(processed_source.buffer, 1, 0),
|
38
|
-
message: "AllowedPaths cannot be empty",
|
39
|
-
)
|
33
|
+
add_global_offense("AllowedPaths cannot be empty")
|
40
34
|
return
|
41
35
|
end
|
42
36
|
|
@@ -44,9 +38,8 @@ module RuboCop
|
|
44
38
|
# We need to remove the exec path directory prefix before matching with the filename regular expressions.
|
45
39
|
rel_path = processed_source.file_path.sub("#{Dir.pwd}/", "")
|
46
40
|
|
47
|
-
|
48
|
-
|
49
|
-
message: "RBI file path should match one of: #{paths.join(", ")}",
|
41
|
+
add_global_offense(
|
42
|
+
"RBI file path should match one of: #{paths.join(", ")}",
|
50
43
|
) if paths.none? { |pattern| File.fnmatch(pattern, rel_path) }
|
51
44
|
end
|
52
45
|
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module RuboCop
|
4
|
+
module Cop
|
5
|
+
module Sorbet
|
6
|
+
module GemVersionAnnotationHelper
|
7
|
+
VERSION_PREFIX = "# @version"
|
8
|
+
|
9
|
+
def gem_version_annotations
|
10
|
+
processed_source.comments.select do |comment|
|
11
|
+
gem_version_annotation?(comment)
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
private
|
16
|
+
|
17
|
+
def gem_version_annotation?(comment)
|
18
|
+
comment.text.start_with?(VERSION_PREFIX)
|
19
|
+
end
|
20
|
+
|
21
|
+
def gem_versions(comment)
|
22
|
+
comment.text.delete_prefix(VERSION_PREFIX).split(/, ?/).map(&:strip)
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,62 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module RuboCop
|
4
|
+
module Cop
|
5
|
+
module Sorbet
|
6
|
+
# Checks that gem versions in RBI annotations are properly formatted per the Bundler gem specification.
|
7
|
+
#
|
8
|
+
# @example
|
9
|
+
# # bad
|
10
|
+
# # @version > not a version number
|
11
|
+
#
|
12
|
+
# # good
|
13
|
+
# # @version = 1
|
14
|
+
#
|
15
|
+
# # good
|
16
|
+
# # @version > 1.2.3
|
17
|
+
#
|
18
|
+
# # good
|
19
|
+
# # @version <= 4.3-preview
|
20
|
+
#
|
21
|
+
class ValidGemVersionAnnotations < RuboCop::Cop::Base
|
22
|
+
include GemVersionAnnotationHelper
|
23
|
+
|
24
|
+
MSG = "Invalid gem version(s) detected: %<versions>s"
|
25
|
+
VALID_OPERATORS = ["=", "!=", ">", ">=", "<", "<=", "~>"]
|
26
|
+
|
27
|
+
def on_new_investigation
|
28
|
+
gem_version_annotations.each do |comment|
|
29
|
+
gem_versions = gem_versions(comment)
|
30
|
+
|
31
|
+
if gem_versions.empty?
|
32
|
+
message = format(MSG, versions: "empty version")
|
33
|
+
add_offense(comment, message: message)
|
34
|
+
break
|
35
|
+
end
|
36
|
+
|
37
|
+
invalid_versions = gem_versions.reject do |version|
|
38
|
+
valid_version?(version)
|
39
|
+
end
|
40
|
+
|
41
|
+
unless invalid_versions.empty?
|
42
|
+
message = format(MSG, versions: invalid_versions.map(&:strip).join(", "))
|
43
|
+
add_offense(comment, message: message)
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
private
|
49
|
+
|
50
|
+
def valid_version?(version_string)
|
51
|
+
parts = version_string.strip.split(" ")
|
52
|
+
operator, version = parts
|
53
|
+
|
54
|
+
return false unless operator && parts
|
55
|
+
return false unless VALID_OPERATORS.include?(operator)
|
56
|
+
|
57
|
+
Gem::Version.correct?(version)
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
@@ -0,0 +1,52 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module RuboCop
|
4
|
+
module Cop
|
5
|
+
module Sorbet
|
6
|
+
# Checks for the use of Ruby Refinements library. Refinements add
|
7
|
+
# complexity and incur a performance penalty that can be significant
|
8
|
+
# for large code bases. Good examples are cases of unrelated
|
9
|
+
# methods that happen to have the same name as these module methods.
|
10
|
+
#
|
11
|
+
# @example
|
12
|
+
# # bad
|
13
|
+
# module Foo
|
14
|
+
# refine(Date) do
|
15
|
+
# end
|
16
|
+
# end
|
17
|
+
#
|
18
|
+
# # bad
|
19
|
+
# module Foo
|
20
|
+
# using(Date) do
|
21
|
+
# end
|
22
|
+
# end
|
23
|
+
#
|
24
|
+
# # good
|
25
|
+
# module Foo
|
26
|
+
# bar.refine(Date)
|
27
|
+
# end
|
28
|
+
#
|
29
|
+
# # good
|
30
|
+
# module Foo
|
31
|
+
# bar.using(Date)
|
32
|
+
# end
|
33
|
+
|
34
|
+
class Refinement < Base
|
35
|
+
MSG = "Do not use Ruby Refinements library as it is not supported by Sorbet."
|
36
|
+
RESTRICT_ON_SEND = [:refine, :using].freeze
|
37
|
+
|
38
|
+
def on_send(node)
|
39
|
+
return unless node.receiver.nil?
|
40
|
+
return unless node.first_argument&.const_type?
|
41
|
+
|
42
|
+
if node.method?(:refine)
|
43
|
+
return unless node.block_node
|
44
|
+
return unless node.parent.parent.module_type?
|
45
|
+
end
|
46
|
+
|
47
|
+
add_offense(node)
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
@@ -21,7 +21,7 @@ module RuboCop
|
|
21
21
|
# serialize <=> other.serialize
|
22
22
|
# end
|
23
23
|
# end
|
24
|
-
class ForbidComparableTEnum < Base
|
24
|
+
class ForbidComparableTEnum < RuboCop::Cop::Base
|
25
25
|
include TEnum
|
26
26
|
|
27
27
|
MSG = "Do not use `T::Enum` as a comparable object because of significant performance overhead."
|
@@ -16,6 +16,7 @@ require_relative "sorbet/forbid_t_struct"
|
|
16
16
|
require_relative "sorbet/forbid_t_unsafe"
|
17
17
|
require_relative "sorbet/forbid_t_untyped"
|
18
18
|
require_relative "sorbet/redundant_extend_t_sig"
|
19
|
+
require_relative "sorbet/refinement"
|
19
20
|
require_relative "sorbet/type_alias_name"
|
20
21
|
require_relative "sorbet/obsolete_strict_memoization"
|
21
22
|
require_relative "sorbet/buggy_obsolete_strict_memoization"
|
@@ -24,6 +25,9 @@ require_relative "sorbet/rbi/forbid_extend_t_sig_helpers_in_shims"
|
|
24
25
|
require_relative "sorbet/rbi/forbid_rbi_outside_of_allowed_paths"
|
25
26
|
require_relative "sorbet/rbi/single_line_rbi_class_module_definitions"
|
26
27
|
|
28
|
+
require_relative "sorbet/rbi_versioning/gem_version_annotation_helper"
|
29
|
+
require_relative "sorbet/rbi_versioning/valid_gem_version_annotations"
|
30
|
+
|
27
31
|
require_relative "sorbet/signatures/allow_incompatible_override"
|
28
32
|
require_relative "sorbet/signatures/checked_true_in_signature"
|
29
33
|
require_relative "sorbet/signatures/void_checked_tests"
|
@@ -11,6 +11,14 @@ module RuboCop
|
|
11
11
|
def defaults!
|
12
12
|
path = CONFIG_DEFAULT.to_s
|
13
13
|
hash = ConfigLoader.send(:load_yaml_configuration, path)
|
14
|
+
if Gem::Version.new(RuboCop::Version::STRING) >= Gem::Version.new("1.66")
|
15
|
+
# We use markdown for cop documentation. Unconditionally setting
|
16
|
+
# the base url will produce incorrect urls on older RuboCop versions,
|
17
|
+
# so we do that for fully supported version only here.
|
18
|
+
hash["Sorbet"] ||= {}
|
19
|
+
hash["Sorbet"]["DocumentationBaseURL"] = "https://github.com/Shopify/rubocop-sorbet/blob/main/manual"
|
20
|
+
hash["Sorbet"]["DocumentationExtension"] = ".md"
|
21
|
+
end
|
14
22
|
config = Config.new(hash, path).tap(&:make_excludes_absolute)
|
15
23
|
puts "configuration from #{path}" if ConfigLoader.debug?
|
16
24
|
config = ConfigLoader.merge_with_default(config, path)
|
data/manual/cops.md
CHANGED
@@ -33,12 +33,14 @@ In the following section you find all available cops:
|
|
33
33
|
* [Sorbet/MultipleTEnumValues](cops_sorbet.md#sorbetmultipletenumvalues)
|
34
34
|
* [Sorbet/ObsoleteStrictMemoization](cops_sorbet.md#sorbetobsoletestrictmemoization)
|
35
35
|
* [Sorbet/RedundantExtendTSig](cops_sorbet.md#sorbetredundantextendtsig)
|
36
|
+
* [Sorbet/Refinement](cops_sorbet.md#sorbetrefinement)
|
36
37
|
* [Sorbet/SignatureBuildOrder](cops_sorbet.md#sorbetsignaturebuildorder)
|
37
38
|
* [Sorbet/SingleLineRbiClassModuleDefinitions](cops_sorbet.md#sorbetsinglelinerbiclassmoduledefinitions)
|
38
39
|
* [Sorbet/StrictSigil](cops_sorbet.md#sorbetstrictsigil)
|
39
40
|
* [Sorbet/StrongSigil](cops_sorbet.md#sorbetstrongsigil)
|
40
41
|
* [Sorbet/TrueSigil](cops_sorbet.md#sorbettruesigil)
|
41
42
|
* [Sorbet/TypeAliasName](cops_sorbet.md#sorbettypealiasname)
|
43
|
+
* [Sorbet/ValidGemVersionAnnotations](cops_sorbet.md#sorbetvalidgemversionannotations)
|
42
44
|
* [Sorbet/ValidSigil](cops_sorbet.md#sorbetvalidsigil)
|
43
45
|
* [Sorbet/VoidCheckedTests](cops_sorbet.md#sorbetvoidcheckedtests)
|
44
46
|
|
data/manual/cops_sorbet.md
CHANGED
@@ -759,6 +759,43 @@ class Example
|
|
759
759
|
end
|
760
760
|
```
|
761
761
|
|
762
|
+
## Sorbet/Refinement
|
763
|
+
|
764
|
+
Enabled by default | Safe | Supports autocorrection | VersionAdded | VersionChanged
|
765
|
+
--- | --- | --- | --- | ---
|
766
|
+
Enabled | Yes | No | <<next>> | -
|
767
|
+
|
768
|
+
Checks for the use of Ruby Refinements library. Refinements add
|
769
|
+
complexity and incur a performance penalty that can be significant
|
770
|
+
for large code bases. Good examples are cases of unrelated
|
771
|
+
methods that happen to have the same name as these module methods.
|
772
|
+
|
773
|
+
### Examples
|
774
|
+
|
775
|
+
```ruby
|
776
|
+
# bad
|
777
|
+
module Foo
|
778
|
+
refine(Date) do
|
779
|
+
end
|
780
|
+
end
|
781
|
+
|
782
|
+
# bad
|
783
|
+
module Foo
|
784
|
+
using(Date) do
|
785
|
+
end
|
786
|
+
end
|
787
|
+
|
788
|
+
# good
|
789
|
+
module Foo
|
790
|
+
bar.refine(Date)
|
791
|
+
end
|
792
|
+
|
793
|
+
# good
|
794
|
+
module Foo
|
795
|
+
bar.using(Date)
|
796
|
+
end
|
797
|
+
```
|
798
|
+
|
762
799
|
## Sorbet/SignatureBuildOrder
|
763
800
|
|
764
801
|
Enabled by default | Safe | Supports autocorrection | VersionAdded | VersionChanged
|
@@ -892,6 +929,30 @@ Name | Default value | Configurable values
|
|
892
929
|
Include | `**/*.{rb,rbi,rake,ru}` | Array
|
893
930
|
Exclude | `bin/**/*`, `db/**/*.rb`, `script/**/*` | Array
|
894
931
|
|
932
|
+
## Sorbet/ValidGemVersionAnnotations
|
933
|
+
|
934
|
+
Enabled by default | Safe | Supports autocorrection | VersionAdded | VersionChanged
|
935
|
+
--- | --- | --- | --- | ---
|
936
|
+
Enabled | Yes | No | - | -
|
937
|
+
|
938
|
+
Checks that gem versions in RBI annotations are properly formatted per the Bundler gem specification.
|
939
|
+
|
940
|
+
### Examples
|
941
|
+
|
942
|
+
```ruby
|
943
|
+
# bad
|
944
|
+
# @version > not a version number
|
945
|
+
|
946
|
+
# good
|
947
|
+
# @version = 1
|
948
|
+
|
949
|
+
# good
|
950
|
+
# @version > 1.2.3
|
951
|
+
|
952
|
+
# good
|
953
|
+
# @version <= 4.3-preview
|
954
|
+
```
|
955
|
+
|
895
956
|
## Sorbet/ValidSigil
|
896
957
|
|
897
958
|
Enabled by default | Safe | Supports autocorrection | VersionAdded | VersionChanged
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rubocop-sorbet
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.8.
|
4
|
+
version: 0.8.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ufuk Kayserilioglu
|
@@ -11,7 +11,7 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: exe
|
13
13
|
cert_chain: []
|
14
|
-
date: 2024-
|
14
|
+
date: 2024-10-15 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: rubocop
|
@@ -39,6 +39,7 @@ files:
|
|
39
39
|
- ".github/release.yml"
|
40
40
|
- ".github/workflows/ci.yml"
|
41
41
|
- ".github/workflows/cla.yml"
|
42
|
+
- ".github/workflows/dependabot_automerge.yml"
|
42
43
|
- ".github/workflows/stale.yml"
|
43
44
|
- ".gitignore"
|
44
45
|
- ".rspec"
|
@@ -81,7 +82,10 @@ files:
|
|
81
82
|
- lib/rubocop/cop/sorbet/rbi/forbid_extend_t_sig_helpers_in_shims.rb
|
82
83
|
- lib/rubocop/cop/sorbet/rbi/forbid_rbi_outside_of_allowed_paths.rb
|
83
84
|
- lib/rubocop/cop/sorbet/rbi/single_line_rbi_class_module_definitions.rb
|
85
|
+
- lib/rubocop/cop/sorbet/rbi_versioning/gem_version_annotation_helper.rb
|
86
|
+
- lib/rubocop/cop/sorbet/rbi_versioning/valid_gem_version_annotations.rb
|
84
87
|
- lib/rubocop/cop/sorbet/redundant_extend_t_sig.rb
|
88
|
+
- lib/rubocop/cop/sorbet/refinement.rb
|
85
89
|
- lib/rubocop/cop/sorbet/sigils/enforce_sigil_order.rb
|
86
90
|
- lib/rubocop/cop/sorbet/sigils/enforce_single_sigil.rb
|
87
91
|
- lib/rubocop/cop/sorbet/sigils/false_sigil.rb
|
@@ -133,7 +137,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
133
137
|
- !ruby/object:Gem::Version
|
134
138
|
version: '0'
|
135
139
|
requirements: []
|
136
|
-
rubygems_version: 3.5.
|
140
|
+
rubygems_version: 3.5.21
|
137
141
|
signing_key:
|
138
142
|
specification_version: 4
|
139
143
|
summary: Automatic Sorbet code style checking tool.
|