Skip to content

Commit 559f365

Browse files
authored
Merge pull request #1338 from Shopify/dependabot/bundler/rubocop-shopify-2.11.1
Bump rubocop-shopify from 2.10.1 to 2.11.1
2 parents 8679175 + 3154846 commit 559f365

29 files changed

+2511
-1422
lines changed

Gemfile.lock

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -266,22 +266,22 @@ GEM
266266
reline (0.3.2)
267267
io-console (~> 0.5)
268268
rexml (3.2.5)
269-
rubocop (1.40.0)
269+
rubocop (1.42.0)
270270
json (~> 2.3)
271271
parallel (~> 1.10)
272272
parser (>= 3.1.2.1)
273273
rainbow (>= 2.2.2, < 4.0)
274274
regexp_parser (>= 1.8, < 3.0)
275275
rexml (>= 3.2.5, < 4.0)
276-
rubocop-ast (>= 1.23.0, < 2.0)
276+
rubocop-ast (>= 1.24.1, < 2.0)
277277
ruby-progressbar (~> 1.7)
278278
unicode-display_width (>= 1.4.0, < 3.0)
279-
rubocop-ast (1.24.0)
279+
rubocop-ast (1.24.1)
280280
parser (>= 3.1.1.0)
281281
rubocop-rspec (2.16.0)
282282
rubocop (~> 1.33)
283-
rubocop-shopify (2.10.1)
284-
rubocop (~> 1.35)
283+
rubocop-shopify (2.11.1)
284+
rubocop (~> 1.42)
285285
rubocop-sorbet (0.6.11)
286286
rubocop (>= 0.90.0)
287287
ruby-lsp (0.3.7)

lib/tapioca.rb

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,14 @@ class Error < StandardError; end
4343
DEFAULT_TODO_FILE = T.let("#{DEFAULT_RBI_DIR}/todo.rbi", String)
4444
DEFAULT_ANNOTATIONS_DIR = T.let("#{DEFAULT_RBI_DIR}/annotations", String)
4545

46-
DEFAULT_OVERRIDES = T.let({
47-
# ActiveSupport overrides some core methods with different signatures
48-
# so we generate a typed: false RBI for it to suppress errors
49-
"activesupport" => "false",
50-
}.freeze, T::Hash[String, String])
46+
DEFAULT_OVERRIDES = T.let(
47+
{
48+
# ActiveSupport overrides some core methods with different signatures
49+
# so we generate a typed: false RBI for it to suppress errors
50+
"activesupport" => "false",
51+
}.freeze,
52+
T::Hash[String, String],
53+
)
5154

5255
DEFAULT_RBI_MAX_LINE_LENGTH = 120
5356
DEFAULT_ENVIRONMENT = "development"

lib/tapioca/cli.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,9 @@ def check_shims
296296
end
297297

298298
desc "annotations", "Pull gem RBI annotations from remote sources"
299-
option :sources, type: :array, default: [CENTRAL_REPO_ROOT_URI],
299+
option :sources,
300+
type: :array,
301+
default: [CENTRAL_REPO_ROOT_URI],
300302
desc: "URIs of the sources to pull gem RBI annotations from"
301303
option :netrc, type: :boolean, default: true, desc: "Use .netrc to authenticate to private sources"
302304
option :netrc_file, type: :string, desc: "Path to .netrc file"

lib/tapioca/commands/gem.rb

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,9 +156,11 @@ def compile_gem_rbi(gem)
156156

157157
rbi = RBI::File.new(strictness: @typed_overrides[gem.name] || "true")
158158

159-
@rbi_formatter.write_header!(rbi,
159+
@rbi_formatter.write_header!(
160+
rbi,
160161
default_command(:gem, gem.name),
161-
reason: "types exported from the `#{gem.name}` gem") if @file_header
162+
reason: "types exported from the `#{gem.name}` gem",
163+
) if @file_header
162164

163165
rbi.root = Tapioca::Gem::Pipeline.new(gem, include_doc: @include_doc, include_loc: @include_loc).compile
164166

lib/tapioca/dsl/compilers/aasm.rb

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,17 @@ class AASM < Compiler
4444
# https://github.com/aasm/aasm/blob/0e03746/lib/aasm/core/event.rb#L21-L29
4545
EVENT_CALLBACKS =
4646
T.let(
47-
["after", "after_commit", "after_transaction", "before", "before_transaction", "ensure", "error",
48-
"before_success", "success",].freeze,
47+
[
48+
"after",
49+
"after_commit",
50+
"after_transaction",
51+
"before",
52+
"before_transaction",
53+
"ensure",
54+
"error",
55+
"before_success",
56+
"success",
57+
].freeze,
4958
T::Array[String],
5059
)
5160

lib/tapioca/dsl/compilers/active_record_fixtures.rb

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -72,11 +72,14 @@ def gather_constants
7272

7373
sig { returns(Class) }
7474
def fixture_loader
75-
@fixture_loader ||= T.let(Class.new do
76-
T.unsafe(self).include(ActiveRecord::TestFixtures)
77-
T.unsafe(self).fixture_path = Rails.root.join("test", "fixtures")
78-
T.unsafe(self).fixtures(:all)
79-
end, T.nilable(Class))
75+
@fixture_loader ||= T.let(
76+
Class.new do
77+
T.unsafe(self).include(ActiveRecord::TestFixtures)
78+
T.unsafe(self).fixture_path = Rails.root.join("test", "fixtures")
79+
T.unsafe(self).fixtures(:all)
80+
end,
81+
T.nilable(Class),
82+
)
8083
end
8184

8285
sig { returns(T::Array[String]) }

lib/tapioca/dsl/compilers/active_record_relations.rb

Lines changed: 19 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -196,22 +196,25 @@ def gather_constants
196196
T::Array[Symbol],
197197
)
198198

199-
QUERY_METHODS = T.let(begin
200-
# Grab all Query methods
201-
query_methods = ActiveRecord::QueryMethods.instance_methods(false)
202-
# Grab all Spawn methods
203-
query_methods |= ActiveRecord::SpawnMethods.instance_methods(false)
204-
# Remove the ones we know are private API
205-
query_methods -= [:arel, :build_subquery, :construct_join_dependency, :extensions, :spawn]
206-
# Remove "where" which needs a custom return type for WhereChains
207-
query_methods -= [:where]
208-
# Remove the methods that ...
209-
query_methods
210-
.grep_v(/_clause$/) # end with "_clause"
211-
.grep_v(/_values?$/) # end with "_value" or "_values"
212-
.grep_v(/=$/) # end with "=""
213-
.grep_v(/(?<!uniq)!$/) # end with "!" except for "uniq!"
214-
end, T::Array[Symbol])
199+
QUERY_METHODS = T.let(
200+
begin
201+
# Grab all Query methods
202+
query_methods = ActiveRecord::QueryMethods.instance_methods(false)
203+
# Grab all Spawn methods
204+
query_methods |= ActiveRecord::SpawnMethods.instance_methods(false)
205+
# Remove the ones we know are private API
206+
query_methods -= [:arel, :build_subquery, :construct_join_dependency, :extensions, :spawn]
207+
# Remove "where" which needs a custom return type for WhereChains
208+
query_methods -= [:where]
209+
# Remove the methods that ...
210+
query_methods
211+
.grep_v(/_clause$/) # end with "_clause"
212+
.grep_v(/_values?$/) # end with "_value" or "_values"
213+
.grep_v(/=$/) # end with "=""
214+
.grep_v(/(?<!uniq)!$/) # end with "!" except for "uniq!"
215+
end,
216+
T::Array[Symbol],
217+
)
215218
WHERE_CHAIN_QUERY_METHODS = T.let(
216219
ActiveRecord::QueryMethods::WhereChain.instance_methods(false),
217220
T::Array[Symbol],

lib/tapioca/dsl/compilers/active_record_typed_store.rb

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -126,17 +126,20 @@ def gather_constants
126126

127127
private
128128

129-
TYPES = T.let({
130-
boolean: "T::Boolean",
131-
integer: "Integer",
132-
string: "String",
133-
float: "Float",
134-
date: "Date",
135-
time: "Time",
136-
datetime: "DateTime",
137-
decimal: "BigDecimal",
138-
any: "T.untyped",
139-
}.freeze, T::Hash[Symbol, String])
129+
TYPES = T.let(
130+
{
131+
boolean: "T::Boolean",
132+
integer: "Integer",
133+
string: "String",
134+
float: "Float",
135+
date: "Date",
136+
time: "Time",
137+
datetime: "DateTime",
138+
decimal: "BigDecimal",
139+
any: "T.untyped",
140+
}.freeze,
141+
T::Hash[Symbol, String],
142+
)
140143

141144
sig { params(attr_type: Symbol).returns(String) }
142145
def type_for(attr_type)

lib/tapioca/dsl/compilers/active_resource.rb

Lines changed: 22 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -85,18 +85,21 @@ def gather_constants
8585

8686
private
8787

88-
TYPES = T.let({
89-
boolean: "T::Boolean",
90-
integer: "Integer",
91-
string: "String",
92-
float: "Float",
93-
date: "Date",
94-
time: "Time",
95-
datetime: "DateTime",
96-
decimal: "BigDecimal",
97-
binary: "String",
98-
text: "String",
99-
}.freeze, T::Hash[Symbol, String])
88+
TYPES = T.let(
89+
{
90+
boolean: "T::Boolean",
91+
integer: "Integer",
92+
string: "String",
93+
float: "Float",
94+
date: "Date",
95+
time: "Time",
96+
datetime: "DateTime",
97+
decimal: "BigDecimal",
98+
binary: "String",
99+
text: "String",
100+
}.freeze,
101+
T::Hash[Symbol, String],
102+
)
100103

101104
sig { params(attr_type: Symbol).returns(String) }
102105
def type_for(attr_type)
@@ -109,9 +112,13 @@ def create_schema_methods(klass, attribute, type)
109112

110113
klass.create_method(attribute, return_type: return_type)
111114
klass.create_method("#{attribute}?", return_type: "T::Boolean")
112-
klass.create_method("#{attribute}=", parameters: [
113-
create_param("value", type: return_type),
114-
], return_type: return_type)
115+
klass.create_method(
116+
"#{attribute}=",
117+
parameters: [
118+
create_param("value", type: return_type),
119+
],
120+
return_type: return_type,
121+
)
115122
end
116123
end
117124
end

lib/tapioca/dsl/compilers/active_storage.rb

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,10 @@ class ActiveStorage < Compiler
4848

4949
ConstantType = type_member do
5050
{
51-
fixed: T.all(Module,
52-
::ActiveStorage::Reflection::ActiveRecordExtensions::ClassMethods),
51+
fixed: T.all(
52+
Module,
53+
::ActiveStorage::Reflection::ActiveRecordExtensions::ClassMethods,
54+
),
5355
}
5456
end
5557

0 commit comments

Comments
 (0)