Code review fixes

This commit is contained in:
Douglas Eichelberger 2024-02-10 11:03:50 -08:00
parent 1b84c5c8c2
commit aab04229d1
4 changed files with 17 additions and 16 deletions

View File

@ -60,10 +60,10 @@ module SharedEnvExtension
end
private :reset
sig { returns(T::Hash[String, String]) }
sig { returns(T::Hash[String, T.nilable(String)]) }
def remove_cc_etc
keys = %w[CC CXX OBJC OBJCXX LD CPP CFLAGS CXXFLAGS OBJCFLAGS OBJCXXFLAGS LDFLAGS CPPFLAGS]
keys.to_h { |key| [key, T.must(delete(key))] }
keys.to_h { |key| [key, delete(key)] }
end
sig { params(newflags: String).void }

View File

@ -1,11 +1,8 @@
# typed: strict
class RuboCop::AST::Node
sig { returns(T::Boolean) }
def arch_variable?; end
sig { returns(T::Boolean) }
def begin_block?; end
sig { returns(T.nilable(RuboCop::AST::SendNode)) }
def method_node; end
sig { returns(T.nilable(RuboCop::AST::Node)) }
def block_body; end
@ -13,9 +10,12 @@ class RuboCop::AST::Node
sig { returns(T::Boolean) }
def cask_block?; end
sig { returns(T.nilable(RuboCop::AST::Node)) }
def method_node; end
sig { returns(T::Boolean) }
def on_system_block?; end
sig { returns(T::Boolean) }
def arch_variable?; end
sig { returns(T::Boolean) }
def begin_block?; end
end

View File

@ -41602,7 +41602,7 @@ class RuboCop::Cop::Style::MutableConstant < ::RuboCop::Cop::Base
include ::RuboCop::Cop::ConfigurableEnforcedStyle
extend ::RuboCop::Cop::AutoCorrector
# source://rubocop-sorbet/0.7.6/lib/rubocop/cop/sorbet/mutable_constant_sorbet_aware_behaviour.rb#18
# source://rubocop-sorbet/0.7.7/lib/rubocop/cop/sorbet/mutable_constant_sorbet_aware_behaviour.rb#18
def on_assignment(value); end
# source://rubocop//lib/rubocop/cop/style/mutable_constant.rb#127
@ -41620,7 +41620,7 @@ class RuboCop::Cop::Style::MutableConstant < ::RuboCop::Cop::Base
# source://rubocop//lib/rubocop/cop/style/mutable_constant.rb#217
def splat_value(param0 = T.unsafe(nil)); end
# source://rubocop-sorbet/0.7.6/lib/rubocop/cop/sorbet/mutable_constant_sorbet_aware_behaviour.rb#12
# source://rubocop-sorbet/0.7.7/lib/rubocop/cop/sorbet/mutable_constant_sorbet_aware_behaviour.rb#12
def t_let(param0 = T.unsafe(nil)); end
private

View File

@ -24,9 +24,9 @@ module Tapioca
# exclude vendored code, to avoid contradicting their RBI files
!path.include?("/vendor/bundle/ruby/") &&
# exclude source code that already has an RBI file
!Pathname("#{path}i").exist? &&
!File.exist?("#{path}i") &&
# exclude source code that doesn't use the DSLs
File.readlines(path).grep(/def_node_/).any?
File.readlines(path).any?(/def_node_/)
end
end
@ -40,7 +40,8 @@ module Tapioca
# https://github.com/rubocop/rubocop-ast/blob/master/lib/rubocop/ast/node_pattern.rb
# https://github.com/rubocop/rubocop-ast/blob/master/lib/rubocop/ast/node_pattern/method_definer.rb
# The type signatures below could maybe be stronger, but I only wanted to avoid errors:
if source.start_with?("def_node_matcher")
case source
when /\Adef_node_matcher/
# https://github.com/Shopify/tapioca/blob/3341a9b/lib/tapioca/rbi_ext/model.rb#L89
klass.create_method(
method_name.to_s,
@ -51,7 +52,7 @@ module Tapioca
],
return_type: "T.untyped",
)
elsif source.start_with?("def_node_search")
when /\Adef_node_search/
klass.create_method(
method_name.to_s,
parameters: [