diff --git a/Gemfile.lock b/Gemfile.lock index 2c65e5c..fdfd82f 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -50,6 +50,8 @@ GEM smart_properties bigdecimal (4.1.2) builder (3.3.0) + code_teams (1.3.0) + sorbet-runtime coderay (1.1.3) concurrent-ruby (1.3.6) connection_pool (3.0.2) @@ -67,7 +69,7 @@ GEM prism (>= 1.3.0) rdoc (>= 4.0.0) reline (>= 0.4.2) - json (2.19.7) + json (2.20.0) language_server-protocol (3.17.0.5) lint_roller (1.1.0) logger (1.7.0) @@ -140,10 +142,10 @@ GEM zeitwerk (~> 2.6) rainbow (3.1.1) rake (13.4.2) - rbi (0.3.12) + rbi (0.3.14) prism (~> 1.0) rbs (>= 4.0.1) - rbs (4.1.0.pre.1) + rbs (4.1.0.pre.2) logger prism (>= 1.6.0) tsort @@ -156,7 +158,7 @@ GEM io-console (~> 0.5) require-hooks (0.4.0) rexml (3.4.4) - rubocop (1.87.0) + rubocop (1.88.1) json (~> 2.3) language_server-protocol (~> 3.17.0.2) lint_roller (~> 1.1.0) @@ -170,13 +172,15 @@ GEM rubocop-ast (1.49.1) parser (>= 3.3.7.2) prism (~> 1.7) - rubocop-gusto (10.10.0) + rubocop-gusto (11.3.0) + code_teams lint_roller rubocop (>= 1.76) rubocop-performance rubocop-rake rubocop-rspec rubocop-sorbet + smart_todo thor rubocop-performance (1.26.1) lint_roller (~> 1.1) @@ -185,37 +189,40 @@ GEM rubocop-rake (0.7.1) lint_roller (~> 1.1) rubocop (>= 1.72.1) - rubocop-rspec (3.9.0) + rubocop-rspec (3.10.2) lint_roller (~> 1.1) - rubocop (~> 1.81) + regexp_parser (>= 2.0) + rubocop (~> 1.86, >= 1.86.2) rubocop-sorbet (0.12.0) lint_roller rubocop (>= 1.75.2) ruby-progressbar (1.13.0) ruby2_keywords (0.0.5) - rubydex (0.2.5-arm64-darwin) - rubydex (0.2.5-x86_64-darwin) - rubydex (0.2.5-x86_64-linux) + rubydex (0.2.7-arm64-darwin) + rubydex (0.2.7-x86_64-darwin) + rubydex (0.2.7-x86_64-linux) securerandom (0.4.1) smart_properties (1.17.0) - sorbet (0.6.13270) - sorbet-static (= 0.6.13270) - sorbet-runtime (0.6.13270) - sorbet-static (0.6.13270-universal-darwin) - sorbet-static (0.6.13270-x86_64-linux) - sorbet-static-and-runtime (0.6.13270) - sorbet (= 0.6.13270) - sorbet-runtime (= 0.6.13270) - spoom (1.7.16) + smart_todo (1.11.0) + prism (~> 1.0) + sorbet (0.6.13321) + sorbet-static (= 0.6.13321) + sorbet-runtime (0.6.13321) + sorbet-static (0.6.13321-universal-darwin) + sorbet-static (0.6.13321-x86_64-linux) + sorbet-static-and-runtime (0.6.13321) + sorbet (= 0.6.13321) + sorbet-runtime (= 0.6.13321) + spoom (1.8.2) erubi (>= 1.10.0) prism (>= 0.28.0) - rbi (>= 0.3.3) + rbi (>= 0.3.14) rbs (>= 4.0.0.dev.5) rexml (>= 3.2.6) sorbet-static-and-runtime (>= 0.5.10187) thor (>= 0.19.2) stringio (3.2.0) - tapioca (0.19.1) + tapioca (0.19.2) benchmark bundler (>= 2.2.25) netrc (>= 0.11.0) @@ -224,7 +231,7 @@ GEM require-hooks (>= 0.2.2) rubydex (>= 0.1.0.beta10) sorbet-static-and-runtime (>= 0.6.12698) - spoom (>= 1.7.9) + spoom (>= 1.7.16) thor (>= 1.2.0) tsort thor (1.5.0) diff --git a/sorbet/rbi/gems/code_teams@1.3.0.rbi b/sorbet/rbi/gems/code_teams@1.3.0.rbi new file mode 100644 index 0000000..d24179a --- /dev/null +++ b/sorbet/rbi/gems/code_teams@1.3.0.rbi @@ -0,0 +1,235 @@ +# typed: true + +# DO NOT EDIT MANUALLY +# This is an autogenerated file for types exported from the `code_teams` gem. +# Please instead update this file by running `bin/tapioca gem code_teams`. + + +# pkg:gem/code_teams#lib/code_teams/plugin.rb:3 +module CodeTeams + class << self + # pkg:gem/code_teams#lib/code_teams.rb:22 + sig { returns(T::Array[::CodeTeams::Team]) } + def all; end + + # Generally, you should not ever need to do this, because once your ruby process loads, cached content should not change. + # Namely, the YML files that are the source of truth for teams should not change, so we should not need to look at the YMLs again to verify. + # The primary reason this is helpful is for clients of CodeTeams who want to test their code, and each test context has different set of teams + # + # pkg:gem/code_teams#lib/code_teams.rb:67 + sig { void } + def bust_caches!; end + + # pkg:gem/code_teams#lib/code_teams.rb:27 + sig { params(name: ::String).returns(T.nilable(::CodeTeams::Team)) } + def find(name); end + + # pkg:gem/code_teams#lib/code_teams.rb:33 + sig { params(name: ::String).returns(::CodeTeams::Team) } + def find!(name); end + + # pkg:gem/code_teams#lib/code_teams.rb:38 + sig { params(dir: ::String).returns(T::Array[::CodeTeams::Team]) } + def for_directory(dir); end + + # pkg:gem/code_teams#lib/code_teams.rb:59 + sig { params(string: ::String).returns(::String) } + def tag_value_for(string); end + + # pkg:gem/code_teams#lib/code_teams.rb:52 + sig { params(teams: T::Array[::CodeTeams::Team]).returns(T::Array[::String]) } + def validation_errors(teams); end + end +end + +# pkg:gem/code_teams#lib/code_teams.rb:15 +class CodeTeams::IncorrectPublicApiUsageError < ::StandardError; end + +# Plugins allow a client to add validation on custom keys in the team YML. +# For now, only a single plugin is allowed to manage validation on a top-level key. +# In the future we can think of allowing plugins to be gracefully merged with each other. +# +# pkg:gem/code_teams#lib/code_teams/plugin.rb:7 +class CodeTeams::Plugin + abstract! + + # pkg:gem/code_teams#lib/code_teams/plugin.rb:16 + sig { params(team: ::CodeTeams::Team).void } + def initialize(team); end + + class << self + # pkg:gem/code_teams#lib/code_teams/plugin.rb:37 + sig { returns(T::Array[T.class_of(CodeTeams::Plugin)]) } + def all_plugins; end + + # pkg:gem/code_teams#lib/code_teams/plugin.rb:78 + sig { void } + def bust_caches!; end + + # pkg:gem/code_teams#lib/code_teams/plugin.rb:83 + sig { void } + def clear_team_registry!; end + + # pkg:gem/code_teams#lib/code_teams/plugin.rb:21 + sig { params(key: ::String).returns(::String) } + def data_accessor_name(key = T.unsafe(nil)); end + + # pkg:gem/code_teams#lib/code_teams/plugin.rb:26 + sig { returns(::String) } + def default_data_accessor_name; end + + # pkg:gem/code_teams#lib/code_teams/plugin.rb:49 + sig { params(team: ::CodeTeams::Team).returns(T.attached_class) } + def for(team); end + + # pkg:gem/code_teams#lib/code_teams/plugin.rb:32 + sig { params(base: T.class_of(CodeTeams::Plugin)).void } + def inherited(base); end + + # pkg:gem/code_teams#lib/code_teams/plugin.rb:54 + sig { params(team: ::CodeTeams::Team, key: ::String).returns(::String) } + def missing_key_error_message(team, key); end + + # pkg:gem/code_teams#lib/code_teams/plugin.rb:44 + sig { params(teams: T::Array[::CodeTeams::Team]).returns(T::Array[::String]) } + def validation_errors(teams); end + + private + + # pkg:gem/code_teams#lib/code_teams/plugin.rb:66 + sig { params(team: ::CodeTeams::Team).returns(T.attached_class) } + def register_team(team); end + + # pkg:gem/code_teams#lib/code_teams/plugin.rb:59 + sig { returns(T::Hash[T.nilable(::String), T::Hash[T.class_of(CodeTeams::Plugin), ::CodeTeams::Plugin]]) } + def registry; end + end +end + +# pkg:gem/code_teams#lib/code_teams/plugins/identity.rb:4 +module CodeTeams::Plugins; end + +# pkg:gem/code_teams#lib/code_teams/plugins/identity.rb:5 +class CodeTeams::Plugins::Identity < ::CodeTeams::Plugin + # pkg:gem/code_teams#lib/code_teams/plugins/identity.rb:12 + sig { returns(::CodeTeams::Plugins::Identity::IdentityStruct) } + def identity; end + + class << self + # pkg:gem/code_teams#lib/code_teams/plugins/identity.rb:19 + sig { override.params(teams: T::Array[::CodeTeams::Team]).returns(T::Array[::String]) } + def validation_errors(teams); end + end +end + +# pkg:gem/code_teams#lib/code_teams/plugins/identity.rb:9 +class CodeTeams::Plugins::Identity::IdentityStruct < ::Struct + # pkg:gem/code_teams#lib/code_teams/plugins/identity.rb:9 + def name; end + + # pkg:gem/code_teams#lib/code_teams/plugins/identity.rb:9 + def name=(_); end + + class << self + # pkg:gem/code_teams#lib/code_teams/plugins/identity.rb:9 + def [](*_arg0); end + + # pkg:gem/code_teams#lib/code_teams/plugins/identity.rb:9 + def inspect; end + + # pkg:gem/code_teams#lib/code_teams/plugins/identity.rb:9 + def keyword_init?; end + + # pkg:gem/code_teams#lib/code_teams/plugins/identity.rb:9 + def members; end + + # pkg:gem/code_teams#lib/code_teams/plugins/identity.rb:9 + def new(*_arg0); end + end +end + +# pkg:gem/code_teams#lib/code_teams.rb:74 +class CodeTeams::Team + # pkg:gem/code_teams#lib/code_teams.rb:118 + sig { params(config_yml: T.nilable(::String), raw_hash: T::Hash[::String, T.untyped]).void } + def initialize(config_yml:, raw_hash:); end + + # pkg:gem/code_teams#lib/code_teams.rb:134 + sig { params(other: ::Object).returns(T::Boolean) } + def ==(other); end + + # pkg:gem/code_teams#lib/code_teams.rb:110 + sig { returns(T.nilable(::String)) } + def config_yml; end + + # pkg:gem/code_teams#lib/code_teams.rb:142 + def eql?(*args, **_arg1, &blk); end + + # pkg:gem/code_teams#lib/code_teams.rb:145 + sig { returns(::Integer) } + def hash; end + + # pkg:gem/code_teams#lib/code_teams.rb:124 + sig { returns(::String) } + def name; end + + # pkg:gem/code_teams#lib/code_teams.rb:107 + sig { returns(T::Hash[::String, T.untyped]) } + def raw_hash; end + + # pkg:gem/code_teams#lib/code_teams.rb:129 + sig { returns(::String) } + def to_tag; end + + class << self + # pkg:gem/code_teams#lib/code_teams.rb:88 + sig { params(raw_hash: T::Hash[::String, T.untyped]).returns(::CodeTeams::Team) } + def from_hash(raw_hash); end + + # pkg:gem/code_teams#lib/code_teams.rb:78 + sig { params(config_yml: ::String).returns(::CodeTeams::Team) } + def from_yml(config_yml); end + + # pkg:gem/code_teams#lib/code_teams.rb:96 + sig { void } + def register_plugins; end + end +end + +# pkg:gem/code_teams#lib/code_teams.rb:16 +class CodeTeams::TeamNotFoundError < ::StandardError; end + +# pkg:gem/code_teams#lib/code_teams.rb:18 +CodeTeams::UNKNOWN_TEAM_STRING = T.let(T.unsafe(nil), String) + +# pkg:gem/code_teams#lib/code_teams/utils.rb:6 +module CodeTeams::Utils + private + + # Recursively converts symbol keys to strings. Top-level input should be a Hash. + # + # pkg:gem/code_teams#lib/code_teams/utils.rb:27 + sig { params(value: T.untyped).returns(T.untyped) } + def deep_stringify_keys(value); end + + # pkg:gem/code_teams#lib/code_teams/utils.rb:21 + sig { params(string: ::String).returns(::String) } + def demodulize(string); end + + # pkg:gem/code_teams#lib/code_teams/utils.rb:12 + sig { params(string: ::String).returns(::String) } + def underscore(string); end + + class << self + # Recursively converts symbol keys to strings. Top-level input should be a Hash. + # + # pkg:gem/code_teams#lib/code_teams/utils.rb:27 + def deep_stringify_keys(value); end + + # pkg:gem/code_teams#lib/code_teams/utils.rb:21 + def demodulize(string); end + + # pkg:gem/code_teams#lib/code_teams/utils.rb:12 + def underscore(string); end + end +end diff --git a/sorbet/rbi/gems/rbi@0.3.12.rbi b/sorbet/rbi/gems/rbi@0.3.14.rbi similarity index 98% rename from sorbet/rbi/gems/rbi@0.3.12.rbi rename to sorbet/rbi/gems/rbi@0.3.14.rbi index fb4e614..dd7d020 100644 --- a/sorbet/rbi/gems/rbi@0.3.12.rbi +++ b/sorbet/rbi/gems/rbi@0.3.14.rbi @@ -2094,25 +2094,25 @@ class RBI::RBS::MethodTypeTranslator sig { returns(::RBI::Sig) } def result; end - # pkg:gem/rbi#lib/rbi/rbs/method_type_translator.rb:28 + # pkg:gem/rbi#lib/rbi/rbs/method_type_translator.rb:29 sig { params(type: ::RBS::MethodType).void } def visit(type); end private - # pkg:gem/rbi#lib/rbi/rbs/method_type_translator.rb:100 + # pkg:gem/rbi#lib/rbi/rbs/method_type_translator.rb:101 sig { params(param: ::RBS::Types::Function::Param, index: ::Integer).returns(::RBI::SigParam) } def translate_function_param(param, index); end - # pkg:gem/rbi#lib/rbi/rbs/method_type_translator.rb:115 + # pkg:gem/rbi#lib/rbi/rbs/method_type_translator.rb:116 sig { params(type: T.untyped).returns(::RBI::Type) } def translate_type(type); end - # pkg:gem/rbi#lib/rbi/rbs/method_type_translator.rb:42 + # pkg:gem/rbi#lib/rbi/rbs/method_type_translator.rb:43 sig { params(type: ::RBS::Types::Block).void } def visit_block_type(type); end - # pkg:gem/rbi#lib/rbi/rbs/method_type_translator.rb:57 + # pkg:gem/rbi#lib/rbi/rbs/method_type_translator.rb:58 sig { params(type: ::RBS::Types::Function).void } def visit_function_type(type); end @@ -2128,6 +2128,32 @@ class RBI::RBS::MethodTypeTranslator::Error < ::RBI::Error; end # pkg:gem/rbi#lib/rbi/rbs/type_translator.rb:6 class RBI::RBS::TypeTranslator + # pkg:gem/rbi#lib/rbi/rbs/type_translator.rb:39 + sig do + params( + type: T.any(::RBS::Types::Alias, ::RBS::Types::Bases::Any, ::RBS::Types::Bases::Bool, ::RBS::Types::Bases::Bottom, ::RBS::Types::Bases::Class, ::RBS::Types::Bases::Instance, ::RBS::Types::Bases::Nil, ::RBS::Types::Bases::Self, ::RBS::Types::Bases::Top, ::RBS::Types::Bases::Void, ::RBS::Types::ClassInstance, ::RBS::Types::ClassSingleton, ::RBS::Types::Function, ::RBS::Types::Interface, ::RBS::Types::Intersection, ::RBS::Types::Literal, ::RBS::Types::Optional, ::RBS::Types::Proc, ::RBS::Types::Record, ::RBS::Types::Tuple, ::RBS::Types::Union, ::RBS::Types::UntypedFunction, ::RBS::Types::Variable) + ).returns(::RBI::Type) + end + def translate(type); end + + private + + # pkg:gem/rbi#lib/rbi/rbs/type_translator.rb:123 + sig { params(type: ::RBS::Types::ClassInstance).returns(::RBI::Type) } + def translate_class_instance(type); end + + # pkg:gem/rbi#lib/rbi/rbs/type_translator.rb:131 + sig { params(type: ::RBS::Types::Function).returns(::RBI::Type) } + def translate_function(type); end + + # pkg:gem/rbi#lib/rbi/rbs/type_translator.rb:178 + sig { params(type_name: ::String).returns(::String) } + def translate_t_generic_type(type_name); end + + # pkg:gem/rbi#lib/rbi/rbs/type_translator.rb:111 + sig { params(type: ::RBS::Types::Alias).returns(::RBI::Type) } + def translate_type_alias(type); end + class << self # pkg:gem/rbi#lib/rbi/rbs/type_translator.rb:33 sig do @@ -2136,27 +2162,11 @@ class RBI::RBS::TypeTranslator ).returns(::RBI::Type) end def translate(type); end - - private - - # pkg:gem/rbi#lib/rbi/rbs/type_translator.rb:117 - sig { params(type: ::RBS::Types::ClassInstance).returns(::RBI::Type) } - def translate_class_instance(type); end - - # pkg:gem/rbi#lib/rbi/rbs/type_translator.rb:125 - sig { params(type: ::RBS::Types::Function).returns(::RBI::Type) } - def translate_function(type); end - - # pkg:gem/rbi#lib/rbi/rbs/type_translator.rb:172 - sig { params(type_name: ::String).returns(::String) } - def translate_t_generic_type(type_name); end - - # pkg:gem/rbi#lib/rbi/rbs/type_translator.rb:105 - sig { params(type: ::RBS::Types::Alias).returns(::RBI::Type) } - def translate_type_alias(type); end end end +RBI::RBS::TypeTranslator::RbsType = T.type_alias { T.any(::RBS::Types::Alias, ::RBS::Types::Bases::Any, ::RBS::Types::Bases::Bool, ::RBS::Types::Bases::Bottom, ::RBS::Types::Bases::Class, ::RBS::Types::Bases::Instance, ::RBS::Types::Bases::Nil, ::RBS::Types::Bases::Self, ::RBS::Types::Bases::Top, ::RBS::Types::Bases::Void, ::RBS::Types::ClassInstance, ::RBS::Types::ClassSingleton, ::RBS::Types::Function, ::RBS::Types::Interface, ::RBS::Types::Intersection, ::RBS::Types::Literal, ::RBS::Types::Optional, ::RBS::Types::Proc, ::RBS::Types::Record, ::RBS::Types::Tuple, ::RBS::Types::Union, ::RBS::Types::UntypedFunction, ::RBS::Types::Variable) } + # A comment representing a RBS type prefixed with `#:` # # pkg:gem/rbi#lib/rbi/model.rb:78 @@ -3292,23 +3302,27 @@ end # # pkg:gem/rbi#lib/rbi/rewriters/translate_rbs_sigs.rb:7 class RBI::Rewriters::TranslateRBSSigs < ::RBI::Visitor + # pkg:gem/rbi#lib/rbi/rewriters/translate_rbs_sigs.rb:11 + sig { void } + def initialize; end + # @override # - # pkg:gem/rbi#lib/rbi/rewriters/translate_rbs_sigs.rb:12 + # pkg:gem/rbi#lib/rbi/rewriters/translate_rbs_sigs.rb:18 sig { override.params(node: T.nilable(::RBI::Node)).void } def visit(node); end private - # pkg:gem/rbi#lib/rbi/rewriters/translate_rbs_sigs.rb:34 + # pkg:gem/rbi#lib/rbi/rewriters/translate_rbs_sigs.rb:40 sig { params(node: T.any(::RBI::Attr, ::RBI::Method)).returns(T::Array[::RBI::RBSComment]) } def extract_rbs_comments(node); end - # pkg:gem/rbi#lib/rbi/rewriters/translate_rbs_sigs.rb:61 + # pkg:gem/rbi#lib/rbi/rewriters/translate_rbs_sigs.rb:67 sig { params(node: ::RBI::Attr, comment: ::RBI::RBSComment).returns(::RBI::Sig) } def translate_rbs_attr_type(node, comment); end - # pkg:gem/rbi#lib/rbi/rewriters/translate_rbs_sigs.rb:53 + # pkg:gem/rbi#lib/rbi/rewriters/translate_rbs_sigs.rb:59 sig { params(node: ::RBI::Method, comment: ::RBI::RBSComment).returns(::RBI::Sig) } def translate_rbs_method_type(node, comment); end end @@ -3962,7 +3976,7 @@ class RBI::Tree < ::RBI::NodeWithComments sig { void } def sort_nodes!; end - # pkg:gem/rbi#lib/rbi/rewriters/translate_rbs_sigs.rb:82 + # pkg:gem/rbi#lib/rbi/rewriters/translate_rbs_sigs.rb:88 sig { void } def translate_rbs_sigs!; end end diff --git a/sorbet/rbi/gems/rbs@4.1.0.pre.1.rbi b/sorbet/rbi/gems/rbs@4.1.0.pre.2.rbi similarity index 94% rename from sorbet/rbi/gems/rbs@4.1.0.pre.1.rbi rename to sorbet/rbi/gems/rbs@4.1.0.pre.2.rbi index f7c2416..09d136d 100644 --- a/sorbet/rbi/gems/rbs@4.1.0.pre.1.rbi +++ b/sorbet/rbi/gems/rbs@4.1.0.pre.2.rbi @@ -5,25 +5,29 @@ # Please instead update this file by running `bin/tapioca gem rbs`. +# This file is generated by the templates/template.rb script and should not be +# modified manually. To change the template see +# templates/lib/rbs/wasm/serialization_schema.rb.erb +# # pkg:gem/rbs#lib/rbs/version.rb:3 module RBS class << self - # pkg:gem/rbs#lib/rbs.rb:81 + # pkg:gem/rbs#lib/rbs.rb:92 def logger; end - # pkg:gem/rbs#lib/rbs.rb:78 + # pkg:gem/rbs#lib/rbs.rb:89 def logger_level; end - # pkg:gem/rbs#lib/rbs.rb:90 + # pkg:gem/rbs#lib/rbs.rb:101 def logger_level=(level); end - # pkg:gem/rbs#lib/rbs.rb:79 + # pkg:gem/rbs#lib/rbs.rb:90 def logger_output; end - # pkg:gem/rbs#lib/rbs.rb:85 + # pkg:gem/rbs#lib/rbs.rb:96 def logger_output=(val); end - # pkg:gem/rbs#lib/rbs.rb:95 + # pkg:gem/rbs#lib/rbs.rb:106 def print_warning; end end end @@ -1182,34 +1186,34 @@ class RBS::AST::Ruby::CommentBlock # pkg:gem/rbs#lib/rbs/ast/ruby/comment_block.rb:9 def initialize(source_buffer, comments); end - # pkg:gem/rbs#lib/rbs/ast/ruby/comment_block.rb:226 + # pkg:gem/rbs#lib/rbs/ast/ruby/comment_block.rb:228 def as_comment; end # pkg:gem/rbs#lib/rbs/ast/ruby/comment_block.rb:7 def comment_buffer; end - # pkg:gem/rbs#lib/rbs/ast/ruby/comment_block.rb:211 + # pkg:gem/rbs#lib/rbs/ast/ruby/comment_block.rb:213 def comments; end - # pkg:gem/rbs#lib/rbs/ast/ruby/comment_block.rb:98 + # pkg:gem/rbs#lib/rbs/ast/ruby/comment_block.rb:100 def each_paragraph(variables, &block); end - # pkg:gem/rbs#lib/rbs/ast/ruby/comment_block.rb:50 + # pkg:gem/rbs#lib/rbs/ast/ruby/comment_block.rb:52 def end_line; end - # pkg:gem/rbs#lib/rbs/ast/ruby/comment_block.rb:36 + # pkg:gem/rbs#lib/rbs/ast/ruby/comment_block.rb:38 def leading?; end - # pkg:gem/rbs#lib/rbs/ast/ruby/comment_block.rb:215 + # pkg:gem/rbs#lib/rbs/ast/ruby/comment_block.rb:217 def leading_annotation?(index); end - # pkg:gem/rbs#lib/rbs/ast/ruby/comment_block.rb:174 + # pkg:gem/rbs#lib/rbs/ast/ruby/comment_block.rb:176 def line_location(start_line, end_line); end - # pkg:gem/rbs#lib/rbs/ast/ruby/comment_block.rb:54 + # pkg:gem/rbs#lib/rbs/ast/ruby/comment_block.rb:56 def line_starts; end - # pkg:gem/rbs#lib/rbs/ast/ruby/comment_block.rb:180 + # pkg:gem/rbs#lib/rbs/ast/ruby/comment_block.rb:182 def location; end # pkg:gem/rbs#lib/rbs/ast/ruby/comment_block.rb:7 @@ -1218,61 +1222,61 @@ class RBS::AST::Ruby::CommentBlock # pkg:gem/rbs#lib/rbs/ast/ruby/comment_block.rb:7 def offsets; end - # pkg:gem/rbs#lib/rbs/ast/ruby/comment_block.rb:187 + # pkg:gem/rbs#lib/rbs/ast/ruby/comment_block.rb:189 def parse_annotation_lines(start_line, end_line, variables); end - # pkg:gem/rbs#lib/rbs/ast/ruby/comment_block.rb:46 + # pkg:gem/rbs#lib/rbs/ast/ruby/comment_block.rb:48 def start_line; end - # pkg:gem/rbs#lib/rbs/ast/ruby/comment_block.rb:169 + # pkg:gem/rbs#lib/rbs/ast/ruby/comment_block.rb:171 def text(comment_index); end - # pkg:gem/rbs#lib/rbs/ast/ruby/comment_block.rb:41 + # pkg:gem/rbs#lib/rbs/ast/ruby/comment_block.rb:43 def trailing?; end - # pkg:gem/rbs#lib/rbs/ast/ruby/comment_block.rb:197 + # pkg:gem/rbs#lib/rbs/ast/ruby/comment_block.rb:199 def trailing_annotation(variables); end - # pkg:gem/rbs#lib/rbs/ast/ruby/comment_block.rb:130 + # pkg:gem/rbs#lib/rbs/ast/ruby/comment_block.rb:132 def yield_annotation(start_line, end_line, current_line, variables, &block); end - # pkg:gem/rbs#lib/rbs/ast/ruby/comment_block.rb:110 + # pkg:gem/rbs#lib/rbs/ast/ruby/comment_block.rb:112 def yield_paragraph(start_line, current_line, variables, &block); end class << self - # pkg:gem/rbs#lib/rbs/ast/ruby/comment_block.rb:60 + # pkg:gem/rbs#lib/rbs/ast/ruby/comment_block.rb:62 def build(buffer, comments); end end end -# pkg:gem/rbs#lib/rbs/ast/ruby/comment_block.rb:96 +# pkg:gem/rbs#lib/rbs/ast/ruby/comment_block.rb:98 class RBS::AST::Ruby::CommentBlock::AnnotationSyntaxError < ::Struct - # pkg:gem/rbs#lib/rbs/ast/ruby/comment_block.rb:96 + # pkg:gem/rbs#lib/rbs/ast/ruby/comment_block.rb:98 def error; end - # pkg:gem/rbs#lib/rbs/ast/ruby/comment_block.rb:96 + # pkg:gem/rbs#lib/rbs/ast/ruby/comment_block.rb:98 def error=(_); end - # pkg:gem/rbs#lib/rbs/ast/ruby/comment_block.rb:96 + # pkg:gem/rbs#lib/rbs/ast/ruby/comment_block.rb:98 def location; end - # pkg:gem/rbs#lib/rbs/ast/ruby/comment_block.rb:96 + # pkg:gem/rbs#lib/rbs/ast/ruby/comment_block.rb:98 def location=(_); end class << self - # pkg:gem/rbs#lib/rbs/ast/ruby/comment_block.rb:96 + # pkg:gem/rbs#lib/rbs/ast/ruby/comment_block.rb:98 def [](*_arg0); end - # pkg:gem/rbs#lib/rbs/ast/ruby/comment_block.rb:96 + # pkg:gem/rbs#lib/rbs/ast/ruby/comment_block.rb:98 def inspect; end - # pkg:gem/rbs#lib/rbs/ast/ruby/comment_block.rb:96 + # pkg:gem/rbs#lib/rbs/ast/ruby/comment_block.rb:98 def keyword_init?; end - # pkg:gem/rbs#lib/rbs/ast/ruby/comment_block.rb:96 + # pkg:gem/rbs#lib/rbs/ast/ruby/comment_block.rb:98 def members; end - # pkg:gem/rbs#lib/rbs/ast/ruby/comment_block.rb:96 + # pkg:gem/rbs#lib/rbs/ast/ruby/comment_block.rb:98 def new(*_arg0); end end end @@ -1485,45 +1489,45 @@ end # pkg:gem/rbs#lib/rbs/ast/ruby/members.rb:6 module RBS::AST::Ruby::Members; end -# pkg:gem/rbs#lib/rbs/ast/ruby/members.rb:690 +# pkg:gem/rbs#lib/rbs/ast/ruby/members.rb:701 class RBS::AST::Ruby::Members::AttrAccessorMember < ::RBS::AST::Ruby::Members::AttributeMember; end -# pkg:gem/rbs#lib/rbs/ast/ruby/members.rb:684 +# pkg:gem/rbs#lib/rbs/ast/ruby/members.rb:695 class RBS::AST::Ruby::Members::AttrReaderMember < ::RBS::AST::Ruby::Members::AttributeMember; end -# pkg:gem/rbs#lib/rbs/ast/ruby/members.rb:687 +# pkg:gem/rbs#lib/rbs/ast/ruby/members.rb:698 class RBS::AST::Ruby::Members::AttrWriterMember < ::RBS::AST::Ruby::Members::AttributeMember; end -# pkg:gem/rbs#lib/rbs/ast/ruby/members.rb:639 +# pkg:gem/rbs#lib/rbs/ast/ruby/members.rb:650 class RBS::AST::Ruby::Members::AttributeMember < ::RBS::AST::Ruby::Members::Base - # pkg:gem/rbs#lib/rbs/ast/ruby/members.rb:645 + # pkg:gem/rbs#lib/rbs/ast/ruby/members.rb:656 def initialize(buffer, node, name_nodes, leading_comment, type_annotation); end - # pkg:gem/rbs#lib/rbs/ast/ruby/members.rb:643 + # pkg:gem/rbs#lib/rbs/ast/ruby/members.rb:654 def leading_comment; end - # pkg:gem/rbs#lib/rbs/ast/ruby/members.rb:659 + # pkg:gem/rbs#lib/rbs/ast/ruby/members.rb:670 def location; end - # pkg:gem/rbs#lib/rbs/ast/ruby/members.rb:663 + # pkg:gem/rbs#lib/rbs/ast/ruby/members.rb:674 def name_locations; end - # pkg:gem/rbs#lib/rbs/ast/ruby/members.rb:641 + # pkg:gem/rbs#lib/rbs/ast/ruby/members.rb:652 def name_nodes; end - # pkg:gem/rbs#lib/rbs/ast/ruby/members.rb:653 + # pkg:gem/rbs#lib/rbs/ast/ruby/members.rb:664 def names; end - # pkg:gem/rbs#lib/rbs/ast/ruby/members.rb:640 + # pkg:gem/rbs#lib/rbs/ast/ruby/members.rb:651 def node; end - # pkg:gem/rbs#lib/rbs/ast/ruby/members.rb:669 + # pkg:gem/rbs#lib/rbs/ast/ruby/members.rb:680 def type; end - # pkg:gem/rbs#lib/rbs/ast/ruby/members.rb:642 + # pkg:gem/rbs#lib/rbs/ast/ruby/members.rb:653 def type_annotation; end - # pkg:gem/rbs#lib/rbs/ast/ruby/members.rb:673 + # pkg:gem/rbs#lib/rbs/ast/ruby/members.rb:684 def type_fingerprint; end end @@ -1540,67 +1544,76 @@ end # pkg:gem/rbs#lib/rbs/ast/ruby/members.rb:547 class RBS::AST::Ruby::Members::DefMember < ::RBS::AST::Ruby::Members::Base - # pkg:gem/rbs#lib/rbs/ast/ruby/members.rb:555 - def initialize(buffer, name, node, method_type, leading_comment); end + # pkg:gem/rbs#lib/rbs/ast/ruby/members.rb:556 + def initialize(buffer, name, node, method_type, leading_comment, kind: T.unsafe(nil)); end - # pkg:gem/rbs#lib/rbs/ast/ruby/members.rb:575 + # pkg:gem/rbs#lib/rbs/ast/ruby/members.rb:585 def annotations; end - # pkg:gem/rbs#lib/rbs/ast/ruby/members.rb:553 + # pkg:gem/rbs#lib/rbs/ast/ruby/members.rb:569 + def instance?; end + + # pkg:gem/rbs#lib/rbs/ast/ruby/members.rb:552 + def kind; end + + # pkg:gem/rbs#lib/rbs/ast/ruby/members.rb:554 def leading_comment; end - # pkg:gem/rbs#lib/rbs/ast/ruby/members.rb:563 + # pkg:gem/rbs#lib/rbs/ast/ruby/members.rb:573 def location; end - # pkg:gem/rbs#lib/rbs/ast/ruby/members.rb:552 + # pkg:gem/rbs#lib/rbs/ast/ruby/members.rb:553 def method_type; end # pkg:gem/rbs#lib/rbs/ast/ruby/members.rb:550 def name; end - # pkg:gem/rbs#lib/rbs/ast/ruby/members.rb:579 + # pkg:gem/rbs#lib/rbs/ast/ruby/members.rb:589 def name_location; end # pkg:gem/rbs#lib/rbs/ast/ruby/members.rb:551 def node; end - # pkg:gem/rbs#lib/rbs/ast/ruby/members.rb:571 + # pkg:gem/rbs#lib/rbs/ast/ruby/members.rb:581 def overloading?; end - # pkg:gem/rbs#lib/rbs/ast/ruby/members.rb:567 + # pkg:gem/rbs#lib/rbs/ast/ruby/members.rb:577 def overloads; end - # pkg:gem/rbs#lib/rbs/ast/ruby/members.rb:583 + # pkg:gem/rbs#lib/rbs/ast/ruby/members.rb:565 + def singleton?; end + + # pkg:gem/rbs#lib/rbs/ast/ruby/members.rb:593 def type_fingerprint; end end # pkg:gem/rbs#lib/rbs/ast/ruby/members.rb:548 RBS::AST::Ruby::Members::DefMember::Overload = RBS::AST::Members::MethodDefinition::Overload -# pkg:gem/rbs#lib/rbs/ast/ruby/members.rb:633 +# pkg:gem/rbs#lib/rbs/ast/ruby/members.rb:644 class RBS::AST::Ruby::Members::ExtendMember < ::RBS::AST::Ruby::Members::MixinMember; end -# pkg:gem/rbs#lib/rbs/ast/ruby/members.rb:630 +# pkg:gem/rbs#lib/rbs/ast/ruby/members.rb:641 class RBS::AST::Ruby::Members::IncludeMember < ::RBS::AST::Ruby::Members::MixinMember; end -# pkg:gem/rbs#lib/rbs/ast/ruby/members.rb:693 +# pkg:gem/rbs#lib/rbs/ast/ruby/members.rb:704 class RBS::AST::Ruby::Members::InstanceVariableMember < ::RBS::AST::Ruby::Members::Base - # pkg:gem/rbs#lib/rbs/ast/ruby/members.rb:696 + # pkg:gem/rbs#lib/rbs/ast/ruby/members.rb:707 def initialize(buffer, annotation); end - # pkg:gem/rbs#lib/rbs/ast/ruby/members.rb:694 + # pkg:gem/rbs#lib/rbs/ast/ruby/members.rb:705 def annotation; end - # pkg:gem/rbs#lib/rbs/ast/ruby/members.rb:709 + # pkg:gem/rbs#lib/rbs/ast/ruby/members.rb:720 def location; end - # pkg:gem/rbs#lib/rbs/ast/ruby/members.rb:701 + # pkg:gem/rbs#lib/rbs/ast/ruby/members.rb:712 def name; end - # pkg:gem/rbs#lib/rbs/ast/ruby/members.rb:705 + # pkg:gem/rbs#lib/rbs/ast/ruby/members.rb:716 def type; end - # pkg:gem/rbs#lib/rbs/ast/ruby/members.rb:713 + # pkg:gem/rbs#lib/rbs/ast/ruby/members.rb:724 def type_fingerprint; end end @@ -1695,55 +1708,55 @@ class RBS::AST::Ruby::Members::MethodTypeAnnotation::DocStyle end end -# pkg:gem/rbs#lib/rbs/ast/ruby/members.rb:593 +# pkg:gem/rbs#lib/rbs/ast/ruby/members.rb:604 class RBS::AST::Ruby::Members::MixinMember < ::RBS::AST::Ruby::Members::Base - # pkg:gem/rbs#lib/rbs/ast/ruby/members.rb:598 + # pkg:gem/rbs#lib/rbs/ast/ruby/members.rb:609 def initialize(buffer, node, module_name, annotation); end - # pkg:gem/rbs#lib/rbs/ast/ruby/members.rb:596 + # pkg:gem/rbs#lib/rbs/ast/ruby/members.rb:607 def annotation; end - # pkg:gem/rbs#lib/rbs/ast/ruby/members.rb:605 + # pkg:gem/rbs#lib/rbs/ast/ruby/members.rb:616 def location; end - # pkg:gem/rbs#lib/rbs/ast/ruby/members.rb:595 + # pkg:gem/rbs#lib/rbs/ast/ruby/members.rb:606 def module_name; end - # pkg:gem/rbs#lib/rbs/ast/ruby/members.rb:609 + # pkg:gem/rbs#lib/rbs/ast/ruby/members.rb:620 def name_location; end - # pkg:gem/rbs#lib/rbs/ast/ruby/members.rb:594 + # pkg:gem/rbs#lib/rbs/ast/ruby/members.rb:605 def node; end - # pkg:gem/rbs#lib/rbs/ast/ruby/members.rb:616 + # pkg:gem/rbs#lib/rbs/ast/ruby/members.rb:627 def type_args; end - # pkg:gem/rbs#lib/rbs/ast/ruby/members.rb:620 + # pkg:gem/rbs#lib/rbs/ast/ruby/members.rb:631 def type_fingerprint; end end -# pkg:gem/rbs#lib/rbs/ast/ruby/members.rb:721 +# pkg:gem/rbs#lib/rbs/ast/ruby/members.rb:732 class RBS::AST::Ruby::Members::ModuleSelfMember < ::RBS::AST::Ruby::Members::Base - # pkg:gem/rbs#lib/rbs/ast/ruby/members.rb:724 + # pkg:gem/rbs#lib/rbs/ast/ruby/members.rb:735 def initialize(buffer, annotation); end - # pkg:gem/rbs#lib/rbs/ast/ruby/members.rb:722 + # pkg:gem/rbs#lib/rbs/ast/ruby/members.rb:733 def annotation; end - # pkg:gem/rbs#lib/rbs/ast/ruby/members.rb:733 + # pkg:gem/rbs#lib/rbs/ast/ruby/members.rb:744 def args; end - # pkg:gem/rbs#lib/rbs/ast/ruby/members.rb:737 + # pkg:gem/rbs#lib/rbs/ast/ruby/members.rb:748 def location; end - # pkg:gem/rbs#lib/rbs/ast/ruby/members.rb:729 + # pkg:gem/rbs#lib/rbs/ast/ruby/members.rb:740 def name; end - # pkg:gem/rbs#lib/rbs/ast/ruby/members.rb:741 + # pkg:gem/rbs#lib/rbs/ast/ruby/members.rb:752 def type_fingerprint; end end -# pkg:gem/rbs#lib/rbs/ast/ruby/members.rb:636 +# pkg:gem/rbs#lib/rbs/ast/ruby/members.rb:647 class RBS::AST::Ruby::Members::PrependMember < ::RBS::AST::Ruby::Members::MixinMember; end # pkg:gem/rbs#lib/rbs/ast/type_param.rb:5 @@ -2007,13 +2020,16 @@ class RBS::Buffer # pkg:gem/rbs#lib/rbs/buffer.rb:9 def initialize(content:, name: T.unsafe(nil), parent: T.unsafe(nil)); end - # pkg:gem/rbs#lib/rbs/buffer.rb:131 + # pkg:gem/rbs#lib/rbs/buffer.rb:168 def absolute_position(position); end + # pkg:gem/rbs#lib/rbs/buffer.rb:90 + def character_offset(byte_offset); end + # pkg:gem/rbs#lib/rbs/buffer.rb:6 def content; end - # pkg:gem/rbs#lib/rbs/buffer.rb:148 + # pkg:gem/rbs#lib/rbs/buffer.rb:185 def detach; end # pkg:gem/rbs#lib/rbs/buffer.rb:86 @@ -2037,10 +2053,10 @@ class RBS::Buffer # pkg:gem/rbs#lib/rbs/buffer.rb:7 def parent; end - # pkg:gem/rbs#lib/rbs/buffer.rb:116 + # pkg:gem/rbs#lib/rbs/buffer.rb:153 def parent_buffer; end - # pkg:gem/rbs#lib/rbs/buffer.rb:122 + # pkg:gem/rbs#lib/rbs/buffer.rb:159 def parent_position(position); end # pkg:gem/rbs#lib/rbs/buffer.rb:56 @@ -2049,13 +2065,13 @@ class RBS::Buffer # pkg:gem/rbs#lib/rbs/buffer.rb:30 def ranges; end - # pkg:gem/rbs#lib/rbs/buffer.rb:90 + # pkg:gem/rbs#lib/rbs/buffer.rb:114 def rbs_location(location, loc2 = T.unsafe(nil)); end - # pkg:gem/rbs#lib/rbs/buffer.rb:98 - def sub_buffer(lines:); end + # pkg:gem/rbs#lib/rbs/buffer.rb:123 + def sub_buffer(lines:, byte_lines_hint: T.unsafe(nil)); end - # pkg:gem/rbs#lib/rbs/buffer.rb:140 + # pkg:gem/rbs#lib/rbs/buffer.rb:177 def top_buffer; end end @@ -2414,13 +2430,13 @@ class RBS::Collection::Sources::Git # pkg:gem/rbs#lib/rbs/collection/sources/git.rb:44 def install(dest:, name:, version:, stdout:); end - # pkg:gem/rbs#lib/rbs/collection/sources/git.rb:224 + # pkg:gem/rbs#lib/rbs/collection/sources/git.rb:230 def load_metadata(dir:); end # pkg:gem/rbs#lib/rbs/collection/sources/git.rb:74 def manifest_of(name, version); end - # pkg:gem/rbs#lib/rbs/collection/sources/git.rb:208 + # pkg:gem/rbs#lib/rbs/collection/sources/git.rb:214 def metadata_content(name:, version:); end # pkg:gem/rbs#lib/rbs/collection/sources/git.rb:17 @@ -2432,7 +2448,7 @@ class RBS::Collection::Sources::Git # pkg:gem/rbs#lib/rbs/collection/sources/git.rb:17 def repo_dir; end - # pkg:gem/rbs#lib/rbs/collection/sources/git.rb:173 + # pkg:gem/rbs#lib/rbs/collection/sources/git.rb:179 def resolved_revision; end # pkg:gem/rbs#lib/rbs/collection/sources/git.rb:17 @@ -2444,7 +2460,7 @@ class RBS::Collection::Sources::Git # pkg:gem/rbs#lib/rbs/collection/sources/git.rb:37 def versions(name); end - # pkg:gem/rbs#lib/rbs/collection/sources/git.rb:216 + # pkg:gem/rbs#lib/rbs/collection/sources/git.rb:222 def write_metadata(dir:, name:, version:); end private @@ -2452,7 +2468,7 @@ class RBS::Collection::Sources::Git # pkg:gem/rbs#lib/rbs/collection/sources/git.rb:88 def _install(dest:, name:, version:); end - # pkg:gem/rbs#lib/rbs/collection/sources/git.rb:184 + # pkg:gem/rbs#lib/rbs/collection/sources/git.rb:190 def commit_hash?; end # pkg:gem/rbs#lib/rbs/collection/sources/git.rb:100 @@ -2461,28 +2477,28 @@ class RBS::Collection::Sources::Git # pkg:gem/rbs#lib/rbs/collection/sources/git.rb:124 def format_config_entry(name, version); end - # pkg:gem/rbs#lib/rbs/collection/sources/git.rb:169 + # pkg:gem/rbs#lib/rbs/collection/sources/git.rb:175 def gem_repo_dir; end - # pkg:gem/rbs#lib/rbs/collection/sources/git.rb:230 + # pkg:gem/rbs#lib/rbs/collection/sources/git.rb:236 def gems_versions; end - # pkg:gem/rbs#lib/rbs/collection/sources/git.rb:188 + # pkg:gem/rbs#lib/rbs/collection/sources/git.rb:194 def git(*cmd, **opt); end - # pkg:gem/rbs#lib/rbs/collection/sources/git.rb:192 + # pkg:gem/rbs#lib/rbs/collection/sources/git.rb:198 def git?(*cmd, **opt); end - # pkg:gem/rbs#lib/rbs/collection/sources/git.rb:159 + # pkg:gem/rbs#lib/rbs/collection/sources/git.rb:165 def git_dir; end - # pkg:gem/rbs#lib/rbs/collection/sources/git.rb:153 + # pkg:gem/rbs#lib/rbs/collection/sources/git.rb:159 def need_to_fetch?(revision); end # pkg:gem/rbs#lib/rbs/collection/sources/git.rb:131 def setup!; end - # pkg:gem/rbs#lib/rbs/collection/sources/git.rb:198 + # pkg:gem/rbs#lib/rbs/collection/sources/git.rb:204 def sh!(*cmd, **opt); end end @@ -3178,28 +3194,28 @@ class RBS::DefinitionBuilder::MethodBuilder # pkg:gem/rbs#lib/rbs/definition_builder/method_builder.rb:91 def initialize(env:); end - # pkg:gem/rbs#lib/rbs/definition_builder/method_builder.rb:211 + # pkg:gem/rbs#lib/rbs/definition_builder/method_builder.rb:217 def build_alias(methods, type, member:); end - # pkg:gem/rbs#lib/rbs/definition_builder/method_builder.rb:216 + # pkg:gem/rbs#lib/rbs/definition_builder/method_builder.rb:222 def build_attribute(methods, type, member:, accessibility:); end # pkg:gem/rbs#lib/rbs/definition_builder/method_builder.rb:99 def build_instance(type_name); end - # pkg:gem/rbs#lib/rbs/definition_builder/method_builder.rb:191 + # pkg:gem/rbs#lib/rbs/definition_builder/method_builder.rb:197 def build_interface(type_name); end - # pkg:gem/rbs#lib/rbs/definition_builder/method_builder.rb:250 + # pkg:gem/rbs#lib/rbs/definition_builder/method_builder.rb:256 def build_method(methods, type, member:, accessibility:); end - # pkg:gem/rbs#lib/rbs/definition_builder/method_builder.rb:232 + # pkg:gem/rbs#lib/rbs/definition_builder/method_builder.rb:238 def build_ruby_attribute(methods, type, member:, accessibility:); end - # pkg:gem/rbs#lib/rbs/definition_builder/method_builder.rb:162 + # pkg:gem/rbs#lib/rbs/definition_builder/method_builder.rb:164 def build_singleton(type_name); end - # pkg:gem/rbs#lib/rbs/definition_builder/method_builder.rb:261 + # pkg:gem/rbs#lib/rbs/definition_builder/method_builder.rb:267 def each_rbs_member_with_accessibility(members, accessibility: T.unsafe(nil)); end # pkg:gem/rbs#lib/rbs/definition_builder/method_builder.rb:86 @@ -3214,7 +3230,7 @@ class RBS::DefinitionBuilder::MethodBuilder # pkg:gem/rbs#lib/rbs/definition_builder/method_builder.rb:88 def singleton_methods; end - # pkg:gem/rbs#lib/rbs/definition_builder/method_builder.rb:274 + # pkg:gem/rbs#lib/rbs/definition_builder/method_builder.rb:280 def update(env:, except:); end end @@ -3382,10 +3398,10 @@ class RBS::Environment # pkg:gem/rbs#lib/rbs/environment.rb:48 def initialize; end - # pkg:gem/rbs#lib/rbs/environment.rb:987 + # pkg:gem/rbs#lib/rbs/environment.rb:988 def absolute_type(resolver, map, type, context:); end - # pkg:gem/rbs#lib/rbs/environment.rb:982 + # pkg:gem/rbs#lib/rbs/environment.rb:983 def absolute_type_name(resolver, map, type_name, context:); end # pkg:gem/rbs#lib/rbs/environment.rb:455 @@ -3394,7 +3410,7 @@ class RBS::Environment # pkg:gem/rbs#lib/rbs/environment.rb:568 def append_context(context, decl); end - # pkg:gem/rbs#lib/rbs/environment.rb:998 + # pkg:gem/rbs#lib/rbs/environment.rb:999 def buffers; end # pkg:gem/rbs#lib/rbs/environment.rb:117 @@ -3442,7 +3458,7 @@ class RBS::Environment # pkg:gem/rbs#lib/rbs/environment.rb:374 def insert_ruby_decl(decl, context:, namespace:); end - # pkg:gem/rbs#lib/rbs/environment.rb:993 + # pkg:gem/rbs#lib/rbs/environment.rb:994 def inspect; end # pkg:gem/rbs#lib/rbs/environment.rb:6 @@ -3502,10 +3518,10 @@ class RBS::Environment # pkg:gem/rbs#lib/rbs/environment.rb:577 def resolve_declaration(resolver, map, decl, context:, prefix:); end - # pkg:gem/rbs#lib/rbs/environment.rb:868 + # pkg:gem/rbs#lib/rbs/environment.rb:869 def resolve_member(resolver, map, member, context:); end - # pkg:gem/rbs#lib/rbs/environment.rb:968 + # pkg:gem/rbs#lib/rbs/environment.rb:969 def resolve_method_type(resolver, map, type, context:); end # pkg:gem/rbs#lib/rbs/environment.rb:713 @@ -3520,7 +3536,7 @@ class RBS::Environment # pkg:gem/rbs#lib/rbs/environment.rb:522 def resolve_type_names(only: T.unsafe(nil)); end - # pkg:gem/rbs#lib/rbs/environment.rb:976 + # pkg:gem/rbs#lib/rbs/environment.rb:977 def resolve_type_params(resolver, map, params, context:); end # pkg:gem/rbs#lib/rbs/environment.rb:562 @@ -3538,7 +3554,7 @@ class RBS::Environment # pkg:gem/rbs#lib/rbs/environment.rb:87 def type_name?(name); end - # pkg:gem/rbs#lib/rbs/environment.rb:1002 + # pkg:gem/rbs#lib/rbs/environment.rb:1003 def unload(paths); end # pkg:gem/rbs#lib/rbs/environment.rb:494 @@ -4055,31 +4071,31 @@ class RBS::InlineParser::Parser < ::Prism::Visitor # pkg:gem/rbs#lib/rbs/inline_parser.rb:81 def diagnostics; end - # pkg:gem/rbs#lib/rbs/inline_parser.rb:496 + # pkg:gem/rbs#lib/rbs/inline_parser.rb:498 def insert_declaration(decl); end # pkg:gem/rbs#lib/rbs/inline_parser.rb:58 def module_nesting; end - # pkg:gem/rbs#lib/rbs/inline_parser.rb:339 + # pkg:gem/rbs#lib/rbs/inline_parser.rb:341 def parse_attribute_call(node); end - # pkg:gem/rbs#lib/rbs/inline_parser.rb:399 + # pkg:gem/rbs#lib/rbs/inline_parser.rb:401 def parse_constant_declaration(node); end - # pkg:gem/rbs#lib/rbs/inline_parser.rb:283 + # pkg:gem/rbs#lib/rbs/inline_parser.rb:285 def parse_mixin_call(node); end - # pkg:gem/rbs#lib/rbs/inline_parser.rb:532 + # pkg:gem/rbs#lib/rbs/inline_parser.rb:534 def parse_super_class(super_class_expr, inheritance_operator_loc); end # pkg:gem/rbs#lib/rbs/inline_parser.rb:85 def push_module_nesting(mod); end - # pkg:gem/rbs#lib/rbs/inline_parser.rb:504 + # pkg:gem/rbs#lib/rbs/inline_parser.rb:506 def report_unused_annotation(*annotations); end - # pkg:gem/rbs#lib/rbs/inline_parser.rb:519 + # pkg:gem/rbs#lib/rbs/inline_parser.rb:521 def report_unused_block(block); end # pkg:gem/rbs#lib/rbs/inline_parser.rb:58 @@ -4088,7 +4104,7 @@ class RBS::InlineParser::Parser < ::Prism::Visitor # pkg:gem/rbs#lib/rbs/inline_parser.rb:92 def skip_node?(node); end - # pkg:gem/rbs#lib/rbs/inline_parser.rb:241 + # pkg:gem/rbs#lib/rbs/inline_parser.rb:243 def visit_call_node(node); end # pkg:gem/rbs#lib/rbs/inline_parser.rb:103 @@ -4097,10 +4113,10 @@ class RBS::InlineParser::Parser < ::Prism::Visitor # pkg:gem/rbs#lib/rbs/inline_parser.rb:167 def visit_class_or_module_body(decl, node); end - # pkg:gem/rbs#lib/rbs/inline_parser.rb:277 + # pkg:gem/rbs#lib/rbs/inline_parser.rb:279 def visit_constant_path_write_node(node); end - # pkg:gem/rbs#lib/rbs/inline_parser.rb:270 + # pkg:gem/rbs#lib/rbs/inline_parser.rb:272 def visit_constant_write_node(node); end # pkg:gem/rbs#lib/rbs/inline_parser.rb:202 @@ -4209,36 +4225,42 @@ end # pkg:gem/rbs#lib/rbs/errors.rb:20 class RBS::LoadingError < ::RBS::BaseError; end -# pkg:gem/rbs#lib/rbs.rb:72 +# Pure-Ruby implementation of the primitives that back RBS::Location. +# +# On CRuby these come from the C extension (ext/rbs_extension/legacy_location.c). +# JRuby loads this instead, before rbs/location_aux.rb layers the public API on +# top, so RBS::Location behaves identically without the native extension. +# +# pkg:gem/rbs#lib/rbs.rb:82 class RBS::Location - # pkg:gem/rbs#lib/rbs.rb:72 + # pkg:gem/rbs#lib/rbs.rb:82 def initialize(_arg0, _arg1, _arg2); end # pkg:gem/rbs#lib/rbs/location_aux.rb:79 def ==(other); end - # pkg:gem/rbs#lib/rbs.rb:72 + # pkg:gem/rbs#lib/rbs.rb:82 def [](_arg0); end - # pkg:gem/rbs#lib/rbs.rb:72 + # pkg:gem/rbs#lib/rbs.rb:82 def _add_optional_child(_arg0, _arg1, _arg2); end - # pkg:gem/rbs#lib/rbs.rb:72 + # pkg:gem/rbs#lib/rbs.rb:82 def _add_optional_no_child(_arg0); end - # pkg:gem/rbs#lib/rbs.rb:72 + # pkg:gem/rbs#lib/rbs.rb:82 def _add_required_child(_arg0, _arg1, _arg2); end - # pkg:gem/rbs#lib/rbs.rb:72 + # pkg:gem/rbs#lib/rbs.rb:82 def _end_pos; end - # pkg:gem/rbs#lib/rbs.rb:72 + # pkg:gem/rbs#lib/rbs.rb:82 def _optional_keys; end - # pkg:gem/rbs#lib/rbs.rb:72 + # pkg:gem/rbs#lib/rbs.rb:82 def _required_keys; end - # pkg:gem/rbs#lib/rbs.rb:72 + # pkg:gem/rbs#lib/rbs.rb:82 def _start_pos; end # pkg:gem/rbs#lib/rbs/location_aux.rb:110 @@ -4250,7 +4272,7 @@ class RBS::Location # pkg:gem/rbs#lib/rbs/location_aux.rb:27 def aref(_arg0); end - # pkg:gem/rbs#lib/rbs.rb:72 + # pkg:gem/rbs#lib/rbs.rb:82 def buffer; end # pkg:gem/rbs#lib/rbs/location_aux.rb:118 @@ -4318,7 +4340,7 @@ class RBS::Location private - # pkg:gem/rbs#lib/rbs.rb:72 + # pkg:gem/rbs#lib/rbs.rb:82 def initialize_copy(_arg0); end class << self @@ -4476,66 +4498,77 @@ class RBS::Namespace # pkg:gem/rbs#lib/rbs/namespace.rb:7 def initialize(path:, absolute:); end - # pkg:gem/rbs#lib/rbs/namespace.rb:20 + # pkg:gem/rbs#lib/rbs/namespace.rb:55 def +(other); end - # pkg:gem/rbs#lib/rbs/namespace.rb:59 + # pkg:gem/rbs#lib/rbs/namespace.rb:94 def ==(other); end - # pkg:gem/rbs#lib/rbs/namespace.rb:47 + # pkg:gem/rbs#lib/rbs/namespace.rb:82 def absolute!; end - # pkg:gem/rbs#lib/rbs/namespace.rb:39 + # pkg:gem/rbs#lib/rbs/namespace.rb:74 def absolute?; end - # pkg:gem/rbs#lib/rbs/namespace.rb:28 + # pkg:gem/rbs#lib/rbs/namespace.rb:63 def append(component); end - # pkg:gem/rbs#lib/rbs/namespace.rb:101 + # pkg:gem/rbs#lib/rbs/namespace.rb:137 def ascend; end - # pkg:gem/rbs#lib/rbs/namespace.rb:55 + # pkg:gem/rbs#lib/rbs/namespace.rb:90 def empty?; end - # pkg:gem/rbs#lib/rbs/namespace.rb:63 + # pkg:gem/rbs#lib/rbs/namespace.rb:99 def eql?(other); end - # pkg:gem/rbs#lib/rbs/namespace.rb:65 + # pkg:gem/rbs#lib/rbs/namespace.rb:101 def hash; end - # pkg:gem/rbs#lib/rbs/namespace.rb:32 + # pkg:gem/rbs#lib/rbs/namespace.rb:67 def parent; end # pkg:gem/rbs#lib/rbs/namespace.rb:5 def path; end - # pkg:gem/rbs#lib/rbs/namespace.rb:51 + # pkg:gem/rbs#lib/rbs/namespace.rb:86 def relative!; end - # pkg:gem/rbs#lib/rbs/namespace.rb:43 + # pkg:gem/rbs#lib/rbs/namespace.rb:78 def relative?; end - # pkg:gem/rbs#lib/rbs/namespace.rb:69 + # pkg:gem/rbs#lib/rbs/namespace.rb:105 def split; end - # pkg:gem/rbs#lib/rbs/namespace.rb:75 + # pkg:gem/rbs#lib/rbs/namespace.rb:111 def to_s; end - # pkg:gem/rbs#lib/rbs/namespace.rb:84 + # pkg:gem/rbs#lib/rbs/namespace.rb:120 def to_type_name; end class << self - # pkg:gem/rbs#lib/rbs/namespace.rb:12 + # Returns a canonical `Namespace` instance for the given `path` / + # `absolute` pair. Repeated calls with structurally equal arguments + # return the same object, so callers can rely on `equal?` for fast + # equality. The path Array is duplicated and frozen on insert. + # + # pkg:gem/rbs#lib/rbs/namespace.rb:24 + def [](path, absolute); end + + # pkg:gem/rbs#lib/rbs/namespace.rb:47 def empty; end - # pkg:gem/rbs#lib/rbs/namespace.rb:93 + # pkg:gem/rbs#lib/rbs/namespace.rb:129 def parse(string); end - # pkg:gem/rbs#lib/rbs/namespace.rb:16 + # pkg:gem/rbs#lib/rbs/namespace.rb:51 def root; end end end +# pkg:gem/rbs#lib/rbs/namespace.rb:18 +module RBS::Namespace::INTERN_LEAF; end + # pkg:gem/rbs#lib/rbs/errors.rb:229 class RBS::NoMixinFoundError < ::RBS::DefinitionError include ::RBS::DetailedMessageable @@ -4627,30 +4660,46 @@ class RBS::NonregularTypeAliasError < ::RBS::BaseError def location; end end -# pkg:gem/rbs#lib/rbs.rb:72 +# WebAssembly-backed implementation of the parser primitives. +# +# On CRuby these come from the C extension (ext/rbs_extension/main.c). JRuby +# loads this instead: it runs the parser inside WebAssembly, then rebuilds the +# AST with RBS::WASM::Deserializer. rbs/parser_aux.rb layers the public +# RBS::Parser API on top, exactly as it does for the C extension. +# +# pkg:gem/rbs#lib/rbs.rb:82 class RBS::Parser class << self - # pkg:gem/rbs#lib/rbs.rb:72 + # pkg:gem/rbs#lib/rbs.rb:82 def _lex(_arg0, _arg1); end - # pkg:gem/rbs#lib/rbs.rb:72 + # pkg:gem/rbs#lib/rbs.rb:82 def _parse_inline_leading_annotation(_arg0, _arg1, _arg2, _arg3); end - # pkg:gem/rbs#lib/rbs.rb:72 + # pkg:gem/rbs#lib/rbs.rb:82 def _parse_inline_trailing_annotation(_arg0, _arg1, _arg2, _arg3); end - # pkg:gem/rbs#lib/rbs.rb:72 + # pkg:gem/rbs#lib/rbs.rb:82 def _parse_method_type(_arg0, _arg1, _arg2, _arg3, _arg4); end - # pkg:gem/rbs#lib/rbs.rb:72 + # pkg:gem/rbs#lib/rbs.rb:82 + def _parse_method_type_to_bytes(_arg0, _arg1, _arg2, _arg3, _arg4); end + + # pkg:gem/rbs#lib/rbs.rb:82 def _parse_signature(_arg0, _arg1, _arg2); end - # pkg:gem/rbs#lib/rbs.rb:72 + # pkg:gem/rbs#lib/rbs.rb:82 + def _parse_signature_to_bytes(_arg0, _arg1, _arg2); end + + # pkg:gem/rbs#lib/rbs.rb:82 def _parse_type(_arg0, _arg1, _arg2, _arg3, _arg4, _arg5, _arg6, _arg7); end - # pkg:gem/rbs#lib/rbs.rb:72 + # pkg:gem/rbs#lib/rbs.rb:82 def _parse_type_params(_arg0, _arg1, _arg2, _arg3); end + # pkg:gem/rbs#lib/rbs.rb:82 + def _parse_type_to_bytes(_arg0, _arg1, _arg2, _arg3, _arg4, _arg5, _arg6, _arg7); end + # pkg:gem/rbs#lib/rbs/parser_aux.rb:79 def buffer(source); end @@ -4986,50 +5035,50 @@ class RBS::Prototype::Runtime # pkg:gem/rbs#lib/rbs/prototype/runtime.rb:79 def initialize(patterns:, env:, merge:, todo: T.unsafe(nil), owners_included: T.unsafe(nil)); end - # pkg:gem/rbs#lib/rbs/prototype/runtime.rb:662 + # pkg:gem/rbs#lib/rbs/prototype/runtime.rb:664 def block_from_ast_of(method); end - # pkg:gem/rbs#lib/rbs/prototype/runtime.rb:109 + # pkg:gem/rbs#lib/rbs/prototype/runtime.rb:111 def builder; end - # pkg:gem/rbs#lib/rbs/prototype/runtime.rb:117 + # pkg:gem/rbs#lib/rbs/prototype/runtime.rb:119 def decls; end # Generate/find outer module declarations # This is broken down into another method to comply with `DRY` # This generates/finds declarations in nested form & returns the last array of declarations # - # pkg:gem/rbs#lib/rbs/prototype/runtime.rb:591 + # pkg:gem/rbs#lib/rbs/prototype/runtime.rb:593 def ensure_outer_module_declarations(mod); end # pkg:gem/rbs#lib/rbs/prototype/runtime.rb:73 def env; end - # pkg:gem/rbs#lib/rbs/prototype/runtime.rb:496 + # pkg:gem/rbs#lib/rbs/prototype/runtime.rb:498 def generate_class(mod); end - # pkg:gem/rbs#lib/rbs/prototype/runtime.rb:433 + # pkg:gem/rbs#lib/rbs/prototype/runtime.rb:435 def generate_constants(mod, decls); end - # pkg:gem/rbs#lib/rbs/prototype/runtime.rb:309 + # pkg:gem/rbs#lib/rbs/prototype/runtime.rb:311 def generate_methods(mod, module_name, members); end - # pkg:gem/rbs#lib/rbs/prototype/runtime.rb:573 + # pkg:gem/rbs#lib/rbs/prototype/runtime.rb:575 def generate_mixin(mod, decl, type_name, type_name_absolute); end - # pkg:gem/rbs#lib/rbs/prototype/runtime.rb:535 + # pkg:gem/rbs#lib/rbs/prototype/runtime.rb:537 def generate_module(mod); end - # pkg:gem/rbs#lib/rbs/prototype/runtime.rb:481 + # pkg:gem/rbs#lib/rbs/prototype/runtime.rb:483 def generate_super_class(mod); end # pkg:gem/rbs#lib/rbs/prototype/runtime.rb:74 def merge; end - # pkg:gem/rbs#lib/rbs/prototype/runtime.rb:248 + # pkg:gem/rbs#lib/rbs/prototype/runtime.rb:250 def merge_rbs(module_name, members, instance: T.unsafe(nil), singleton: T.unsafe(nil)); end - # pkg:gem/rbs#lib/rbs/prototype/runtime.rb:179 + # pkg:gem/rbs#lib/rbs/prototype/runtime.rb:181 def method_type(method); end # pkg:gem/rbs#lib/rbs/prototype/runtime.rb:77 @@ -5041,39 +5090,39 @@ class RBS::Prototype::Runtime # pkg:gem/rbs#lib/rbs/prototype/runtime.rb:76 def owners_included; end - # pkg:gem/rbs#lib/rbs/prototype/runtime.rb:113 + # pkg:gem/rbs#lib/rbs/prototype/runtime.rb:115 def parse(file); end # pkg:gem/rbs#lib/rbs/prototype/runtime.rb:72 def patterns; end - # pkg:gem/rbs#lib/rbs/prototype/runtime.rb:92 + # pkg:gem/rbs#lib/rbs/prototype/runtime.rb:94 def target?(const); end - # pkg:gem/rbs#lib/rbs/prototype/runtime.rb:296 + # pkg:gem/rbs#lib/rbs/prototype/runtime.rb:298 def target_method?(mod, instance: T.unsafe(nil), singleton: T.unsafe(nil)); end # pkg:gem/rbs#lib/rbs/prototype/runtime.rb:75 def todo; end - # pkg:gem/rbs#lib/rbs/prototype/runtime.rb:105 + # pkg:gem/rbs#lib/rbs/prototype/runtime.rb:107 def todo_object; end - # pkg:gem/rbs#lib/rbs/prototype/runtime.rb:645 + # pkg:gem/rbs#lib/rbs/prototype/runtime.rb:647 def type_args(type_name); end - # pkg:gem/rbs#lib/rbs/prototype/runtime.rb:653 + # pkg:gem/rbs#lib/rbs/prototype/runtime.rb:655 def type_params(mod); end private - # pkg:gem/rbs#lib/rbs/prototype/runtime.rb:423 + # pkg:gem/rbs#lib/rbs/prototype/runtime.rb:425 def can_alias?(mod, method); end - # pkg:gem/rbs#lib/rbs/prototype/runtime.rb:137 + # pkg:gem/rbs#lib/rbs/prototype/runtime.rb:139 def each_mixined_module(type_name, mod); end - # pkg:gem/rbs#lib/rbs/prototype/runtime.rb:146 + # pkg:gem/rbs#lib/rbs/prototype/runtime.rb:148 def each_mixined_module_one(type_name, mod); end end @@ -5449,7 +5498,7 @@ class RBS::Resolver::TypeNameResolver # pkg:gem/rbs#lib/rbs/resolver/type_name_resolver.rb:10 def initialize(all_names, aliases); end - # pkg:gem/rbs#lib/rbs/resolver/type_name_resolver.rb:82 + # pkg:gem/rbs#lib/rbs/resolver/type_name_resolver.rb:80 def aliased_name?(type_name); end # pkg:gem/rbs#lib/rbs/resolver/type_name_resolver.rb:8 @@ -5461,29 +5510,29 @@ class RBS::Resolver::TypeNameResolver # pkg:gem/rbs#lib/rbs/resolver/type_name_resolver.rb:7 def cache; end - # pkg:gem/rbs#lib/rbs/resolver/type_name_resolver.rb:76 + # pkg:gem/rbs#lib/rbs/resolver/type_name_resolver.rb:74 def has_type_name?(full_name); end - # pkg:gem/rbs#lib/rbs/resolver/type_name_resolver.rb:121 + # pkg:gem/rbs#lib/rbs/resolver/type_name_resolver.rb:119 def normalize_namespace(type_name, rhs, context, visited); end - # pkg:gem/rbs#lib/rbs/resolver/type_name_resolver.rb:39 + # pkg:gem/rbs#lib/rbs/resolver/type_name_resolver.rb:37 def resolve(type_name, context:); end - # pkg:gem/rbs#lib/rbs/resolver/type_name_resolver.rb:104 + # pkg:gem/rbs#lib/rbs/resolver/type_name_resolver.rb:102 def resolve_head_namespace(head, context); end - # pkg:gem/rbs#lib/rbs/resolver/type_name_resolver.rb:62 + # pkg:gem/rbs#lib/rbs/resolver/type_name_resolver.rb:60 def resolve_namespace(type_name, context:); end - # pkg:gem/rbs#lib/rbs/resolver/type_name_resolver.rb:136 + # pkg:gem/rbs#lib/rbs/resolver/type_name_resolver.rb:134 def resolve_namespace0(type_name, context, visited); end - # pkg:gem/rbs#lib/rbs/resolver/type_name_resolver.rb:88 + # pkg:gem/rbs#lib/rbs/resolver/type_name_resolver.rb:86 def resolve_type_name(type_name, context); end # pkg:gem/rbs#lib/rbs/resolver/type_name_resolver.rb:32 - def try_cache(query); end + def try_cache(type_name, context); end class << self # pkg:gem/rbs#lib/rbs/resolver/type_name_resolver.rb:16 @@ -5773,31 +5822,31 @@ class RBS::TypeName # pkg:gem/rbs#lib/rbs/type_name.rb:9 def initialize(namespace:, name:); end - # pkg:gem/rbs#lib/rbs/type_name.rb:79 + # pkg:gem/rbs#lib/rbs/type_name.rb:105 def +(other); end - # pkg:gem/rbs#lib/rbs/type_name.rb:25 + # pkg:gem/rbs#lib/rbs/type_name.rb:50 def ==(other); end - # pkg:gem/rbs#lib/rbs/type_name.rb:55 + # pkg:gem/rbs#lib/rbs/type_name.rb:81 def absolute!; end - # pkg:gem/rbs#lib/rbs/type_name.rb:59 + # pkg:gem/rbs#lib/rbs/type_name.rb:85 def absolute?; end - # pkg:gem/rbs#lib/rbs/type_name.rb:51 + # pkg:gem/rbs#lib/rbs/type_name.rb:77 def alias?; end - # pkg:gem/rbs#lib/rbs/type_name.rb:47 + # pkg:gem/rbs#lib/rbs/type_name.rb:73 def class?; end - # pkg:gem/rbs#lib/rbs/type_name.rb:29 + # pkg:gem/rbs#lib/rbs/type_name.rb:55 def eql?(other); end - # pkg:gem/rbs#lib/rbs/type_name.rb:31 + # pkg:gem/rbs#lib/rbs/type_name.rb:57 def hash; end - # pkg:gem/rbs#lib/rbs/type_name.rb:67 + # pkg:gem/rbs#lib/rbs/type_name.rb:93 def interface?; end # pkg:gem/rbs#lib/rbs/type_name.rb:7 @@ -5809,26 +5858,34 @@ class RBS::TypeName # pkg:gem/rbs#lib/rbs/type_name.rb:5 def namespace; end - # pkg:gem/rbs#lib/rbs/type_name.rb:63 + # pkg:gem/rbs#lib/rbs/type_name.rb:89 def relative!; end - # pkg:gem/rbs#lib/rbs/type_name.rb:75 + # pkg:gem/rbs#lib/rbs/type_name.rb:101 def split; end - # pkg:gem/rbs#lib/rbs/type_name.rb:39 + # pkg:gem/rbs#lib/rbs/type_name.rb:65 def to_json(state = T.unsafe(nil)); end - # pkg:gem/rbs#lib/rbs/type_name.rb:43 + # pkg:gem/rbs#lib/rbs/type_name.rb:69 def to_namespace; end - # pkg:gem/rbs#lib/rbs/type_name.rb:35 + # pkg:gem/rbs#lib/rbs/type_name.rb:61 def to_s; end - # pkg:gem/rbs#lib/rbs/type_name.rb:71 + # pkg:gem/rbs#lib/rbs/type_name.rb:97 def with_prefix(namespace); end class << self - # pkg:gem/rbs#lib/rbs/type_name.rb:90 + # Returns a canonical `TypeName` instance for the given `namespace` / + # `name` pair. The namespace is canonicalized through `Namespace.[]` + # so identity-based lookup works regardless of the caller passing a + # fresh `Namespace.new` or an already-interned instance. + # + # pkg:gem/rbs#lib/rbs/type_name.rb:36 + def [](namespace, name); end + + # pkg:gem/rbs#lib/rbs/type_name.rb:113 def parse(string); end end end diff --git a/sorbet/rbi/gems/rubocop-gusto@10.10.0.rbi b/sorbet/rbi/gems/rubocop-gusto@11.3.0.rbi similarity index 59% rename from sorbet/rbi/gems/rubocop-gusto@10.10.0.rbi rename to sorbet/rbi/gems/rubocop-gusto@11.3.0.rbi index 62bdd1b..6518dd4 100644 --- a/sorbet/rbi/gems/rubocop-gusto@10.10.0.rbi +++ b/sorbet/rbi/gems/rubocop-gusto@11.3.0.rbi @@ -5,10 +5,6 @@ # Please instead update this file by running `bin/tapioca gem rubocop-gusto`. -# This cop enforces that polymorphic relations have a corresponding validation -# for their type field with an inclusion validation. This is required in order for Tapioca -# to generate correct Sorbet types -# # pkg:gem/rubocop-gusto#lib/rubocop/gusto/version.rb:3 module RuboCop; end @@ -18,118 +14,301 @@ module RuboCop::Cop; end # pkg:gem/rubocop-gusto#lib/rubocop/cop/gusto/bootsnap_load_file.rb:5 module RuboCop::Cop::Gusto; end -# Do not use Bootsnap to load files. Use `require` instead. +# Prefer `YAML.load_file`/`JSON.load_file` over reading a file and then +# parsing its contents. Bootsnap caches the parsed result of `load_file`, +# so this improves load time. +# +# @example +# # bad +# YAML.load(File.read("config.yml")) +# File.open("config.yml") { |f| YAML.load(f) } # -# pkg:gem/rubocop-gusto#lib/rubocop/cop/gusto/bootsnap_load_file.rb:7 +# # good +# YAML.load_file("config.yml") +# +# pkg:gem/rubocop-gusto#lib/rubocop/cop/gusto/bootsnap_load_file.rb:17 class RuboCop::Cop::Gusto::BootsnapLoadFile < ::RuboCop::Cop::Base - # pkg:gem/rubocop-gusto#lib/rubocop/cop/gusto/bootsnap_load_file.rb:15 + # pkg:gem/rubocop-gusto#lib/rubocop/cop/gusto/bootsnap_load_file.rb:25 def file_read(param0 = T.unsafe(nil)); end - # pkg:gem/rubocop-gusto#lib/rubocop/cop/gusto/bootsnap_load_file.rb:18 + # pkg:gem/rubocop-gusto#lib/rubocop/cop/gusto/bootsnap_load_file.rb:28 def load_inside_file_open(param0 = T.unsafe(nil)); end - # pkg:gem/rubocop-gusto#lib/rubocop/cop/gusto/bootsnap_load_file.rb:31 + # pkg:gem/rubocop-gusto#lib/rubocop/cop/gusto/bootsnap_load_file.rb:41 def on_block(node); end - # pkg:gem/rubocop-gusto#lib/rubocop/cop/gusto/bootsnap_load_file.rb:36 + # pkg:gem/rubocop-gusto#lib/rubocop/cop/gusto/bootsnap_load_file.rb:46 def on_itblock(node); end - # pkg:gem/rubocop-gusto#lib/rubocop/cop/gusto/bootsnap_load_file.rb:37 + # pkg:gem/rubocop-gusto#lib/rubocop/cop/gusto/bootsnap_load_file.rb:47 def on_numblock(node); end - # pkg:gem/rubocop-gusto#lib/rubocop/cop/gusto/bootsnap_load_file.rb:39 + # pkg:gem/rubocop-gusto#lib/rubocop/cop/gusto/bootsnap_load_file.rb:49 def on_send(node); end - # pkg:gem/rubocop-gusto#lib/rubocop/cop/gusto/bootsnap_load_file.rb:12 + # pkg:gem/rubocop-gusto#lib/rubocop/cop/gusto/bootsnap_load_file.rb:22 def yaml_or_json_load(param0 = T.unsafe(nil)); end private # Look for File.read as the first argument # - # pkg:gem/rubocop-gusto#lib/rubocop/cop/gusto/bootsnap_load_file.rb:48 + # pkg:gem/rubocop-gusto#lib/rubocop/cop/gusto/bootsnap_load_file.rb:58 def on_load(node, constant_node); end end -# pkg:gem/rubocop-gusto#lib/rubocop/cop/gusto/bootsnap_load_file.rb:8 +# pkg:gem/rubocop-gusto#lib/rubocop/cop/gusto/bootsnap_load_file.rb:18 RuboCop::Cop::Gusto::BootsnapLoadFile::PROHIBITED_CONSTANTS = T.let(T.unsafe(nil), Set) -# pkg:gem/rubocop-gusto#lib/rubocop/cop/gusto/bootsnap_load_file.rb:9 +# pkg:gem/rubocop-gusto#lib/rubocop/cop/gusto/bootsnap_load_file.rb:19 RuboCop::Cop::Gusto::BootsnapLoadFile::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array) -# pkg:gem/rubocop-gusto#lib/rubocop/cop/gusto/datadog_constant.rb:6 +# Disallow referencing the `Datadog` constant directly. Calls should go +# through an approved wrapper library so instrumentation stays consistent +# and swappable. +# +# @example +# # bad +# Datadog::Tracing.active_trace +# +# # good +# Observability.active_trace +# +# pkg:gem/rubocop-gusto#lib/rubocop/cop/gusto/datadog_constant.rb:16 class RuboCop::Cop::Gusto::DatadogConstant < ::RuboCop::Cop::Base - # pkg:gem/rubocop-gusto#lib/rubocop/cop/gusto/datadog_constant.rb:10 + # pkg:gem/rubocop-gusto#lib/rubocop/cop/gusto/datadog_constant.rb:20 def on_const(node); end end -# pkg:gem/rubocop-gusto#lib/rubocop/cop/gusto/datadog_constant.rb:7 +# pkg:gem/rubocop-gusto#lib/rubocop/cop/gusto/datadog_constant.rb:17 RuboCop::Cop::Gusto::DatadogConstant::MSG = T.let(T.unsafe(nil), String) -# pkg:gem/rubocop-gusto#lib/rubocop/cop/gusto/datadog_constant.rb:8 +# pkg:gem/rubocop-gusto#lib/rubocop/cop/gusto/datadog_constant.rb:18 RuboCop::Cop::Gusto::DatadogConstant::NAMESPACE = T.let(T.unsafe(nil), String) -# Flags installation of discouraged gems (e.g., timecop) in Gemfiles and gemspecs. +# Flags constants that are scoped through `described_class`, e.g. +# `described_class::Worker`. +# +# `described_class` is an RSpec helper method resolved at runtime, so +# Sorbet's static analysis treats `described_class::Worker` as a dynamic +# constant reference and cannot resolve it (`Dynamic constant references +# are unsupported`, https://srb.help/5001). Reference the constant by its +# fully-qualified name instead. A bare `described_class` (with no `::` +# constant lookup) is an ordinary method call and is left alone. +# +# Autocorrection replaces `described_class` with the constant that the +# enclosing example group describes. It is marked unsafe +# (`SafeAutoCorrect: false`) because the rewrite relies on the described +# constant being a statically-written name; review the result before +# committing. In particular, a constant defined on an *ancestor* of the +# described class is qualified against the described class itself, which +# is correct at runtime but which Sorbet cannot resolve through the +# inheritance chain -- re-point those to the defining ancestor by hand. +# +# @example +# # bad +# RSpec.describe Payments::Processor do +# describe described_class::Worker do +# end +# end +# +# # good +# RSpec.describe Payments::Processor do +# describe Payments::Processor::Worker do +# end +# end # -# Configuration: -# Gems: -# timecop: "Use Rails' time helpers (e.g., freeze_time, travel_to) instead of Timecop." +# # good - `RSpec.describe self` resolves to the enclosing namespace +# module Payments +# RSpec.describe self do +# it { expect(Payments::TIMEOUT).to eq(5) } +# end +# end # -# This cop is intended to be enabled in Rails projects via config/rails.yml. +# # good - a bare `described_class` is not a constant reference +# RSpec.describe Payments::Processor do +# subject { described_class.new } +# end # -# pkg:gem/rubocop-gusto#lib/rubocop/cop/gusto/discouraged_gem.rb:13 +# pkg:gem/rubocop-gusto#lib/rubocop/cop/gusto/described_class_constant_reference.rb:49 +class RuboCop::Cop::Gusto::DescribedClassConstantReference < ::RuboCop::Cop::Base + extend ::RuboCop::Cop::AutoCorrector + + # pkg:gem/rubocop-gusto#lib/rubocop/cop/gusto/described_class_constant_reference.rb:58 + def const_scoped_on_described_class?(param0 = T.unsafe(nil)); end + + # pkg:gem/rubocop-gusto#lib/rubocop/cop/gusto/described_class_constant_reference.rb:66 + def example_group_described_argument(param0 = T.unsafe(nil)); end + + # pkg:gem/rubocop-gusto#lib/rubocop/cop/gusto/described_class_constant_reference.rb:80 + def on_const(node); end + + # pkg:gem/rubocop-gusto#lib/rubocop/cop/gusto/described_class_constant_reference.rb:76 + def scoped_through_described_class?(param0); end + + private + + # The fully-qualified name (as a String) that `described_class` resolves + # to lexically, from the nearest enclosing example group, or nil if it + # cannot be determined statically. + # + # - `describe SomeClass` resolves to that constant's written name. + # - `describe self` resolves to the enclosing module/class namespace. + # - `describe described_class::X` qualifies the describe argument itself + # against the outer group; a reference in such a group's *body* resolves + # at runtime to the scoped (statically unknown) class, so we decline to + # autocorrect it. Once the enclosing `described_class::X` is rewritten, + # a later pass resolves the body reference correctly. + # - Any other describe argument (e.g. a string) is skipped, and the + # search continues at the next enclosing example group. + # + # pkg:gem/rubocop-gusto#lib/rubocop/cop/gusto/described_class_constant_reference.rb:105 + def described_class_replacement(node); end + + # The fully-qualified name of the module/class lexically enclosing the + # example group, which is what `self` refers to in `RSpec.describe self`. + # + # pkg:gem/rubocop-gusto#lib/rubocop/cop/gusto/described_class_constant_reference.rb:123 + def enclosing_namespace(block_node); end + + # Whether the offending constant is the described constant itself (the + # describe argument) rather than a reference inside the group's body. + # + # pkg:gem/rubocop-gusto#lib/rubocop/cop/gusto/described_class_constant_reference.rb:132 + def reference_within_described_constant?(described_constant, node); end +end + +# pkg:gem/rubocop-gusto#lib/rubocop/cop/gusto/described_class_constant_reference.rb:52 +RuboCop::Cop::Gusto::DescribedClassConstantReference::MSG = T.let(T.unsafe(nil), String) + +# Flag installation of discouraged gems (e.g. timecop) in Gemfiles and +# gemspecs. The discouraged gems an advice about alternatives are configured under +# `Gems:`; intended to be enabled in Rails projects via config/rails.yml. +# +# @example Gems: { timecop: "Use Rails' time helpers instead of Timecop." } +# # bad +# gem "timecop" +# +# # good +# # Use Rails' time helpers (freeze_time, travel_to) instead. +# +# pkg:gem/rubocop-gusto#lib/rubocop/cop/gusto/discouraged_gem.rb:16 class RuboCop::Cop::Gusto::DiscouragedGem < ::RuboCop::Cop::Base - # pkg:gem/rubocop-gusto#lib/rubocop/cop/gusto/discouraged_gem.rb:18 + # pkg:gem/rubocop-gusto#lib/rubocop/cop/gusto/discouraged_gem.rb:21 def on_send(node); end private - # pkg:gem/rubocop-gusto#lib/rubocop/cop/gusto/discouraged_gem.rb:40 + # pkg:gem/rubocop-gusto#lib/rubocop/cop/gusto/discouraged_gem.rb:43 def advice_for(gem); end - # pkg:gem/rubocop-gusto#lib/rubocop/cop/gusto/discouraged_gem.rb:24 + # pkg:gem/rubocop-gusto#lib/rubocop/cop/gusto/discouraged_gem.rb:27 def check_gem_usage(node); end - # pkg:gem/rubocop-gusto#lib/rubocop/cop/gusto/discouraged_gem.rb:32 + # pkg:gem/rubocop-gusto#lib/rubocop/cop/gusto/discouraged_gem.rb:35 def discouraged_gems; end - # pkg:gem/rubocop-gusto#lib/rubocop/cop/gusto/discouraged_gem.rb:44 + # pkg:gem/rubocop-gusto#lib/rubocop/cop/gusto/discouraged_gem.rb:47 def gems_config; end - # pkg:gem/rubocop-gusto#lib/rubocop/cop/gusto/discouraged_gem.rb:36 + # pkg:gem/rubocop-gusto#lib/rubocop/cop/gusto/discouraged_gem.rb:39 def message_for(gem); end end -# pkg:gem/rubocop-gusto#lib/rubocop/cop/gusto/discouraged_gem.rb:14 +# pkg:gem/rubocop-gusto#lib/rubocop/cop/gusto/discouraged_gem.rb:17 RuboCop::Cop::Gusto::DiscouragedGem::MSG = T.let(T.unsafe(nil), String) -# pkg:gem/rubocop-gusto#lib/rubocop/cop/gusto/discouraged_gem.rb:16 +# pkg:gem/rubocop-gusto#lib/rubocop/cop/gusto/discouraged_gem.rb:19 RuboCop::Cop::Gusto::DiscouragedGem::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array) -# pkg:gem/rubocop-gusto#lib/rubocop/cop/gusto/execute_migration.rb:6 +# Disallow `execute` (raw SQL) in migrations. Run raw SQL from a backfill +# rake task, or pass SQL options to `add_column`/`change_column` instead, +# so migrations stay reversible and schema-focused. +# +# @example +# # bad +# def up +# execute("UPDATE users SET active = true") +# end +# +# # good +# def up +# add_column :users, :active, :boolean, default: true +# end +# +# pkg:gem/rubocop-gusto#lib/rubocop/cop/gusto/execute_migration.rb:20 class RuboCop::Cop::Gusto::ExecuteMigration < ::RuboCop::Cop::Base - # pkg:gem/rubocop-gusto#lib/rubocop/cop/gusto/execute_migration.rb:10 + # pkg:gem/rubocop-gusto#lib/rubocop/cop/gusto/execute_migration.rb:24 def on_send(node); end end -# pkg:gem/rubocop-gusto#lib/rubocop/cop/gusto/execute_migration.rb:7 +# pkg:gem/rubocop-gusto#lib/rubocop/cop/gusto/execute_migration.rb:21 RuboCop::Cop::Gusto::ExecuteMigration::MSG = T.let(T.unsafe(nil), String) -# pkg:gem/rubocop-gusto#lib/rubocop/cop/gusto/execute_migration.rb:8 +# pkg:gem/rubocop-gusto#lib/rubocop/cop/gusto/execute_migration.rb:22 RuboCop::Cop::Gusto::ExecuteMigration::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array) -# pkg:gem/rubocop-gusto#lib/rubocop/cop/gusto/factory_classes_or_modules.rb:6 +# Disallow defining classes or modules in factory directories. They break +# Rails autoloading/reloading; define shared helpers outside the factories. +# +# @example +# # bad +# # spec/factories/users.rb +# class UserHelper +# end +# +# FactoryBot.define do +# factory :user +# end +# +# # good +# # spec/factories/users.rb +# FactoryBot.define do +# factory :user +# end +# +# pkg:gem/rubocop-gusto#lib/rubocop/cop/gusto/factory_classes_or_modules.rb:24 class RuboCop::Cop::Gusto::FactoryClassesOrModules < ::RuboCop::Cop::Base - # pkg:gem/rubocop-gusto#lib/rubocop/cop/gusto/factory_classes_or_modules.rb:9 + # pkg:gem/rubocop-gusto#lib/rubocop/cop/gusto/factory_classes_or_modules.rb:27 def on_class(node); end - # pkg:gem/rubocop-gusto#lib/rubocop/cop/gusto/factory_classes_or_modules.rb:13 + # pkg:gem/rubocop-gusto#lib/rubocop/cop/gusto/factory_classes_or_modules.rb:31 def on_module(node); end end -# pkg:gem/rubocop-gusto#lib/rubocop/cop/gusto/factory_classes_or_modules.rb:7 +# pkg:gem/rubocop-gusto#lib/rubocop/cop/gusto/factory_classes_or_modules.rb:25 RuboCop::Cop::Gusto::FactoryClassesOrModules::MSG = T.let(T.unsafe(nil), String) +# Enforces that `FeatureFlag.active?` is called with a constant rather than a +# string literal. Defining flag keys as constants keeps them in one place, +# makes typos a load-time error instead of a silent always-off flag, and lets +# tools find every reference to a flag. +# +# `FeatureFlag` is a constant, so it is never nil and safe navigation +# (`FeatureFlag&.active?`) is never used; the cop only handles `on_send`. +# +# @example +# # bad +# FeatureFlag.active?("some_feature_flag") +# +# # good +# FeatureFlag.active?(SomeModule::SOME_FEATURE_FLAG) +# +# pkg:gem/rubocop-gusto#lib/rubocop/cop/gusto/feature_flag_constants.rb:20 +class RuboCop::Cop::Gusto::FeatureFlagConstants < ::RuboCop::Cop::Base + # pkg:gem/rubocop-gusto#lib/rubocop/cop/gusto/feature_flag_constants.rb:25 + def feature_flag_with_string?(param0 = T.unsafe(nil)); end + + # pkg:gem/rubocop-gusto#lib/rubocop/cop/gusto/feature_flag_constants.rb:29 + def on_send(node); end +end + +# pkg:gem/rubocop-gusto#lib/rubocop/cop/gusto/feature_flag_constants.rb:21 +RuboCop::Cop::Gusto::FeatureFlagConstants::MSG = T.let(T.unsafe(nil), String) + +# pkg:gem/rubocop-gusto#lib/rubocop/cop/gusto/feature_flag_constants.rb:22 +RuboCop::Cop::Gusto::FeatureFlagConstants::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array) + # Checks for the use of `min` or `max` with a proc. Corrects to `min_by` or `max_by`. # # @safety This cop is unsafe because it will change the behavior of the code. @@ -332,16 +511,26 @@ RuboCop::Cop::Gusto::NoSend::MSG = T.let(T.unsafe(nil), String) # pkg:gem/rubocop-gusto#lib/rubocop/cop/gusto/no_send.rb:18 RuboCop::Cop::Gusto::NoSend::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array) -# pkg:gem/rubocop-gusto#lib/rubocop/cop/gusto/paperclip_or_attachable.rb:7 +# Disallow new Paperclip / Attachable attachments. New attachments should +# use ActiveStorage instead. +# +# @example +# # bad +# has_attached_file :avatar +# +# # good +# has_one_attached :avatar +# +# pkg:gem/rubocop-gusto#lib/rubocop/cop/gusto/paperclip_or_attachable.rb:16 class RuboCop::Cop::Gusto::PaperclipOrAttachable < ::RuboCop::Cop::Base - # pkg:gem/rubocop-gusto#lib/rubocop/cop/gusto/paperclip_or_attachable.rb:11 + # pkg:gem/rubocop-gusto#lib/rubocop/cop/gusto/paperclip_or_attachable.rb:20 def on_send(node); end end -# pkg:gem/rubocop-gusto#lib/rubocop/cop/gusto/paperclip_or_attachable.rb:8 +# pkg:gem/rubocop-gusto#lib/rubocop/cop/gusto/paperclip_or_attachable.rb:17 RuboCop::Cop::Gusto::PaperclipOrAttachable::MSG = T.let(T.unsafe(nil), String) -# pkg:gem/rubocop-gusto#lib/rubocop/cop/gusto/paperclip_or_attachable.rb:9 +# pkg:gem/rubocop-gusto#lib/rubocop/cop/gusto/paperclip_or_attachable.rb:18 RuboCop::Cop::Gusto::PaperclipOrAttachable::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array) # Checks for a defined `.perform` class method in Sidekiq workers. These @@ -398,34 +587,99 @@ RuboCop::Cop::Gusto::PerformClassMethod::WORKER_FALLBACK = T.let(T.unsafe(nil), # pkg:gem/rubocop-gusto#lib/rubocop/cop/gusto/perform_class_method.rb:31 RuboCop::Cop::Gusto::PerformClassMethod::WORKER_MODULES = T.let(T.unsafe(nil), String) -# pkg:gem/rubocop-gusto#lib/rubocop/cop/gusto/polymorphic_type_validation.rb:9 +# Do not use `.pluck` on `.select`. +# +# `.select` returns an ActiveRecord relation with only the selected columns marked for +# retrieval. `.pluck` returns an array of column values. When chained, `.pluck` is unaware +# of any directive passed to `.select` (e.g. column aliases or a DISTINCT clause), which +# can cause unexpected behavior. +# +# @example Redundant select +# # bad +# User.select(:id).pluck(:id) +# +# # good +# User.pluck(:id) +# +# @example Column alias: .pluck raises "Unknown column" because it ignores the alias +# # bad +# User.select('id AS id2').pluck('id2') +# +# # good: use .select alone if you need the alias +# User.select(:id, 'id AS id2') +# +# # good: use .pluck alone if you don't need the alias +# User.pluck(:id) +# +# @example DISTINCT: .pluck loads all rows, ignoring the DISTINCT from .select +# # bad +# User.select('DISTINCT email').pluck(:email) +# +# # good +# User.distinct.pluck(:email) +# +# pkg:gem/rubocop-gusto#lib/rubocop/cop/gusto/pluck_on_select.rb:37 +class RuboCop::Cop::Gusto::PluckOnSelect < ::RuboCop::Cop::Base + # pkg:gem/rubocop-gusto#lib/rubocop/cop/gusto/pluck_on_select.rb:53 + def on_csend(node); end + + # pkg:gem/rubocop-gusto#lib/rubocop/cop/gusto/pluck_on_select.rb:41 + def on_send(node); end +end + +# pkg:gem/rubocop-gusto#lib/rubocop/cop/gusto/pluck_on_select.rb:39 +RuboCop::Cop::Gusto::PluckOnSelect::MSG = T.let(T.unsafe(nil), String) + +# pkg:gem/rubocop-gusto#lib/rubocop/cop/gusto/pluck_on_select.rb:38 +RuboCop::Cop::Gusto::PluckOnSelect::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array) + +# Require polymorphic relations to validate their `*_type` field with an +# inclusion validation (or `polymorphic_methods_for`). This is needed for +# Tapioca to generate correct Sorbet types. +# +# @example +# # bad +# belongs_to :subscription_detail, polymorphic: true +# +# # good +# VALID_TYPES = T.let([Foo.polymorphic_name, Bar.polymorphic_name].freeze, T::Array[String]) +# belongs_to :subscription_detail, polymorphic: true +# validates :subscription_detail_type, presence: true, inclusion: { in: VALID_TYPES } +# +# # also good +# include PolymorphicCallable +# VALID_TYPES = T.let([Foo.polymorphic_name, Bar.polymorphic_name].freeze, T::Array[String]) +# belongs_to :subscription_detail, polymorphic: true +# polymorphic_methods_for :subscription_detail, VALID_TYPES +# +# pkg:gem/rubocop-gusto#lib/rubocop/cop/gusto/polymorphic_type_validation.rb:24 class RuboCop::Cop::Gusto::PolymorphicTypeValidation < ::RuboCop::Cop::Base - # pkg:gem/rubocop-gusto#lib/rubocop/cop/gusto/polymorphic_type_validation.rb:54 + # pkg:gem/rubocop-gusto#lib/rubocop/cop/gusto/polymorphic_type_validation.rb:69 def allow_blank?(param0 = T.unsafe(nil)); end - # pkg:gem/rubocop-gusto#lib/rubocop/cop/gusto/polymorphic_type_validation.rb:44 + # pkg:gem/rubocop-gusto#lib/rubocop/cop/gusto/polymorphic_type_validation.rb:59 def inclusion_in?(param0 = T.unsafe(nil)); end - # pkg:gem/rubocop-gusto#lib/rubocop/cop/gusto/polymorphic_type_validation.rb:58 + # pkg:gem/rubocop-gusto#lib/rubocop/cop/gusto/polymorphic_type_validation.rb:73 def on_send(node); end - # pkg:gem/rubocop-gusto#lib/rubocop/cop/gusto/polymorphic_type_validation.rb:49 + # pkg:gem/rubocop-gusto#lib/rubocop/cop/gusto/polymorphic_type_validation.rb:64 def polymorphic_methods_for?(param0 = T.unsafe(nil)); end - # pkg:gem/rubocop-gusto#lib/rubocop/cop/gusto/polymorphic_type_validation.rb:34 + # pkg:gem/rubocop-gusto#lib/rubocop/cop/gusto/polymorphic_type_validation.rb:49 def polymorphic_relation?(param0 = T.unsafe(nil)); end - # pkg:gem/rubocop-gusto#lib/rubocop/cop/gusto/polymorphic_type_validation.rb:39 + # pkg:gem/rubocop-gusto#lib/rubocop/cop/gusto/polymorphic_type_validation.rb:54 def type_validation?(param0 = T.unsafe(nil)); end end -# pkg:gem/rubocop-gusto#lib/rubocop/cop/gusto/polymorphic_type_validation.rb:31 +# pkg:gem/rubocop-gusto#lib/rubocop/cop/gusto/polymorphic_type_validation.rb:46 RuboCop::Cop::Gusto::PolymorphicTypeValidation::ALLOW_BLANK_MSG = T.let(T.unsafe(nil), String) -# pkg:gem/rubocop-gusto#lib/rubocop/cop/gusto/polymorphic_type_validation.rb:12 +# pkg:gem/rubocop-gusto#lib/rubocop/cop/gusto/polymorphic_type_validation.rb:27 RuboCop::Cop::Gusto::PolymorphicTypeValidation::MSG = T.let(T.unsafe(nil), String) -# pkg:gem/rubocop-gusto#lib/rubocop/cop/gusto/polymorphic_type_validation.rb:10 +# pkg:gem/rubocop-gusto#lib/rubocop/cop/gusto/polymorphic_type_validation.rb:25 RuboCop::Cop::Gusto::PolymorphicTypeValidation::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array) # Don't use the `$?` or `$CHILD_STATUS` global variables. Instead, use `Process.last_status` @@ -492,57 +746,6 @@ RuboCop::Cop::Gusto::RablExtends::RABL_EXTENSION = T.let(T.unsafe(nil), String) # pkg:gem/rubocop-gusto#lib/rubocop/cop/gusto/rabl_extends.rb:24 RuboCop::Cop::Gusto::RablExtends::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array) -# NOTE: Being pushed upstream here: https://github.com/rubocop/rubocop-rails/pull/1375 -# Checks for usage of `Rails.env` which can be replaced with Feature Flags -# -# Although `local?` is a form of an environment-specific check, it is allowed because -# it cannot be used to control overall environment rollout, but it can be helpful to -# distinguish or protect code that is explicitly written to only ever execute in a -# dev or test environment. `local?` is also a form of a feature flag. -# -# @example -# -# # bad -# Rails.env.production? || Rails.env.demo? -# -# # good -# if FeatureFlag.enabled?(:new_feature) -# # new feature code -# end -# -# # good -# raise unless Rails.env.local? -# -# # good -# abort ("The Rails environment is running in production mode!") unless Rails.env.local? -# -# pkg:gem/rubocop-gusto#lib/rubocop/cop/gusto/rails_env.rb:30 -class RuboCop::Cop::Gusto::RailsEnv < ::RuboCop::Cop::Base - # pkg:gem/rubocop-gusto#lib/rubocop/cop/gusto/rails_env.rb:65 - def on_send(node); end - - # pkg:gem/rubocop-gusto#lib/rubocop/cop/gusto/rails_env.rb:58 - def prohibited_rails_env?(param0 = T.unsafe(nil)); end - - private - - # pkg:gem/rubocop-gusto#lib/rubocop/cop/gusto/rails_env.rb:71 - def prohibited_predicate?(name); end -end - -# This allow list is derived from: -# (Rails.env.methods - Object.instance_methods).select { |m| m.to_s.end_with?('?') } -# and then removing the environment specific methods like development?, test?, production? -# -# pkg:gem/rubocop-gusto#lib/rubocop/cop/gusto/rails_env.rb:34 -RuboCop::Cop::Gusto::RailsEnv::ALLOWED_LIST = T.let(T.unsafe(nil), Set) - -# pkg:gem/rubocop-gusto#lib/rubocop/cop/gusto/rails_env.rb:54 -RuboCop::Cop::Gusto::RailsEnv::MSG = T.let(T.unsafe(nil), String) - -# pkg:gem/rubocop-gusto#lib/rubocop/cop/gusto/rails_env.rb:55 -RuboCop::Cop::Gusto::RailsEnv::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array) - # Detects constants in a rake file because they are defined at the top level. # It is confusing because the scope looks like it would be in the task or namespace, # but actually it is defined at the top level. @@ -692,18 +895,60 @@ RuboCop::Cop::Gusto::RspecDateTimeMock::MSG = T.let(T.unsafe(nil), String) # pkg:gem/rubocop-gusto#lib/rubocop/cop/gusto/rspec_date_time_mock.rb:34 RuboCop::Cop::Gusto::RspecDateTimeMock::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array) -# pkg:gem/rubocop-gusto#lib/rubocop/cop/gusto/sidekiq_params.rb:6 +# Disallow keyword arguments on Sidekiq `perform` methods. Sidekiq +# serializes job arguments as JSON and replays them positionally, so +# keyword arguments are not preserved. +# +# @example +# # bad +# def perform(user_id:, force: false) +# end +# +# # good +# def perform(user_id, force = false) +# end +# +# pkg:gem/rubocop-gusto#lib/rubocop/cop/gusto/sidekiq_params.rb:18 class RuboCop::Cop::Gusto::SidekiqParams < ::RuboCop::Cop::Base - # pkg:gem/rubocop-gusto#lib/rubocop/cop/gusto/sidekiq_params.rb:14 + # pkg:gem/rubocop-gusto#lib/rubocop/cop/gusto/sidekiq_params.rb:26 def on_def(node); end - # pkg:gem/rubocop-gusto#lib/rubocop/cop/gusto/sidekiq_params.rb:10 + # pkg:gem/rubocop-gusto#lib/rubocop/cop/gusto/sidekiq_params.rb:22 def perform_with_kwargs?(param0 = T.unsafe(nil)); end end -# pkg:gem/rubocop-gusto#lib/rubocop/cop/gusto/sidekiq_params.rb:7 +# pkg:gem/rubocop-gusto#lib/rubocop/cop/gusto/sidekiq_params.rb:19 RuboCop::Cop::Gusto::SidekiqParams::MSG = T.let(T.unsafe(nil), String) +# Enforces SmartTodo syntax (via the upstream `SmartTodo/SmartTodoCop`) and, +# in addition, requires every TODO's `to:` assignee to name a valid team as +# defined by CodeTeams (`config/teams/**/*.yml`). +# +# All of the upstream cop's failure modes are preserved verbatim via `super`. +# The only additional offense is raised when an otherwise-valid SmartTodo +# comment is assigned to an unknown team. +# +# @example +# # bad - assigned to an unknown team +# # TODO(on: date('2025-01-01'), to: 'NotATeam') +# # Remove this +# +# # good - assigned to a team in config/teams +# # TODO(on: date('2025-01-01'), to: 'Payroll') +# # Remove this +# +# pkg:gem/rubocop-gusto#lib/rubocop/cop/gusto/smart_todo_team.rb:25 +class RuboCop::Cop::Gusto::SmartTodoTeam < ::RuboCop::Cop::SmartTodo::SmartTodoCop + # @param processed_source [RuboCop::ProcessedSource] + # @return [void] + # + # pkg:gem/rubocop-gusto#lib/rubocop/cop/gusto/smart_todo_team.rb:30 + def on_new_investigation; end +end + +# pkg:gem/rubocop-gusto#lib/rubocop/cop/gusto/smart_todo_team.rb:26 +RuboCop::Cop::Gusto::SmartTodoTeam::TEAM_HELP = T.let(T.unsafe(nil), String) + # Checks that no top-level constants (excluding classes and modules) # are defined. This rule exists to prevent accidental pollution of the # global namespace as well as cases where application code has @@ -748,6 +993,210 @@ end # pkg:gem/rubocop-gusto#lib/rubocop/cop/gusto/toplevel_constants.rb:42 RuboCop::Cop::Gusto::ToplevelConstants::MSG = T.let(T.unsafe(nil), String) +# Flags lazy `let` declarations whose name is never referenced. A lazy `let(:name) { ... }` +# is only evaluated when `name` is called, so an unreferenced one is dead code -- its block +# never runs -- and is deleted. +# +# Eager `let!` is intentionally out of scope: it runs its block before every example for its +# side effect even when unreferenced, so it cannot simply be deleted. Only plain `let` is +# handled here. +# +# Detection is file-scoped: a `let` referenced only from another file (through a shared +# example or an included test harness) cannot be seen, so the cop stays conservative and +# prefers false negatives over false positives: +# - a name defined more than once in the file by `let`/`let!`/`subject` (an override / +# `super` chain, including a `subject` that overrides a `let` of the same name) is never +# flagged; +# - a `let` declared lexically inside a `shared_examples` / `shared_examples_for` / +# `shared_context` block is skipped (its consumers live in other files); +# - every `let` in a file that uses `it_behaves_like` / `it_should_behave_like` / +# `include_examples` / `include_context` is skipped, because an included shared block may +# reference the binding by a name we cannot follow statically; +# - any `let` whose name is also defined as a `let`/`subject` in a `spec/support/**` helper is +# skipped, because it is almost certainly overriding a contract an included harness consumes; +# - `let(:cop_config)` is skipped: it is a rubocop-rspec contract consumed by the `:config` +# shared context, not by a reference in the spec file; and +# - every `let` in a file that reflectively dispatches through a name we cannot resolve +# statically (e.g. `send("expected_#{type}")`) is skipped, since any `let` could be the +# target. +# A name counts as referenced if it is called bare (`foo`), appears as a symbol (`:foo`) +# anywhere but the let's own name argument, or appears as an identifier-shaped token inside +# any string/heredoc literal -- covering dynamic dispatch, `:foo` entries in data tables the +# spec later dispatches on, and bindings named only inside raw SQL/GraphQL text. +# +# Because a bare `:foo` symbol anywhere counts as a reference, commonly-named lets +# (`let(:user)`, `let(:company)`, `let(:id)`) are essentially never flagged -- `create(:user)`, +# `:name` hash keys, and the like saturate the file. This conservative bias means the cop +# realistically only deletes distinctively-named dead lets; it is not a complete dead-`let` +# finder. +# +# @example +# # bad (name never referenced -- deleted, the block never runs) +# let(:unused) { create(:thing) } +# +# # good +# let(:thing) { create(:thing) } +# it { expect(thing).to be_present } +# +# pkg:gem/rubocop-gusto#lib/rubocop/cop/gusto/unreferenced_let.rb:54 +class RuboCop::Cop::Gusto::UnreferencedLet < ::RuboCop::Cop::RSpec::Base + include ::RuboCop::Cop::RangeHelp + extend ::RuboCop::Cop::AutoCorrector + + # pkg:gem/rubocop-gusto#lib/rubocop/cop/gusto/unreferenced_let.rb:83 + def definition_name(param0 = T.unsafe(nil)); end + + # pkg:gem/rubocop-gusto#lib/rubocop/cop/gusto/unreferenced_let.rb:133 + def on_send(node); end + + private + + # pkg:gem/rubocop-gusto#lib/rubocop/cop/gusto/unreferenced_let.rb:193 + def absorbable_comment?(source_line); end + + # pkg:gem/rubocop-gusto#lib/rubocop/cop/gusto/unreferenced_let.rb:198 + def blank_line?(source_line); end + + # pkg:gem/rubocop-gusto#lib/rubocop/cop/gusto/unreferenced_let.rb:218 + def consumes_shared_examples?; end + + # pkg:gem/rubocop-gusto#lib/rubocop/cop/gusto/unreferenced_let.rb:277 + def definition_name_argument?(sym_node); end + + # pkg:gem/rubocop-gusto#lib/rubocop/cop/gusto/unreferenced_let.rb:243 + def definitions_by_name; end + + # True when the file reflectively dispatches through a name we cannot resolve statically -- + # `send`/`public_send`/`method`/etc. called with anything other than a `sym` or plain `str` + # first argument (most commonly an interpolated string, `send("expected_#{type}")`). In + # that case any `let` in the file could be the dispatch target, so none are deleted. + # + # pkg:gem/rubocop-gusto#lib/rubocop/cop/gusto/unreferenced_let.rb:228 + def dynamic_dispatch?; end + + # A lazy `let` is exempt from deletion whenever file-scoped analysis cannot prove its name + # is dead: its name is a framework-reserved contract (e.g. `cop_config`), the file + # dispatches through a name we cannot resolve statically, it consumes shared examples, the + # `let` is lexically inside a shared-example definition, its name is a `spec/support/**` + # framework contract, it is overridden by another definition of the same name, or it is + # referenced somewhere in the file. + # + # pkg:gem/rubocop-gusto#lib/rubocop/cop/gusto/unreferenced_let.rb:158 + def exempt_from_deletion?(name, block); end + + # pkg:gem/rubocop-gusto#lib/rubocop/cop/gusto/unreferenced_let.rb:202 + def let_or_subject_line?(source_line); end + + # pkg:gem/rubocop-gusto#lib/rubocop/cop/gusto/unreferenced_let.rb:239 + def overridden?(name); end + + # pkg:gem/rubocop-gusto#lib/rubocop/cop/gusto/unreferenced_let.rb:206 + def preceding_sig(node); end + + # pkg:gem/rubocop-gusto#lib/rubocop/cop/gusto/unreferenced_let.rb:250 + def referenced?(name); end + + # A name is "referenced" if it is called as a bare method (`foo`), appears as a symbol + # literal (`:foo`) other than the let/subject's own name argument, or appears as an + # identifier-shaped token inside any string/heredoc literal. The symbol and string cases + # cover indirect invocation -- `send(:foo)` / `send("foo")`, a `:foo`/`"foo"` listed in a + # data table the spec later dispatches on, or a binding named only inside raw SQL/GraphQL + # text the spec executes -- which file-scoped analysis cannot otherwise follow. (Tokenizing + # string bodies, rather than matching the whole string, keeps a `let` referenced only from + # inside a multi-word heredoc from being deleted.) Interpolated-string *dispatch* is handled + # separately by `dynamic_dispatch?`, which exempts the whole file. + # + # pkg:gem/rubocop-gusto#lib/rubocop/cop/gusto/unreferenced_let.rb:263 + def referenced_names; end + + # Delete the `let` block, plus: + # - an immediately-preceding `sig { ... }` (so a Sorbet signature is not left dangling), + # - explanatory comment lines attached directly above it (so they are not orphaned), and + # - a single trailing blank line where removal would otherwise leave a stray/duplicate + # blank -- unless the line above is a `let`/`subject`, where that blank is the required + # separator after the now-final let and must stay. + # + # pkg:gem/rubocop-gusto#lib/rubocop/cop/gusto/unreferenced_let.rb:174 + def removal_range(node); end + + # pkg:gem/rubocop-gusto#lib/rubocop/cop/gusto/unreferenced_let.rb:214 + def within_shared_definition?(node); end + + class << self + # pkg:gem/rubocop-gusto#lib/rubocop/cop/gusto/unreferenced_let.rb:121 + def extract_let_names(source, names); end + + # Names defined as `let`/`subject` anywhere under `spec/support/**`. Computed once per + # process (lazily, after boot) and shared across every file the cop inspects. + # + # pkg:gem/rubocop-gusto#lib/rubocop/cop/gusto/unreferenced_let.rb:90 + def framework_let_names; end + + # pkg:gem/rubocop-gusto#lib/rubocop/cop/gusto/unreferenced_let.rb:106 + def git_tracked_support_files; end + + # pkg:gem/rubocop-gusto#lib/rubocop/cop/gusto/unreferenced_let.rb:126 + def read_source(path); end + + # pkg:gem/rubocop-gusto#lib/rubocop/cop/gusto/unreferenced_let.rb:115 + def scan_framework_let_names(paths); end + + # Enumerate `spec/support/**/*.rb`. Prefer `git ls-files` (reads the git index, skipping + # untracked trees like `node_modules`): a leading-`**` `Dir.glob` walks the entire + # repository and costs seconds, while reading the index costs tens of milliseconds. Fall + # back to `Dir.glob` when not in a git work tree or `git` is unavailable. + # + # Tradeoff: an untracked (brand-new, uncommitted) `spec/support/*.rb` override is invisible + # to `git ls-files`. In that narrow window its contract names are not exempted; once + # committed it is seen like any other support file. + # + # pkg:gem/rubocop-gusto#lib/rubocop/cop/gusto/unreferenced_let.rb:102 + def support_file_paths; end + end +end + +# pkg:gem/rubocop-gusto#lib/rubocop/cop/gusto/unreferenced_let.rb:58 +RuboCop::Cop::Gusto::UnreferencedLet::DEFINITION_METHODS = T.let(T.unsafe(nil), Set) + +# Reflective dispatch methods whose target is the first argument. When that argument is not +# a statically-resolvable name (a `sym` or plain `str`) -- e.g. `send("expected_#{type}")` -- +# the called name cannot be known, so the whole file is left untouched. +# +# pkg:gem/rubocop-gusto#lib/rubocop/cop/gusto/unreferenced_let.rb:66 +RuboCop::Cop::Gusto::UnreferencedLet::DYNAMIC_DISPATCH_METHODS = T.let(T.unsafe(nil), Array) + +# pkg:gem/rubocop-gusto#lib/rubocop/cop/gusto/unreferenced_let.rb:67 +RuboCop::Cop::Gusto::UnreferencedLet::FRAMEWORK_LET_PATTERN = T.let(T.unsafe(nil), Regexp) + +# `let`s consumed by a test framework rather than by a reference in the spec file. The +# rubocop-rspec `:config` shared context reads `cop_config`, so it is live even though the +# spec never names it. +# +# pkg:gem/rubocop-gusto#lib/rubocop/cop/gusto/unreferenced_let.rb:62 +RuboCop::Cop::Gusto::UnreferencedLet::FRAMEWORK_RESERVED_NAMES = T.let(T.unsafe(nil), Array) + +# Identifier-shaped tokens inside a string/heredoc literal. A `let` whose name appears only +# inside string text -- e.g. a binding or column referenced in raw SQL/GraphQL the spec +# later executes -- counts as referenced, so it is not deleted. +# +# pkg:gem/rubocop-gusto#lib/rubocop/cop/gusto/unreferenced_let.rb:71 +RuboCop::Cop::Gusto::UnreferencedLet::IDENTIFIER_IN_STRING = T.let(T.unsafe(nil), Regexp) + +# pkg:gem/rubocop-gusto#lib/rubocop/cop/gusto/unreferenced_let.rb:72 +RuboCop::Cop::Gusto::UnreferencedLet::MSG = T.let(T.unsafe(nil), String) + +# pkg:gem/rubocop-gusto#lib/rubocop/cop/gusto/unreferenced_let.rb:73 +RuboCop::Cop::Gusto::UnreferencedLet::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array) + +# The glob and the pathspec encode the SAME set of files two ways: `Dir.glob` (fallback) and +# a regexp filter over `git ls-files` output. Keep them in sync if either changes. +# +# pkg:gem/rubocop-gusto#lib/rubocop/cop/gusto/unreferenced_let.rb:76 +RuboCop::Cop::Gusto::UnreferencedLet::SUPPORT_FILES_GLOB = T.let(T.unsafe(nil), String) + +# pkg:gem/rubocop-gusto#lib/rubocop/cop/gusto/unreferenced_let.rb:77 +RuboCop::Cop::Gusto::UnreferencedLet::SUPPORT_FILES_PATHSPEC = T.let(T.unsafe(nil), Regexp) + # Requires the use of the `paint` gem for terminal color methods on strings # # @safety @@ -1083,6 +1532,66 @@ RuboCop::Cop::Rack::LowercaseHeaderKeys::MSG = T.let(T.unsafe(nil), String) # pkg:gem/rubocop-gusto#lib/rubocop/cop/rack/lowercase_header_keys.rb:31 RuboCop::Cop::Rack::LowercaseHeaderKeys::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array) +# pkg:gem/rubocop-gusto#lib/rubocop/cop/sidekiq/perform_async_stub.rb:5 +module RuboCop::Cop::Sidekiq; end + +# Checks that `perform_async` calls to enqueue Sidekiq jobs are not stubbed +# +# @example +# # bad +# allow(Foo).to receive(:perform_async) +# expect(Foo).to receive(:perform_async) +# expect(Foo).not_to receive(:perform_async) +# +# # good (still invokes the real method) +# allow(Foo).to receive(:perform_async).and_call_original +# expect(Foo).to receive(:perform_async).with(arg).and_call_original +# allow(Foo).to receive(:perform_async).and_wrap_original { |m, *args| m.call(*args) } +# +# # good (checking enqueued jobs) +# expect { subject }.to change(Foo.jobs, :count).by(n) +# expect { subject }.not_to change(Foo.jobs, :count) +# expect(Foo.jobs.count).to eq(n) +# +# # good (only checks previously pre-stubbed objects) +# expect(Foo).to have_received(:perform_async) +# +# @safety +# Autocorrect is unsafe: it appends `.and_call_original` on positive `receive` only, which runs +# the real `perform_async` during the example (may enqueue jobs, hit external code, or +# change expectations vs a pure stub). There is no autocorrect for `not_to` / `to_not receive`, +# since `.and_call_original` would not apply to a negative expectation. Autocorrect is also +# suppressed when the expectation uses a block, since appending `.and_call_original` would +# rebind the block to the wrong method. +# +# pkg:gem/rubocop-gusto#lib/rubocop/cop/sidekiq/perform_async_stub.rb:34 +class RuboCop::Cop::Sidekiq::PerformAsyncStub < ::RuboCop::Cop::Base + extend ::RuboCop::Cop::AutoCorrector + + # pkg:gem/rubocop-gusto#lib/rubocop/cop/sidekiq/perform_async_stub.rb:72 + def on_csend(node); end + + # pkg:gem/rubocop-gusto#lib/rubocop/cop/sidekiq/perform_async_stub.rb:47 + def on_send(node); end + + # pkg:gem/rubocop-gusto#lib/rubocop/cop/sidekiq/perform_async_stub.rb:43 + def stub_perform_async?(param0 = T.unsafe(nil)); end + + private + + # pkg:gem/rubocop-gusto#lib/rubocop/cop/sidekiq/perform_async_stub.rb:76 + def message_expectation_chain_tail(node); end +end + +# pkg:gem/rubocop-gusto#lib/rubocop/cop/sidekiq/perform_async_stub.rb:37 +RuboCop::Cop::Sidekiq::PerformAsyncStub::MSG = T.let(T.unsafe(nil), String) + +# pkg:gem/rubocop-gusto#lib/rubocop/cop/sidekiq/perform_async_stub.rb:38 +RuboCop::Cop::Sidekiq::PerformAsyncStub::MSG_RECEIVE = T.let(T.unsafe(nil), String) + +# pkg:gem/rubocop-gusto#lib/rubocop/cop/sidekiq/perform_async_stub.rb:39 +RuboCop::Cop::Sidekiq::PerformAsyncStub::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array) + # RuboCop Gusto project namespace. # # pkg:gem/rubocop-gusto#lib/rubocop/gusto/version.rb:4 diff --git a/sorbet/rbi/gems/rubocop-rspec@3.9.0.rbi b/sorbet/rbi/gems/rubocop-rspec@3.10.2.rbi similarity index 95% rename from sorbet/rbi/gems/rubocop-rspec@3.9.0.rbi rename to sorbet/rbi/gems/rubocop-rspec@3.10.2.rbi index b096d49..32c9646 100644 --- a/sorbet/rbi/gems/rubocop-rspec@3.9.0.rbi +++ b/sorbet/rbi/gems/rubocop-rspec@3.10.2.rbi @@ -145,30 +145,39 @@ RuboCop::Cop::RSpec::AnyInstance::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array) # # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/around_block.rb:29 class RuboCop::Cop::RSpec::AroundBlock < ::RuboCop::Cop::RSpec::Base - # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/around_block.rb:45 + # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/around_block.rb:50 def find_arg_usage(param0); end # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/around_block.rb:35 def hook_block(param0 = T.unsafe(nil)); end + # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/around_block.rb:45 + def hook_itblock(param0 = T.unsafe(nil)); end + # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/around_block.rb:40 def hook_numblock(param0 = T.unsafe(nil)); end - # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/around_block.rb:49 + # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/around_block.rb:54 def on_block(node); end - # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/around_block.rb:59 + # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/around_block.rb:70 + def on_itblock(node); end + + # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/around_block.rb:64 def on_numblock(node); end private - # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/around_block.rb:67 + # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/around_block.rb:78 def add_no_arg_offense(node); end - # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/around_block.rb:82 + # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/around_block.rb:104 + def check_for_itblock(block); end + + # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/around_block.rb:93 def check_for_numblock(block); end - # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/around_block.rb:71 + # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/around_block.rb:82 def check_for_unused_proxy(block, proxy); end end @@ -640,34 +649,29 @@ end # # @example # # bad -# it { is_expected.to contain_exactly(*array1, *array2) } +# it { is_expected.to contain_exactly(*array) } # # # good -# it { is_expected.to match_array(array1 + array2) } +# it { is_expected.to match_array(array) } +# +# # good +# it { is_expected.to contain_exactly(*array1, *array2) } # # # good # it { is_expected.to contain_exactly(content, *array) } # -# pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/contain_exactly.rb:23 +# pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/contain_exactly.rb:26 class RuboCop::Cop::RSpec::ContainExactly < ::RuboCop::Cop::RSpec::Base extend ::RuboCop::Cop::AutoCorrector - # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/contain_exactly.rb:29 + # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/contain_exactly.rb:32 def on_send(node); end - - private - - # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/contain_exactly.rb:45 - def autocorrect_for_populated_array(node, corrector); end - - # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/contain_exactly.rb:37 - def check_populated_collection(node); end end -# pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/contain_exactly.rb:26 +# pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/contain_exactly.rb:29 RuboCop::Cop::RSpec::ContainExactly::MSG = T.let(T.unsafe(nil), String) -# pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/contain_exactly.rb:27 +# pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/contain_exactly.rb:30 RuboCop::Cop::RSpec::ContainExactly::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array) # `context` should not be used for specifying methods. @@ -1184,6 +1188,78 @@ end # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/dialect.rb:63 RuboCop::Cop::RSpec::Dialect::MSG = T.let(T.unsafe(nil), String) +# Checks for matchers that are used in void context. +# +# Matcher calls like `change`, `receive`, etc. that appear as +# standalone expressions have their result silently discarded. +# This usually means a missing `.and` to chain compound matchers. +# +# The list of matcher methods can be configured +# with `CustomMatcherMethods`. +# +# @example +# # bad +# specify do +# expect { result } +# .to change { obj.foo }.from(1).to(2) +# change { obj.bar }.from(3).to(4) +# end +# +# # good +# specify do +# expect { result } +# .to change { obj.foo }.from(1).to(2) +# .and change { obj.bar }.from(3).to(4) +# end +# +# # good +# specify do +# expect { result }.to change { obj.foo }.from(1).to(2) +# end +# +# pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/discarded_matcher.rb:35 +class RuboCop::Cop::RSpec::DiscardedMatcher < ::RuboCop::Cop::RSpec::Base + include ::RuboCop::Cop::RSpec::InsideExample + + # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/discarded_matcher.rb:50 + def on_block(node); end + + # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/discarded_matcher.rb:46 + def on_send(node); end + + private + + # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/discarded_matcher.rb:96 + def all_matcher_methods; end + + # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/discarded_matcher.rb:56 + def check_discarded_matcher(send_node, node); end + + # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/discarded_matcher.rb:101 + def custom_matcher_methods; end + + # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/discarded_matcher.rb:67 + def example_with_matcher_expectation?(node); end + + # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/discarded_matcher.rb:76 + def expectation_with_matcher?(node); end + + # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/discarded_matcher.rb:105 + def find_outermost_chain(node); end + + # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/discarded_matcher.rb:92 + def matcher_call?(node); end + + # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/discarded_matcher.rb:83 + def void_value?(node); end +end + +# pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/discarded_matcher.rb:41 +RuboCop::Cop::RSpec::DiscardedMatcher::MATCHER_METHODS = T.let(T.unsafe(nil), Set) + +# pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/discarded_matcher.rb:38 +RuboCop::Cop::RSpec::DiscardedMatcher::MSG = T.let(T.unsafe(nil), String) + # Avoid duplicated metadata. # # @example @@ -1251,43 +1327,44 @@ RuboCop::Cop::RSpec::DuplicatedMetadata::MSG = T.let(T.unsafe(nil), String) # # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/empty_example_group.rb:38 class RuboCop::Cop::RSpec::EmptyExampleGroup < ::RuboCop::Cop::RSpec::Base + include ::RuboCop::Cop::RSpec::InsideExample include ::RuboCop::Cop::RangeHelp extend ::RuboCop::Cop::AutoCorrector - # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/empty_example_group.rb:55 + # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/empty_example_group.rb:56 def example_group_body(param0 = T.unsafe(nil)); end - # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/empty_example_group.rb:73 + # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/empty_example_group.rb:74 def example_or_group_or_include?(param0 = T.unsafe(nil)); end - # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/empty_example_group.rb:130 + # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/empty_example_group.rb:131 def examples?(param0 = T.unsafe(nil)); end - # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/empty_example_group.rb:111 + # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/empty_example_group.rb:112 def examples_directly_or_in_block?(param0 = T.unsafe(nil)); end - # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/empty_example_group.rb:97 + # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/empty_example_group.rb:98 def examples_inside_block?(param0 = T.unsafe(nil)); end - # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/empty_example_group.rb:139 + # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/empty_example_group.rb:140 def on_block(node); end private - # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/empty_example_group.rb:165 + # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/empty_example_group.rb:166 def conditionals_with_examples?(body); end - # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/empty_example_group.rb:173 + # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/empty_example_group.rb:174 def examples_in_branches?(condition_node); end - # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/empty_example_group.rb:154 + # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/empty_example_group.rb:155 def offensive?(body); end - # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/empty_example_group.rb:180 + # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/empty_example_group.rb:181 def removed_range(node); end end -# pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/empty_example_group.rb:43 +# pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/empty_example_group.rb:44 RuboCop::Cop::RSpec::EmptyExampleGroup::MSG = T.let(T.unsafe(nil), String) # Checks for empty before and after hooks. @@ -1445,7 +1522,10 @@ class RuboCop::Cop::RSpec::EmptyLineAfterFinalLet < ::RuboCop::Cop::RSpec::Base include ::RuboCop::Cop::RSpec::EmptyLineSeparation extend ::RuboCop::Cop::AutoCorrector - # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/empty_line_after_final_let.rb:26 + # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/empty_line_after_final_let.rb:27 + def example_group_or_include?(param0 = T.unsafe(nil)); end + + # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/empty_line_after_final_let.rb:31 def on_block(node); end end @@ -1510,12 +1590,15 @@ class RuboCop::Cop::RSpec::EmptyLineAfterHook < ::RuboCop::Cop::RSpec::Base # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/empty_line_after_hook.rb:60 def on_block(node); end + # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/empty_line_after_hook.rb:71 + def on_itblock(node); end + # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/empty_line_after_hook.rb:70 def on_numblock(node); end private - # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/empty_line_after_hook.rb:74 + # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/empty_line_after_hook.rb:75 def chained_single_line_hooks?(node); end end @@ -2000,49 +2083,60 @@ RuboCop::Cop::RSpec::ExcessiveDocstringSpacing::MSG = T.let(T.unsafe(nil), Strin # expect(name).to eq("John") # # # bad (not supported autocorrection) +# expect(42).to be_even # expect(false).to eq(true) +# expect("user").to be_present # -# pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/expect_actual.rb:24 +# pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/expect_actual.rb:26 class RuboCop::Cop::RSpec::ExpectActual < ::RuboCop::Cop::RSpec::Base extend ::RuboCop::Cop::AutoCorrector - # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/expect_actual.rb:57 + # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/expect_actual.rb:60 def expect_literal(param0 = T.unsafe(nil)); end - # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/expect_actual.rb:68 + # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/expect_actual.rb:72 + def expect_literal_no_arg(param0 = T.unsafe(nil)); end + + # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/expect_actual.rb:80 def on_send(node); end private - # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/expect_actual.rb:98 + # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/expect_actual.rb:118 def complex_literal?(node); end # This is not implemented using a NodePattern because it seems # to not be able to match against an explicit (nil) sexp # - # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/expect_actual.rb:90 + # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/expect_actual.rb:110 def literal?(node); end - # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/expect_actual.rb:94 + # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/expect_actual.rb:91 + def register_offense(actual, send_node, matcher, expected); end + + # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/expect_actual.rb:114 def simple_literal?(node); end end -# pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/expect_actual.rb:44 +# pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/expect_actual.rb:47 RuboCop::Cop::RSpec::ExpectActual::COMPLEX_LITERALS = T.let(T.unsafe(nil), Array) -# pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/expect_actual.rb:54 +# pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/expect_actual.rb:57 RuboCop::Cop::RSpec::ExpectActual::CORRECTABLE_MATCHERS = T.let(T.unsafe(nil), Array) -# pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/expect_actual.rb:27 +# pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/expect_actual.rb:29 RuboCop::Cop::RSpec::ExpectActual::MSG = T.let(T.unsafe(nil), String) -# pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/expect_actual.rb:29 +# pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/expect_actual.rb:30 +RuboCop::Cop::RSpec::ExpectActual::MSG_NO_ARG = T.let(T.unsafe(nil), String) + +# pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/expect_actual.rb:32 RuboCop::Cop::RSpec::ExpectActual::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array) -# pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/expect_actual.rb:31 +# pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/expect_actual.rb:34 RuboCop::Cop::RSpec::ExpectActual::SIMPLE_LITERALS = T.let(T.unsafe(nil), Array) -# pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/expect_actual.rb:53 +# pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/expect_actual.rb:56 RuboCop::Cop::RSpec::ExpectActual::SKIPPED_MATCHERS = T.let(T.unsafe(nil), Array) # Checks for consistent style of change matcher. @@ -2052,6 +2146,10 @@ RuboCop::Cop::RSpec::ExpectActual::SKIPPED_MATCHERS = T.let(T.unsafe(nil), Array # # This cop can be configured using the `EnforcedStyle` option. # +# When using compound expectations with `change` and a negated matcher +# (e.g., `not_change`), you can configure the `NegatedMatcher` option +# to ensure consistent style enforcement across both matchers. +# # @safety # Autocorrection is unsafe because `method_call` style calls the # receiver *once* and sends the message to it before and after @@ -2090,33 +2188,48 @@ RuboCop::Cop::RSpec::ExpectActual::SKIPPED_MATCHERS = T.let(T.unsafe(nil), Array # # good # expect { run }.to change { Foo.bar } # -# pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/expect_change.rb:51 +# @example `NegatedMatcher: not_change` (with compound expectations) +# # bad +# expect { run }.to change(Foo, :bar).and not_change { Foo.baz } +# +# # good +# expect { run }.to change(Foo, :bar).and not_change(Foo, :baz) +# +# pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/expect_change.rb:62 class RuboCop::Cop::RSpec::ExpectChange < ::RuboCop::Cop::RSpec::Base include ::RuboCop::Cop::ConfigurableEnforcedStyle extend ::RuboCop::Cop::AutoCorrector - # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/expect_change.rb:60 - def expect_change_with_arguments(param0 = T.unsafe(nil)); end + # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/expect_change.rb:70 + def expect_matcher_with_arguments(param0 = T.unsafe(nil)); end - # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/expect_change.rb:65 - def expect_change_with_block(param0 = T.unsafe(nil)); end + # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/expect_change.rb:75 + def expect_matcher_with_block(param0 = T.unsafe(nil)); end - # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/expect_change.rb:91 + # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/expect_change.rb:104 def on_block(node); end - # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/expect_change.rb:79 + # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/expect_change.rb:89 def on_send(node); end + + private + + # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/expect_change.rb:125 + def matcher_method?(method_name); end + + # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/expect_change.rb:121 + def matcher_method_names; end + + # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/expect_change.rb:129 + def negated_matcher; end end -# pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/expect_change.rb:55 +# pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/expect_change.rb:66 RuboCop::Cop::RSpec::ExpectChange::MSG_BLOCK = T.let(T.unsafe(nil), String) -# pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/expect_change.rb:56 +# pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/expect_change.rb:67 RuboCop::Cop::RSpec::ExpectChange::MSG_CALL = T.let(T.unsafe(nil), String) -# pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/expect_change.rb:57 -RuboCop::Cop::RSpec::ExpectChange::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array) - # Do not use `expect` in hooks such as `before`. # # @example @@ -2143,12 +2256,15 @@ class RuboCop::Cop::RSpec::ExpectInHook < ::RuboCop::Cop::RSpec::Base # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/expect_in_hook.rb:30 def on_block(node); end + # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/expect_in_hook.rb:41 + def on_itblock(node); end + # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/expect_in_hook.rb:40 def on_numblock(node); end private - # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/expect_in_hook.rb:44 + # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/expect_in_hook.rb:45 def message(expect, hook); end end @@ -2428,6 +2544,9 @@ class RuboCop::Cop::RSpec::HookArgument < ::RuboCop::Cop::RSpec::Base # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/hook_argument.rb:78 def on_block(node); end + # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/hook_argument.rb:92 + def on_itblock(node); end + # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/hook_argument.rb:91 def on_numblock(node); end @@ -2439,19 +2558,19 @@ class RuboCop::Cop::RSpec::HookArgument < ::RuboCop::Cop::RSpec::Base private - # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/hook_argument.rb:95 + # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/hook_argument.rb:96 def autocorrect(corrector, _node, method_send); end - # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/hook_argument.rb:102 + # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/hook_argument.rb:103 def check_implicit(method_send); end - # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/hook_argument.rb:116 + # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/hook_argument.rb:117 def explicit_message(scope); end - # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/hook_argument.rb:128 + # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/hook_argument.rb:129 def hook(node, &block); end - # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/hook_argument.rb:124 + # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/hook_argument.rb:125 def implicit_style?; end end @@ -2490,21 +2609,24 @@ class RuboCop::Cop::RSpec::HooksBeforeExamples < ::RuboCop::Cop::RSpec::Base # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/hooks_before_examples.rb:41 def on_block(node); end + # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/hooks_before_examples.rb:48 + def on_itblock(node); end + # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/hooks_before_examples.rb:47 def on_numblock(node); end private - # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/hooks_before_examples.rb:73 + # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/hooks_before_examples.rb:74 def autocorrect(corrector, node, first_example); end - # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/hooks_before_examples.rb:55 + # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/hooks_before_examples.rb:56 def check_hooks(node); end - # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/hooks_before_examples.rb:69 + # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/hooks_before_examples.rb:70 def find_first_example(node); end - # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/hooks_before_examples.rb:51 + # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/hooks_before_examples.rb:52 def multiline_block?(block); end end @@ -2961,6 +3083,16 @@ end # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/predicate_matcher.rb:11 RuboCop::Cop::RSpec::InflectedHelper::MSG_INFLECTED = T.let(T.unsafe(nil), String) +# Helps check if a given node is within an example block. +# +# pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/mixin/inside_example.rb:7 +module RuboCop::Cop::RSpec::InsideExample + private + + # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/mixin/inside_example.rb:10 + def inside_example?(node); end +end + # Helps you identify whether a given node # is within an example group or not. # @@ -3182,33 +3314,39 @@ class RuboCop::Cop::RSpec::IteratedExpectation < ::RuboCop::Cop::RSpec::Base # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/iterated_expectation.rb:26 def each?(param0 = T.unsafe(nil)); end + # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/iterated_expectation.rb:42 + def each_itblock?(param0 = T.unsafe(nil)); end + # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/iterated_expectation.rb:35 def each_numblock?(param0 = T.unsafe(nil)); end - # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/iterated_expectation.rb:42 + # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/iterated_expectation.rb:49 def expectation?(param0 = T.unsafe(nil), param1); end - # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/iterated_expectation.rb:46 + # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/iterated_expectation.rb:53 def on_block(node); end - # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/iterated_expectation.rb:52 + # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/iterated_expectation.rb:65 + def on_itblock(node); end + + # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/iterated_expectation.rb:59 def on_numblock(node); end private - # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/iterated_expectation.rb:60 + # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/iterated_expectation.rb:73 def check_offense(node, argument); end - # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/iterated_expectation.rb:88 + # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/iterated_expectation.rb:101 def only_expectations?(body, arg); end - # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/iterated_expectation.rb:84 + # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/iterated_expectation.rb:97 def single_expectation?(body, arg); end - # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/iterated_expectation.rb:73 + # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/iterated_expectation.rb:86 def single_expectation_replacement(node); end - # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/iterated_expectation.rb:80 + # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/iterated_expectation.rb:93 def uses_argument_in_matcher?(node, argument); end end @@ -3721,6 +3859,60 @@ RuboCop::Cop::RSpec::MatchArray::MSG = T.let(T.unsafe(nil), String) # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/match_array.rb:30 RuboCop::Cop::RSpec::MatchArray::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array) +# Enforces the use of `include` matcher instead of `match` when the +# matcher is a simple string literal without regex-specific features. +# +# When `match` is used with a regex that contains only literal characters +# (no anchors, character classes, quantifiers, alternations, or +# metacharacters), it's clearer to use the `include` matcher instead. +# +# @example +# # bad +# expect('foobar').to match(/foo/) +# expect(response.body).to match(/http:\/\/example\.com/) +# +# # good +# expect('foobar').to include('foo') +# expect(response.body).to include('http://example.com') +# +# # good - regex features needed +# expect('foobar').to match(/^foo/) # anchor +# expect('foobar').to match(/foo\d+/) # quantifier +# expect('foobar').to match(/foo[ob]/) # character class +# +# pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/match_with_simple_regex.rb:29 +class RuboCop::Cop::RSpec::MatchWithSimpleRegex < ::RuboCop::Cop::RSpec::Base + extend ::RuboCop::Cop::AutoCorrector + + # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/match_with_simple_regex.rb:37 + def match_with_regexp?(param0 = T.unsafe(nil)); end + + # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/match_with_simple_regex.rb:41 + def on_send(node); end + + private + + # Reconstruct the literal string that the regex matches + # + # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/match_with_simple_regex.rb:73 + def regexp_to_string(node); end + + # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/match_with_simple_regex.rb:64 + def simple_expression?(expr); end + + # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/match_with_simple_regex.rb:56 + def simple_regexp?(node); end + + # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/match_with_simple_regex.rb:82 + def to_string_literal(string); end +end + +# pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/match_with_simple_regex.rb:32 +RuboCop::Cop::RSpec::MatchWithSimpleRegex::MSG = T.let(T.unsafe(nil), String) + +# pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/match_with_simple_regex.rb:34 +RuboCop::Cop::RSpec::MatchWithSimpleRegex::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array) + # Check that chains of messages are not being stubbed. # # @example @@ -3863,7 +4055,10 @@ module RuboCop::Cop::RSpec::Metadata # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/mixin/metadata.rb:30 def on_block(node); end - # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/mixin/metadata.rb:43 + # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/mixin/metadata.rb:42 + def on_itblock(node); end + + # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/mixin/metadata.rb:44 def on_metadata(_symbols, _hash); end # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/mixin/metadata.rb:41 @@ -3877,7 +4072,7 @@ module RuboCop::Cop::RSpec::Metadata private - # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/mixin/metadata.rb:49 + # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/mixin/metadata.rb:50 def on_metadata_arguments(metadata_arguments); end end @@ -4692,6 +4887,9 @@ class RuboCop::Cop::RSpec::NoExpectationExample < ::RuboCop::Cop::RSpec::Base # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/no_expectation_example.rb:89 def on_block(node); end + # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/no_expectation_example.rb:99 + def on_itblock(node); end + # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/no_expectation_example.rb:98 def on_numblock(node); end @@ -5258,24 +5456,27 @@ RuboCop::Cop::RSpec::ReceiveNever::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array class RuboCop::Cop::RSpec::RedundantAround < ::RuboCop::Cop::RSpec::Base extend ::RuboCop::Cop::AutoCorrector - # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/redundant_around.rb:43 + # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/redundant_around.rb:44 def match_redundant_around_hook_block?(param0 = T.unsafe(nil)); end - # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/redundant_around.rb:48 + # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/redundant_around.rb:49 def match_redundant_around_hook_send?(param0 = T.unsafe(nil)); end # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/redundant_around.rb:23 def on_block(node); end + # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/redundant_around.rb:31 + def on_itblock(node); end + # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/redundant_around.rb:30 def on_numblock(node); end - # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/redundant_around.rb:32 + # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/redundant_around.rb:33 def on_send(node); end private - # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/redundant_around.rb:59 + # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/redundant_around.rb:60 def autocorrect(corrector, node); end end @@ -5427,28 +5628,30 @@ RuboCop::Cop::RSpec::RepeatedDescription::MSG = T.let(T.unsafe(nil), String) # # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/repeated_example.rb:18 class RuboCop::Cop::RSpec::RepeatedExample < ::RuboCop::Cop::RSpec::Base - # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/repeated_example.rb:22 + include ::RuboCop::Cop::RSpec::RepeatedItems + + # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/repeated_example.rb:24 def on_block(node); end private - # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/repeated_example.rb:49 + # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/repeated_example.rb:51 def add_offenses_for_repeated_group(repeated_examples); end - # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/repeated_example.rb:41 + # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/repeated_example.rb:43 def build_example_signature(example); end - # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/repeated_example.rb:56 + # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/repeated_example.rb:58 def extract_other_lines(examples_group, current_example); end - # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/repeated_example.rb:32 + # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/repeated_example.rb:34 def find_repeated_examples(node); end - # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/repeated_example.rb:66 + # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/repeated_example.rb:68 def message(other_lines); end end -# pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/repeated_example.rb:19 +# pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/repeated_example.rb:21 RuboCop::Cop::RSpec::RepeatedExample::MSG = T.let(T.unsafe(nil), String) # Check for repeated describe and context block body. @@ -5493,38 +5696,36 @@ RuboCop::Cop::RSpec::RepeatedExample::MSG = T.let(T.unsafe(nil), String) # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/repeated_example_group_body.rb:45 class RuboCop::Cop::RSpec::RepeatedExampleGroupBody < ::RuboCop::Cop::RSpec::Base include ::RuboCop::Cop::RSpec::SkipOrPending + include ::RuboCop::Cop::RSpec::RepeatedItems - # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/repeated_example_group_body.rb:59 + # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/repeated_example_group_body.rb:60 def body(param0 = T.unsafe(nil)); end - # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/repeated_example_group_body.rb:62 + # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/repeated_example_group_body.rb:63 def const_arg(param0 = T.unsafe(nil)); end - # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/repeated_example_group_body.rb:56 + # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/repeated_example_group_body.rb:57 def metadata(param0 = T.unsafe(nil)); end - # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/repeated_example_group_body.rb:64 + # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/repeated_example_group_body.rb:65 def on_begin(node); end - # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/repeated_example_group_body.rb:51 + # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/repeated_example_group_body.rb:52 def several_example_groups?(param0 = T.unsafe(nil)); end private - # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/repeated_example_group_body.rb:85 - def add_repeated_lines(groups); end - - # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/repeated_example_group_body.rb:94 + # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/repeated_example_group_body.rb:90 def message(group, repeats); end - # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/repeated_example_group_body.rb:74 + # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/repeated_example_group_body.rb:75 def repeated_group_bodies(node); end - # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/repeated_example_group_body.rb:90 + # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/repeated_example_group_body.rb:86 def signature_keys(group); end end -# pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/repeated_example_group_body.rb:48 +# pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/repeated_example_group_body.rb:49 RuboCop::Cop::RSpec::RepeatedExampleGroupBody::MSG = T.let(T.unsafe(nil), String) # Check for repeated example group descriptions. @@ -5569,32 +5770,30 @@ RuboCop::Cop::RSpec::RepeatedExampleGroupBody::MSG = T.let(T.unsafe(nil), String # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/repeated_example_group_description.rb:45 class RuboCop::Cop::RSpec::RepeatedExampleGroupDescription < ::RuboCop::Cop::RSpec::Base include ::RuboCop::Cop::RSpec::SkipOrPending + include ::RuboCop::Cop::RSpec::RepeatedItems - # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/repeated_example_group_description.rb:56 + # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/repeated_example_group_description.rb:57 def doc_string_and_metadata(param0 = T.unsafe(nil)); end - # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/repeated_example_group_description.rb:61 + # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/repeated_example_group_description.rb:62 def empty_description?(param0 = T.unsafe(nil)); end - # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/repeated_example_group_description.rb:63 + # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/repeated_example_group_description.rb:64 def on_begin(node); end - # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/repeated_example_group_description.rb:51 + # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/repeated_example_group_description.rb:52 def several_example_groups?(param0 = T.unsafe(nil)); end private - # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/repeated_example_group_description.rb:85 - def add_repeated_lines(groups); end - - # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/repeated_example_group_description.rb:90 + # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/repeated_example_group_description.rb:86 def message(group, repeats); end - # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/repeated_example_group_description.rb:73 + # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/repeated_example_group_description.rb:74 def repeated_group_descriptions(node); end end -# pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/repeated_example_group_description.rb:48 +# pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/repeated_example_group_description.rb:49 RuboCop::Cop::RSpec::RepeatedExampleGroupDescription::MSG = T.let(T.unsafe(nil), String) # Check for repeated include of shared examples. @@ -5641,39 +5840,65 @@ RuboCop::Cop::RSpec::RepeatedExampleGroupDescription::MSG = T.let(T.unsafe(nil), # # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/repeated_include_example.rb:48 class RuboCop::Cop::RSpec::RepeatedIncludeExample < ::RuboCop::Cop::RSpec::Base - # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/repeated_include_example.rb:58 + include ::RuboCop::Cop::RSpec::RepeatedItems + + # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/repeated_include_example.rb:60 def include_examples?(param0 = T.unsafe(nil)); end - # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/repeated_include_example.rb:65 + # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/repeated_include_example.rb:67 def on_begin(node); end - # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/repeated_include_example.rb:53 + # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/repeated_include_example.rb:55 def several_include_examples?(param0 = T.unsafe(nil)); end - # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/repeated_include_example.rb:62 + # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/repeated_include_example.rb:64 def shared_examples_name(param0 = T.unsafe(nil)); end private - # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/repeated_include_example.rb:90 - def add_repeated_lines(items); end - - # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/repeated_include_example.rb:85 + # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/repeated_include_example.rb:87 def literal_include_examples?(node); end - # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/repeated_include_example.rb:99 + # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/repeated_include_example.rb:96 def message(item, repeats); end - # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/repeated_include_example.rb:75 + # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/repeated_include_example.rb:77 def repeated_include_examples(node); end - # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/repeated_include_example.rb:95 + # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/repeated_include_example.rb:92 def signature_keys(item); end end -# pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/repeated_include_example.rb:49 +# pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/repeated_include_example.rb:51 RuboCop::Cop::RSpec::RepeatedIncludeExample::MSG = T.let(T.unsafe(nil), String) +# Helps find repeated items in a collection +# +# Provides a generic method to find repeated items by grouping them +# by a key and returning pairs of [item, repeated_lines] for items +# that appear more than once. +# +# pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/mixin/repeated_items.rb:11 +module RuboCop::Cop::RSpec::RepeatedItems + # Maps a group of items to pairs of [item, repeated_lines] + # + # @param items [Array] array of items that share the same key + # @return [Array] array of [item, repeated_lines] pairs + # + # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/mixin/repeated_items.rb:29 + def add_repeated_lines(items); end + + # Groups items by key and returns only groups with more than one item + # + # @param items [Enumerable] the filtered collection to group + # @param key_proc [Proc] block returning the grouping key for each item + # @return [Array] array of groups containing more than one item + # that share the same key and there are multiple items in the group + # + # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/mixin/repeated_items.rb:18 + def find_repeated_groups(items, key_proc:); end +end + # Checks for repeated calls to subject missing that it is memoized. # # @example @@ -5879,11 +6104,11 @@ RuboCop::Cop::RSpec::ReturnFromStub::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Arr # # # good # describe Foo do -# subject { Foo } -# before { prepare } # let(:foo) { 1 } # let(:bar) { 2 } # let!(:baz) { 3 } +# subject { Foo } +# before { prepare } # end # # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/scattered_let.rb:29 @@ -5942,27 +6167,28 @@ RuboCop::Cop::RSpec::ScatteredLet::MSG = T.let(T.unsafe(nil), String) class RuboCop::Cop::RSpec::ScatteredSetup < ::RuboCop::Cop::RSpec::Base include ::RuboCop::Cop::RSpec::FinalEndLocation include ::RuboCop::Cop::RangeHelp + include ::RuboCop::Cop::RSpec::RepeatedItems extend ::RuboCop::Cop::AutoCorrector - # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/scattered_setup.rb:50 + # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/scattered_setup.rb:51 def on_block(node); end private - # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/scattered_setup.rb:94 + # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/scattered_setup.rb:92 def autocorrect(corrector, first_occurrence, occurrence); end - # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/scattered_setup.rb:79 + # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/scattered_setup.rb:77 def lines_msg(numbers); end - # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/scattered_setup.rb:87 + # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/scattered_setup.rb:85 def message(occurrences, occurrence); end - # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/scattered_setup.rb:65 + # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/scattered_setup.rb:66 def repeated_hooks(node); end end -# pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/scattered_setup.rb:47 +# pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/scattered_setup.rb:48 RuboCop::Cop::RSpec::ScatteredSetup::MSG = T.let(T.unsafe(nil), String) # Checks for proper shared_context and shared_examples usage. @@ -5970,6 +6196,9 @@ RuboCop::Cop::RSpec::ScatteredSetup::MSG = T.let(T.unsafe(nil), String) # If there are no examples defined, use shared_context. # If there is no setup defined, use shared_examples. # +# With `Strict: true`, `shared_context` is flagged whenever it contains +# any examples, even if it also contains setup code. +# # @example # # bad # RSpec.shared_context 'only examples here' do @@ -6012,40 +6241,71 @@ RuboCop::Cop::RSpec::ScatteredSetup::MSG = T.let(T.unsafe(nil), String) # end # end # -# pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/shared_context.rb:53 +# @example Strict: true +# # bad - shared_context with examples is flagged +# RSpec.shared_context 'setup and examples' do +# let(:foo) { :bar } +# +# it 'does x' do +# end +# end +# +# # good - split into separate shared_context and shared_examples +# RSpec.shared_context 'setup' do +# let(:foo) { :bar } +# end +# +# RSpec.shared_examples 'examples' do +# it 'does x' do +# end +# end +# +# pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/shared_context.rb:75 class RuboCop::Cop::RSpec::SharedContext < ::RuboCop::Cop::RSpec::Base extend ::RuboCop::Cop::AutoCorrector - # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/shared_context.rb:65 + # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/shared_context.rb:88 def context?(param0); end - # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/shared_context.rb:60 + # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/shared_context.rb:83 def examples?(param0); end - # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/shared_context.rb:81 + # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/shared_context.rb:104 def on_block(node); end - # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/shared_context.rb:72 + # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/shared_context.rb:95 def shared_context(param0 = T.unsafe(nil)); end - # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/shared_context.rb:77 + # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/shared_context.rb:100 def shared_example(param0 = T.unsafe(nil)); end private - # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/shared_context.rb:97 - def context_with_only_examples(node); end + # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/shared_context.rb:131 + def can_correct?(node); end - # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/shared_context.rb:101 + # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/shared_context.rb:141 def examples_with_only_context(node); end + + # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/shared_context.rb:127 + def message; end + + # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/shared_context.rb:135 + def offending_node(node); end + + # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/shared_context.rb:123 + def strict?; end end -# pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/shared_context.rb:57 +# pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/shared_context.rb:80 RuboCop::Cop::RSpec::SharedContext::MSG_CONTEXT = T.let(T.unsafe(nil), String) -# pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/shared_context.rb:56 +# pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/shared_context.rb:78 RuboCop::Cop::RSpec::SharedContext::MSG_EXAMPLES = T.let(T.unsafe(nil), String) +# pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/shared_context.rb:79 +RuboCop::Cop::RSpec::SharedContext::MSG_EXAMPLES_STRICT = T.let(T.unsafe(nil), String) + # Checks for consistent style for shared example names. # # Enforces either `string` or `symbol` for shared example names. @@ -6216,19 +6476,19 @@ RuboCop::Cop::RSpec::SingleArgumentMessageChain::RESTRICT_ON_SEND = T.let(T.unsa # # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/skip_block_inside_example.rb:26 class RuboCop::Cop::RSpec::SkipBlockInsideExample < ::RuboCop::Cop::RSpec::Base - # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/skip_block_inside_example.rb:29 - def on_block(node); end + include ::RuboCop::Cop::RSpec::InsideExample - # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/skip_block_inside_example.rb:36 - def on_numblock(node); end + # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/skip_block_inside_example.rb:31 + def on_block(node); end - private + # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/skip_block_inside_example.rb:39 + def on_itblock(node); end - # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/skip_block_inside_example.rb:40 - def inside_example?(node); end + # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/skip_block_inside_example.rb:38 + def on_numblock(node); end end -# pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/skip_block_inside_example.rb:27 +# pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/skip_block_inside_example.rb:29 RuboCop::Cop::RSpec::SkipBlockInsideExample::MSG = T.let(T.unsafe(nil), String) # Helps check offenses with variable definitions @@ -6343,73 +6603,73 @@ class RuboCop::Cop::RSpec::SpecFilePathFormat < ::RuboCop::Cop::RSpec::Base include ::RuboCop::Cop::RSpec::Namespace include ::RuboCop::Cop::RSpec::FileHelp - # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/spec_file_path_format.rb:49 + # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/spec_file_path_format.rb:50 def example_group_arguments(param0 = T.unsafe(nil)); end - # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/spec_file_path_format.rb:54 + # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/spec_file_path_format.rb:55 def metadata_key_value(param0); end - # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/spec_file_path_format.rb:56 + # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/spec_file_path_format.rb:57 def on_top_level_example_group(node); end private - # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/spec_file_path_format.rb:161 + # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/spec_file_path_format.rb:169 def camel_to_snake_case(string); end - # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/spec_file_path_format.rb:134 + # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/spec_file_path_format.rb:139 def correct_path_pattern(class_name, arguments); end - # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/spec_file_path_format.rb:165 + # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/spec_file_path_format.rb:173 def custom_transform; end - # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/spec_file_path_format.rb:115 + # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/spec_file_path_format.rb:116 def ensure_correct_file_path(send_node, class_name, arguments); end - # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/spec_file_path_format.rb:151 + # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/spec_file_path_format.rb:158 def expected_path(constant); end - # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/spec_file_path_format.rb:177 + # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/spec_file_path_format.rb:185 def filename_ends_with?(pattern); end - # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/spec_file_path_format.rb:147 - def ignore?(method_name); end - - # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/spec_file_path_format.rb:173 + # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/spec_file_path_format.rb:181 def ignore_metadata; end - # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/spec_file_path_format.rb:126 + # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/spec_file_path_format.rb:131 def ignore_metadata?(arguments); end - # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/spec_file_path_format.rb:169 + # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/spec_file_path_format.rb:154 + def ignore_method_name?(method_name); end + + # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/spec_file_path_format.rb:177 def ignore_methods?; end - # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/spec_file_path_format.rb:101 + # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/spec_file_path_format.rb:102 def inflector; end - # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/spec_file_path_format.rb:141 - def name_pattern(method_name); end + # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/spec_file_path_format.rb:148 + def method_name_pattern(method_name); end end # Inflector module that uses ActiveSupport for advanced inflection rules # -# pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/spec_file_path_format.rb:69 +# pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/spec_file_path_format.rb:70 module RuboCop::Cop::RSpec::SpecFilePathFormat::ActiveSupportInflector class << self - # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/spec_file_path_format.rb:70 + # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/spec_file_path_format.rb:71 def call(string); end - # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/spec_file_path_format.rb:74 + # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/spec_file_path_format.rb:75 def prepare_availability(config); end end end # Inflector module that uses basic regex-based conversion # -# pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/spec_file_path_format.rb:92 +# pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/spec_file_path_format.rb:93 module RuboCop::Cop::RSpec::SpecFilePathFormat::DefaultInflector class << self - # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/spec_file_path_format.rb:93 + # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/spec_file_path_format.rb:94 def call(string); end end end @@ -6417,6 +6677,9 @@ end # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/spec_file_path_format.rb:46 RuboCop::Cop::RSpec::SpecFilePathFormat::MSG = T.let(T.unsafe(nil), String) +# pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/spec_file_path_format.rb:47 +RuboCop::Cop::RSpec::SpecFilePathFormat::PATH_NAME_BOUNDARY = T.let(T.unsafe(nil), String) + # Checks that spec file paths suffix are consistent and well-formed. # # @example @@ -6520,22 +6783,27 @@ RuboCop::Cop::RSpec::StubbedMock::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array) # # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/subject_declaration.rb:22 class RuboCop::Cop::RSpec::SubjectDeclaration < ::RuboCop::Cop::RSpec::Base - # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/subject_declaration.rb:27 + extend ::RuboCop::Cop::AutoCorrector + + # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/subject_declaration.rb:29 def offensive_subject_declaration?(param0 = T.unsafe(nil)); end - # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/subject_declaration.rb:31 + # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/subject_declaration.rb:33 def on_send(node); end private - # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/subject_declaration.rb:40 + # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/subject_declaration.rb:50 + def first_argument_range(node); end + + # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/subject_declaration.rb:46 def message_for(offense); end end -# pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/subject_declaration.rb:23 +# pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/subject_declaration.rb:25 RuboCop::Cop::RSpec::SubjectDeclaration::MSG_LET = T.let(T.unsafe(nil), String) -# pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/subject_declaration.rb:24 +# pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/subject_declaration.rb:26 RuboCop::Cop::RSpec::SubjectDeclaration::MSG_REDUNDANT = T.let(T.unsafe(nil), String) # Checks for stubbed test subjects. @@ -7016,34 +7284,33 @@ RuboCop::Cop::RSpec::VerifiedDoubles::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Ar # # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/void_expect.rb:15 class RuboCop::Cop::RSpec::VoidExpect < ::RuboCop::Cop::RSpec::Base - # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/void_expect.rb:21 + include ::RuboCop::Cop::RSpec::InsideExample + + # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/void_expect.rb:23 def expect?(param0 = T.unsafe(nil)); end - # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/void_expect.rb:26 + # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/void_expect.rb:28 def expect_block?(param0 = T.unsafe(nil)); end - # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/void_expect.rb:37 + # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/void_expect.rb:39 def on_block(node); end - # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/void_expect.rb:30 + # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/void_expect.rb:32 def on_send(node); end private - # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/void_expect.rb:46 + # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/void_expect.rb:48 def check_expect(node); end - # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/void_expect.rb:59 - def inside_example?(node); end - - # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/void_expect.rb:52 + # pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/void_expect.rb:54 def void?(expect); end end -# pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/void_expect.rb:16 +# pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/void_expect.rb:18 RuboCop::Cop::RSpec::VoidExpect::MSG = T.let(T.unsafe(nil), String) -# pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/void_expect.rb:18 +# pkg:gem/rubocop-rspec#lib/rubocop/cop/rspec/void_expect.rb:20 RuboCop::Cop::RSpec::VoidExpect::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array) # Checks for calling a block within a stub. diff --git a/sorbet/rbi/gems/rubocop@1.87.0.rbi b/sorbet/rbi/gems/rubocop@1.88.1.rbi similarity index 97% rename from sorbet/rbi/gems/rubocop@1.87.0.rbi rename to sorbet/rbi/gems/rubocop@1.88.1.rbi index bbcd7e2..eedb8ad 100644 --- a/sorbet/rbi/gems/rubocop@1.87.0.rbi +++ b/sorbet/rbi/gems/rubocop@1.88.1.rbi @@ -391,68 +391,68 @@ class RuboCop::CLI::Command::AutoGenerateConfig < ::RuboCop::CLI::Command::Base private - # pkg:gem/rubocop#lib/rubocop/cli/command/auto_generate_config.rb:133 + # pkg:gem/rubocop#lib/rubocop/cli/command/auto_generate_config.rb:139 def add_formatter; end - # pkg:gem/rubocop#lib/rubocop/cli/command/auto_generate_config.rb:141 + # pkg:gem/rubocop#lib/rubocop/cli/command/auto_generate_config.rb:147 def add_inheritance_from_auto_generated_file(config_file); end - # pkg:gem/rubocop#lib/rubocop/cli/command/auto_generate_config.rb:50 + # pkg:gem/rubocop#lib/rubocop/cli/command/auto_generate_config.rb:56 def auto_gen_tmp_dir; end - # pkg:gem/rubocop#lib/rubocop/cli/command/auto_generate_config.rb:137 + # pkg:gem/rubocop#lib/rubocop/cli/command/auto_generate_config.rb:143 def execute_runner; end - # pkg:gem/rubocop#lib/rubocop/cli/command/auto_generate_config.rb:162 + # pkg:gem/rubocop#lib/rubocop/cli/command/auto_generate_config.rb:168 def existing_configuration(config_file); end - # pkg:gem/rubocop#lib/rubocop/cli/command/auto_generate_config.rb:91 + # pkg:gem/rubocop#lib/rubocop/cli/command/auto_generate_config.rb:97 def line_length_cop(config); end - # pkg:gem/rubocop#lib/rubocop/cli/command/auto_generate_config.rb:79 + # pkg:gem/rubocop#lib/rubocop/cli/command/auto_generate_config.rb:85 def line_length_enabled?(config); end - # pkg:gem/rubocop#lib/rubocop/cli/command/auto_generate_config.rb:87 + # pkg:gem/rubocop#lib/rubocop/cli/command/auto_generate_config.rb:93 def max_line_length(config); end - # pkg:gem/rubocop#lib/rubocop/cli/command/auto_generate_config.rb:60 + # pkg:gem/rubocop#lib/rubocop/cli/command/auto_generate_config.rb:66 def maybe_run_line_length_cop; end - # pkg:gem/rubocop#lib/rubocop/cli/command/auto_generate_config.rb:99 + # pkg:gem/rubocop#lib/rubocop/cli/command/auto_generate_config.rb:105 def only_exclude?; end - # pkg:gem/rubocop#lib/rubocop/cli/command/auto_generate_config.rb:95 + # pkg:gem/rubocop#lib/rubocop/cli/command/auto_generate_config.rb:101 def options_has_only_flag?; end - # pkg:gem/rubocop#lib/rubocop/cli/command/auto_generate_config.rb:179 + # pkg:gem/rubocop#lib/rubocop/cli/command/auto_generate_config.rb:185 def relative_path_to_todo_from_options_config; end - # pkg:gem/rubocop#lib/rubocop/cli/command/auto_generate_config.rb:45 + # pkg:gem/rubocop#lib/rubocop/cli/command/auto_generate_config.rb:51 def reset_auto_gen_tmp_dir; end - # pkg:gem/rubocop#lib/rubocop/cli/command/auto_generate_config.rb:126 + # pkg:gem/rubocop#lib/rubocop/cli/command/auto_generate_config.rb:132 def reset_config_and_auto_gen_file; end - # pkg:gem/rubocop#lib/rubocop/cli/command/auto_generate_config.rb:117 + # pkg:gem/rubocop#lib/rubocop/cli/command/auto_generate_config.rb:123 def run_all_cops(line_length_contents); end # Do an initial run with only Layout/LineLength so that cops that # depend on Layout/LineLength:Max get the correct value for that # parameter. # - # pkg:gem/rubocop#lib/rubocop/cli/command/auto_generate_config.rb:106 + # pkg:gem/rubocop#lib/rubocop/cli/command/auto_generate_config.rb:112 def run_line_length_cop; end - # pkg:gem/rubocop#lib/rubocop/cli/command/auto_generate_config.rb:83 + # pkg:gem/rubocop#lib/rubocop/cli/command/auto_generate_config.rb:89 def same_max_line_length?(config1, config2); end - # pkg:gem/rubocop#lib/rubocop/cli/command/auto_generate_config.rb:74 + # pkg:gem/rubocop#lib/rubocop/cli/command/auto_generate_config.rb:80 def skip_line_length_cop(reason); end - # pkg:gem/rubocop#lib/rubocop/cli/command/auto_generate_config.rb:38 + # pkg:gem/rubocop#lib/rubocop/cli/command/auto_generate_config.rb:44 def use_temporary_cache; end - # pkg:gem/rubocop#lib/rubocop/cli/command/auto_generate_config.rb:168 + # pkg:gem/rubocop#lib/rubocop/cli/command/auto_generate_config.rb:174 def write_config_file(file_name, file_string, rubocop_yml_contents); end end @@ -2950,16 +2950,16 @@ class RuboCop::Cop::Base # pkg:gem/rubocop#lib/rubocop/cop/base.rb:392 def currently_disabled_lines; end - # pkg:gem/rubocop#lib/rubocop/cop/base.rb:519 + # pkg:gem/rubocop#lib/rubocop/cop/base.rb:534 def custom_severity; end - # pkg:gem/rubocop#lib/rubocop/cop/base.rb:515 + # pkg:gem/rubocop#lib/rubocop/cop/base.rb:530 def default_severity; end # pkg:gem/rubocop#lib/rubocop/cop/base.rb:469 def disable_uncorrectable(range); end - # pkg:gem/rubocop#lib/rubocop/cop/base.rb:505 + # pkg:gem/rubocop#lib/rubocop/cop/base.rb:520 def enabled_line?(line_number); end # pkg:gem/rubocop#lib/rubocop/cop/base.rb:497 @@ -2968,10 +2968,13 @@ class RuboCop::Cop::Base # pkg:gem/rubocop#lib/rubocop/cop/base.rb:487 def find_message(range, message); end - # pkg:gem/rubocop#lib/rubocop/cop/base.rb:511 + # pkg:gem/rubocop#lib/rubocop/cop/base.rb:526 def find_severity(_range, severity); end - # pkg:gem/rubocop#lib/rubocop/cop/base.rb:532 + # pkg:gem/rubocop#lib/rubocop/cop/base.rb:512 + def matches_absolute_include_pattern?(patterns, file); end + + # pkg:gem/rubocop#lib/rubocop/cop/base.rb:547 def range_for_original(range); end # pkg:gem/rubocop#lib/rubocop/cop/base.rb:476 @@ -2982,7 +2985,7 @@ class RuboCop::Cop::Base # pkg:gem/rubocop#lib/rubocop/cop/base.rb:421 def reset_investigation; end - # pkg:gem/rubocop#lib/rubocop/cop/base.rb:540 + # pkg:gem/rubocop#lib/rubocop/cop/base.rb:555 def target_satisfies_all_gem_version_requirements?; end # @return [Symbol] offense status @@ -5980,7 +5983,7 @@ class RuboCop::Cop::Gemspec::RequireMFA < ::RuboCop::Cop::Base # pkg:gem/rubocop#lib/rubocop/cop/gemspec/require_mfa.rb:123 def autocorrect(corrector, node, block_var, metadata); end - # pkg:gem/rubocop#lib/rubocop/cop/gemspec/require_mfa.rb:153 + # pkg:gem/rubocop#lib/rubocop/cop/gemspec/require_mfa.rb:156 def change_value(corrector, value); end # pkg:gem/rubocop#lib/rubocop/cop/gemspec/require_mfa.rb:133 @@ -6549,7 +6552,7 @@ module RuboCop::Cop::HashSubset # pkg:gem/rubocop#lib/rubocop/cop/mixin/hash_subset.rb:181 def decorate_source(value); end - # pkg:gem/rubocop#lib/rubocop/cop/mixin/hash_subset.rb:189 + # pkg:gem/rubocop#lib/rubocop/cop/mixin/hash_subset.rb:197 def except_key(node); end # pkg:gem/rubocop#lib/rubocop/cop/mixin/hash_subset.rb:168 @@ -6570,7 +6573,7 @@ module RuboCop::Cop::HashSubset # pkg:gem/rubocop#lib/rubocop/cop/mixin/hash_subset.rb:146 def not_included?(body, negated); end - # pkg:gem/rubocop#lib/rubocop/cop/mixin/hash_subset.rb:197 + # pkg:gem/rubocop#lib/rubocop/cop/mixin/hash_subset.rb:205 def offense_range(node); end # pkg:gem/rubocop#lib/rubocop/cop/mixin/hash_subset.rb:55 @@ -6597,6 +6600,9 @@ module RuboCop::Cop::HashSubset # pkg:gem/rubocop#lib/rubocop/cop/mixin/hash_subset.rb:115 def supported_subset_method?(method); end + # pkg:gem/rubocop#lib/rubocop/cop/mixin/hash_subset.rb:193 + def to_single_quoted(string); end + # pkg:gem/rubocop#lib/rubocop/cop/mixin/hash_subset.rb:107 def using_value_variable?(send_node, value_arg); end end @@ -6634,14 +6640,14 @@ module RuboCop::Cop::HashTransformMethod private - # pkg:gem/rubocop#lib/rubocop/cop/mixin/hash_transform_method.rb:132 + # pkg:gem/rubocop#lib/rubocop/cop/mixin/hash_transform_method.rb:136 def execute_correction(corrector, node, correction); end # @abstract # # @return [Captures] # - # pkg:gem/rubocop#lib/rubocop/cop/mixin/hash_transform_method.rb:107 + # pkg:gem/rubocop#lib/rubocop/cop/mixin/hash_transform_method.rb:111 def extract_captures(_match); end # pkg:gem/rubocop#lib/rubocop/cop/mixin/hash_transform_method.rb:84 @@ -6651,7 +6657,7 @@ module RuboCop::Cop::HashTransformMethod # # @return [String] # - # pkg:gem/rubocop#lib/rubocop/cop/mixin/hash_transform_method.rb:114 + # pkg:gem/rubocop#lib/rubocop/cop/mixin/hash_transform_method.rb:118 def new_method_name; end # @abstract Implemented with `def_node_matcher` @@ -6674,7 +6680,7 @@ module RuboCop::Cop::HashTransformMethod # pkg:gem/rubocop#lib/rubocop/cop/mixin/hash_transform_method.rb:80 def on_bad_to_h(_node); end - # pkg:gem/rubocop#lib/rubocop/cop/mixin/hash_transform_method.rb:118 + # pkg:gem/rubocop#lib/rubocop/cop/mixin/hash_transform_method.rb:122 def prepare_correction(node); end end @@ -6935,22 +6941,22 @@ class RuboCop::Cop::LambdaLiteralToMethodCorrector private - # pkg:gem/rubocop#lib/rubocop/cop/correctors/lambda_literal_to_method_corrector.rb:118 + # pkg:gem/rubocop#lib/rubocop/cop/correctors/lambda_literal_to_method_corrector.rb:124 def arg_to_unparenthesized_call?; end # pkg:gem/rubocop#lib/rubocop/cop/correctors/lambda_literal_to_method_corrector.rb:34 def arguments; end - # pkg:gem/rubocop#lib/rubocop/cop/correctors/lambda_literal_to_method_corrector.rb:102 + # pkg:gem/rubocop#lib/rubocop/cop/correctors/lambda_literal_to_method_corrector.rb:108 def arguments_begin_pos; end - # pkg:gem/rubocop#lib/rubocop/cop/correctors/lambda_literal_to_method_corrector.rb:98 + # pkg:gem/rubocop#lib/rubocop/cop/correctors/lambda_literal_to_method_corrector.rb:104 def arguments_end_pos; end - # pkg:gem/rubocop#lib/rubocop/cop/correctors/lambda_literal_to_method_corrector.rb:110 + # pkg:gem/rubocop#lib/rubocop/cop/correctors/lambda_literal_to_method_corrector.rb:116 def block_begin; end - # pkg:gem/rubocop#lib/rubocop/cop/correctors/lambda_literal_to_method_corrector.rb:106 + # pkg:gem/rubocop#lib/rubocop/cop/correctors/lambda_literal_to_method_corrector.rb:112 def block_end; end # pkg:gem/rubocop#lib/rubocop/cop/correctors/lambda_literal_to_method_corrector.rb:34 @@ -6968,7 +6974,7 @@ class RuboCop::Cop::LambdaLiteralToMethodCorrector # pkg:gem/rubocop#lib/rubocop/cop/correctors/lambda_literal_to_method_corrector.rb:34 def method; end - # pkg:gem/rubocop#lib/rubocop/cop/correctors/lambda_literal_to_method_corrector.rb:92 + # pkg:gem/rubocop#lib/rubocop/cop/correctors/lambda_literal_to_method_corrector.rb:98 def needs_separating_space?; end # pkg:gem/rubocop#lib/rubocop/cop/correctors/lambda_literal_to_method_corrector.rb:53 @@ -6989,10 +6995,10 @@ class RuboCop::Cop::LambdaLiteralToMethodCorrector # pkg:gem/rubocop#lib/rubocop/cop/correctors/lambda_literal_to_method_corrector.rb:49 def replace_selector(corrector); end - # pkg:gem/rubocop#lib/rubocop/cop/correctors/lambda_literal_to_method_corrector.rb:114 + # pkg:gem/rubocop#lib/rubocop/cop/correctors/lambda_literal_to_method_corrector.rb:120 def selector_end; end - # pkg:gem/rubocop#lib/rubocop/cop/correctors/lambda_literal_to_method_corrector.rb:134 + # pkg:gem/rubocop#lib/rubocop/cop/correctors/lambda_literal_to_method_corrector.rb:140 def separating_space?; end end @@ -7349,6 +7355,10 @@ RuboCop::Cop::Layout::BeginEndAlignment::MSG = T.let(T.unsafe(nil), String) # `either` (which is the default) : the `end` is allowed to be in either # location. The autocorrect will default to `start_of_line`. # +# When the `do` or `{` appears on a continuation line of multiline +# method arguments, the start of the line where the method is called +# is used as the alignment target instead of that continuation line. +# # @example EnforcedStyleAlignWith: either (default) # # bad # @@ -7394,85 +7404,110 @@ RuboCop::Cop::Layout::BeginEndAlignment::MSG = T.let(T.unsafe(nil), String) # baz # end # -# pkg:gem/rubocop#lib/rubocop/cop/layout/block_alignment.rb:66 +# pkg:gem/rubocop#lib/rubocop/cop/layout/block_alignment.rb:70 class RuboCop::Cop::Layout::BlockAlignment < ::RuboCop::Cop::Base include ::RuboCop::Cop::ConfigurableEnforcedStyle include ::RuboCop::Cop::RangeHelp extend ::RuboCop::Cop::AutoCorrector - # pkg:gem/rubocop#lib/rubocop/cop/layout/block_alignment.rb:74 + # pkg:gem/rubocop#lib/rubocop/cop/layout/block_alignment.rb:78 def block_end_align_target?(param0 = T.unsafe(nil), param1); end - # pkg:gem/rubocop#lib/rubocop/cop/layout/block_alignment.rb:84 + # pkg:gem/rubocop#lib/rubocop/cop/layout/block_alignment.rb:88 def on_block(node); end - # pkg:gem/rubocop#lib/rubocop/cop/layout/block_alignment.rb:89 + # pkg:gem/rubocop#lib/rubocop/cop/layout/block_alignment.rb:93 def on_itblock(node); end - # pkg:gem/rubocop#lib/rubocop/cop/layout/block_alignment.rb:88 + # pkg:gem/rubocop#lib/rubocop/cop/layout/block_alignment.rb:92 def on_numblock(node); end - # pkg:gem/rubocop#lib/rubocop/cop/layout/block_alignment.rb:91 + # pkg:gem/rubocop#lib/rubocop/cop/layout/block_alignment.rb:95 def style_parameter_name; end private - # pkg:gem/rubocop#lib/rubocop/cop/layout/block_alignment.rb:247 + # pkg:gem/rubocop#lib/rubocop/cop/layout/block_alignment.rb:263 def add_space_before(corrector, loc, delta); end - # pkg:gem/rubocop#lib/rubocop/cop/layout/block_alignment.rb:224 + # pkg:gem/rubocop#lib/rubocop/cop/layout/block_alignment.rb:240 def alt_start_msg(start_loc, source_line_column); end - # pkg:gem/rubocop#lib/rubocop/cop/layout/block_alignment.rb:146 + # pkg:gem/rubocop#lib/rubocop/cop/layout/block_alignment.rb:151 def autocorrect(corrector, node); end - # pkg:gem/rubocop#lib/rubocop/cop/layout/block_alignment.rb:97 + # pkg:gem/rubocop#lib/rubocop/cop/layout/block_alignment.rb:101 def block_end_align_target(node); end - # pkg:gem/rubocop#lib/rubocop/cop/layout/block_alignment.rb:115 + # pkg:gem/rubocop#lib/rubocop/cop/layout/block_alignment.rb:119 def check_block_alignment(start_node, block_node); end - # pkg:gem/rubocop#lib/rubocop/cop/layout/block_alignment.rb:197 + # pkg:gem/rubocop#lib/rubocop/cop/layout/block_alignment.rb:202 def compute_do_source_line_column(node, end_loc); end - # pkg:gem/rubocop#lib/rubocop/cop/layout/block_alignment.rb:239 + # pkg:gem/rubocop#lib/rubocop/cop/layout/block_alignment.rb:255 def compute_start_col(ancestor_node, node); end - # pkg:gem/rubocop#lib/rubocop/cop/layout/block_alignment.rb:111 + # pkg:gem/rubocop#lib/rubocop/cop/layout/block_alignment.rb:115 def disqualified_parent?(parent, node); end - # pkg:gem/rubocop#lib/rubocop/cop/layout/block_alignment.rb:107 + # When the `do` or `{` is on a continuation line of multiline method + # arguments, the indentation of that line is not a meaningful + # alignment target; anchor on the method dispatch position instead. + # + # pkg:gem/rubocop#lib/rubocop/cop/layout/block_alignment.rb:276 + def do_line_anchor_loc(node, do_loc); end + + # pkg:gem/rubocop#lib/rubocop/cop/layout/block_alignment.rb:285 + def do_line_begins_inside_argument?(node, do_loc); end + + # pkg:gem/rubocop#lib/rubocop/cop/layout/block_alignment.rb:111 def end_align_target?(node, parent); end # In offense message, we want to show the assignment LHS rather than # the entire assignment. # - # pkg:gem/rubocop#lib/rubocop/cop/layout/block_alignment.rb:192 + # pkg:gem/rubocop#lib/rubocop/cop/layout/block_alignment.rb:197 def find_lhs_node(node); end - # pkg:gem/rubocop#lib/rubocop/cop/layout/block_alignment.rb:163 + # pkg:gem/rubocop#lib/rubocop/cop/layout/block_alignment.rb:168 def format_message(start_loc, end_loc, do_source_line_column, error_source_line_column); end - # pkg:gem/rubocop#lib/rubocop/cop/layout/block_alignment.rb:234 + # pkg:gem/rubocop#lib/rubocop/cop/layout/block_alignment.rb:250 def format_source_line_column(source_line_column); end - # pkg:gem/rubocop#lib/rubocop/cop/layout/block_alignment.rb:216 + # The continuation line indentation is only an unmeaningful alignment target when + # it is dictated by an opening delimiter, i.e. the line begins inside `(` or `[`. + # For a bare argument list without parentheses the indentation is the author's + # deliberate alignment, so the anchor must not move to the method dispatch line. + # + # pkg:gem/rubocop#lib/rubocop/cop/layout/block_alignment.rb:301 + def inside_parentheses?(node, pos); end + + # pkg:gem/rubocop#lib/rubocop/cop/layout/block_alignment.rb:232 def loc_to_source_line_column(loc); end - # pkg:gem/rubocop#lib/rubocop/cop/layout/block_alignment.rb:128 + # `end` aligned with an argument continuation line that holds the `do` + # was accepted before the anchor moved to the method dispatch line; + # keep accepting it so that such code does not become an offense. + # + # pkg:gem/rubocop#lib/rubocop/cop/layout/block_alignment.rb:226 + def permitted_do_line_columns(do_loc, indentation_of_do_line); end + + # pkg:gem/rubocop#lib/rubocop/cop/layout/block_alignment.rb:133 def register_offense(block_node, start_loc, end_loc, do_source_line_column); end - # pkg:gem/rubocop#lib/rubocop/cop/layout/block_alignment.rb:251 + # pkg:gem/rubocop#lib/rubocop/cop/layout/block_alignment.rb:267 def remove_space_before(corrector, end_pos, delta); end - # pkg:gem/rubocop#lib/rubocop/cop/layout/block_alignment.rb:173 + # pkg:gem/rubocop#lib/rubocop/cop/layout/block_alignment.rb:178 def start_for_block_node(block_node); end - # pkg:gem/rubocop#lib/rubocop/cop/layout/block_alignment.rb:180 + # pkg:gem/rubocop#lib/rubocop/cop/layout/block_alignment.rb:185 def start_for_line_node(block_node); end end -# pkg:gem/rubocop#lib/rubocop/cop/layout/block_alignment.rb:71 +# pkg:gem/rubocop#lib/rubocop/cop/layout/block_alignment.rb:75 RuboCop::Cop::Layout::BlockAlignment::MSG = T.let(T.unsafe(nil), String) # Checks whether the end statement of a do..end block @@ -7878,16 +7913,16 @@ class RuboCop::Cop::Layout::ClassStructure < ::RuboCop::Cop::Base # pkg:gem/rubocop#lib/rubocop/cop/layout/class_structure.rb:209 def autocorrect(corrector, node); end - # pkg:gem/rubocop#lib/rubocop/cop/layout/class_structure.rb:347 + # pkg:gem/rubocop#lib/rubocop/cop/layout/class_structure.rb:351 def begin_pos_with_comment(node); end - # pkg:gem/rubocop#lib/rubocop/cop/layout/class_structure.rb:370 + # pkg:gem/rubocop#lib/rubocop/cop/layout/class_structure.rb:374 def buffer; end # Setting categories hash allow you to group methods in group to match # in the {expected_order}. # - # pkg:gem/rubocop#lib/rubocop/cop/layout/class_structure.rb:382 + # pkg:gem/rubocop#lib/rubocop/cop/layout/class_structure.rb:386 def categories; end # pkg:gem/rubocop#lib/rubocop/cop/layout/class_structure.rb:276 @@ -7904,22 +7939,22 @@ class RuboCop::Cop::Layout::ClassStructure < ::RuboCop::Cop::Base # pkg:gem/rubocop#lib/rubocop/cop/layout/class_structure.rb:229 def classify(node); end - # pkg:gem/rubocop#lib/rubocop/cop/layout/class_structure.rb:313 + # pkg:gem/rubocop#lib/rubocop/cop/layout/class_structure.rb:317 def dynamic_constant?(node); end - # pkg:gem/rubocop#lib/rubocop/cop/layout/class_structure.rb:337 + # pkg:gem/rubocop#lib/rubocop/cop/layout/class_structure.rb:341 def end_position_for(node); end # Load expected order from `ExpectedOrder` config. # Define new terms in the expected order by adding new {categories}. # - # pkg:gem/rubocop#lib/rubocop/cop/layout/class_structure.rb:376 + # pkg:gem/rubocop#lib/rubocop/cop/layout/class_structure.rb:380 def expected_order; end # pkg:gem/rubocop#lib/rubocop/cop/layout/class_structure.rb:261 def find_category(name); end - # pkg:gem/rubocop#lib/rubocop/cop/layout/class_structure.rb:366 + # pkg:gem/rubocop#lib/rubocop/cop/layout/class_structure.rb:370 def find_heredoc(node); end # Categorize a node according to the {expected_order} @@ -7931,28 +7966,28 @@ class RuboCop::Cop::Layout::ClassStructure < ::RuboCop::Cop::Base # pkg:gem/rubocop#lib/rubocop/cop/layout/class_structure.rb:248 def find_send_node_category(node); end - # pkg:gem/rubocop#lib/rubocop/cop/layout/class_structure.rb:304 + # pkg:gem/rubocop#lib/rubocop/cop/layout/class_structure.rb:308 def humanize_node(node); end - # pkg:gem/rubocop#lib/rubocop/cop/layout/class_structure.rb:288 + # pkg:gem/rubocop#lib/rubocop/cop/layout/class_structure.rb:292 def ignore?(node, classification); end - # pkg:gem/rubocop#lib/rubocop/cop/layout/class_structure.rb:295 + # pkg:gem/rubocop#lib/rubocop/cop/layout/class_structure.rb:299 def ignore_for_autocorrect?(node, sibling); end - # pkg:gem/rubocop#lib/rubocop/cop/layout/class_structure.rb:331 + # pkg:gem/rubocop#lib/rubocop/cop/layout/class_structure.rb:335 def marked_as_private_constant?(node, name); end - # pkg:gem/rubocop#lib/rubocop/cop/layout/class_structure.rb:321 + # pkg:gem/rubocop#lib/rubocop/cop/layout/class_structure.rb:325 def private_constant?(node); end - # pkg:gem/rubocop#lib/rubocop/cop/layout/class_structure.rb:362 + # pkg:gem/rubocop#lib/rubocop/cop/layout/class_structure.rb:366 def start_line_position(node); end # pkg:gem/rubocop#lib/rubocop/cop/layout/class_structure.rb:267 def walk_over_nested_class_definition(class_node); end - # pkg:gem/rubocop#lib/rubocop/cop/layout/class_structure.rb:358 + # pkg:gem/rubocop#lib/rubocop/cop/layout/class_structure.rb:362 def whole_line_comment_at_line?(line); end end @@ -8312,8 +8347,15 @@ class RuboCop::Cop::Layout::ConditionPosition < ::RuboCop::Cop::Base # pkg:gem/rubocop#lib/rubocop/cop/layout/condition_position.rb:40 def check(node); end - # pkg:gem/rubocop#lib/rubocop/cop/layout/condition_position.rb:54 + # pkg:gem/rubocop#lib/rubocop/cop/layout/condition_position.rb:52 def message(condition); end + + # When a body statement shares the condition's line (e.g. `while\n cond; body\nend`), + # removing the whole line would delete the body too. In that case only remove the + # condition and its trailing separator, preserving the body statement. + # + # pkg:gem/rubocop#lib/rubocop/cop/layout/condition_position.rb:59 + def removal_range(node, condition); end end # pkg:gem/rubocop#lib/rubocop/cop/layout/condition_position.rb:25 @@ -8590,32 +8632,34 @@ class RuboCop::Cop::Layout::EmptyComment < ::RuboCop::Cop::Base private - # pkg:gem/rubocop#lib/rubocop/cop/layout/empty_comment.rb:133 + # pkg:gem/rubocop#lib/rubocop/cop/layout/empty_comment.rb:132 def allow_border_comment?; end - # pkg:gem/rubocop#lib/rubocop/cop/layout/empty_comment.rb:137 + # pkg:gem/rubocop#lib/rubocop/cop/layout/empty_comment.rb:136 def allow_margin_comment?; end # pkg:gem/rubocop#lib/rubocop/cop/layout/empty_comment.rb:97 def autocorrect(corrector, node); end - # pkg:gem/rubocop#lib/rubocop/cop/layout/empty_comment.rb:129 + # pkg:gem/rubocop#lib/rubocop/cop/layout/empty_comment.rb:128 def comment_text(comment); end - # pkg:gem/rubocop#lib/rubocop/cop/layout/empty_comment.rb:108 + # pkg:gem/rubocop#lib/rubocop/cop/layout/empty_comment.rb:107 def concat_consecutive_comments(comments); end - # pkg:gem/rubocop#lib/rubocop/cop/layout/empty_comment.rb:141 - def current_token(comment); end - - # pkg:gem/rubocop#lib/rubocop/cop/layout/empty_comment.rb:119 + # pkg:gem/rubocop#lib/rubocop/cop/layout/empty_comment.rb:118 def empty_comment_only?(comment_text); end + # A comment is inline when code precedes it on the same line. Detecting this + # from the source (rather than the token stream) is required because, for a + # comment trailing a heredoc opener, the preceding token is the heredoc end on + # a later line, which would wrongly trigger whole-line removal of the opener. + # + # pkg:gem/rubocop#lib/rubocop/cop/layout/empty_comment.rb:144 + def inline_comment?(comment); end + # pkg:gem/rubocop#lib/rubocop/cop/layout/empty_comment.rb:85 def investigate(comments); end - - # pkg:gem/rubocop#lib/rubocop/cop/layout/empty_comment.rb:145 - def previous_token(node); end end # pkg:gem/rubocop#lib/rubocop/cop/layout/empty_comment.rb:67 @@ -9031,13 +9075,13 @@ class RuboCop::Cop::Layout::EmptyLineBetweenDefs < ::RuboCop::Cop::Base private - # pkg:gem/rubocop#lib/rubocop/cop/layout/empty_line_between_defs.rb:305 + # pkg:gem/rubocop#lib/rubocop/cop/layout/empty_line_between_defs.rb:318 def allowance_range?; end - # pkg:gem/rubocop#lib/rubocop/cop/layout/empty_line_between_defs.rb:287 + # pkg:gem/rubocop#lib/rubocop/cop/layout/empty_line_between_defs.rb:300 def autocorrect_insert_lines(corrector, newline_pos, count); end - # pkg:gem/rubocop#lib/rubocop/cop/layout/empty_line_between_defs.rb:280 + # pkg:gem/rubocop#lib/rubocop/cop/layout/empty_line_between_defs.rb:293 def autocorrect_remove_lines(corrector, newline_pos, count); end # pkg:gem/rubocop#lib/rubocop/cop/layout/empty_line_between_defs.rb:242 @@ -9094,9 +9138,17 @@ class RuboCop::Cop::Layout::EmptyLineBetweenDefs < ::RuboCop::Cop::Base # pkg:gem/rubocop#lib/rubocop/cop/layout/empty_line_between_defs.rb:229 def multiple_blank_lines_groups?(first_def_node, second_def_node); end - # pkg:gem/rubocop#lib/rubocop/cop/layout/empty_line_between_defs.rb:294 + # pkg:gem/rubocop#lib/rubocop/cop/layout/empty_line_between_defs.rb:307 def node_type(node); end + # For an endless method whose body is a heredoc (e.g. `def a = <<~TEXT`), the + # node's source range ends at the heredoc opening line, before the heredoc body. + # Use the heredoc's closing delimiter so the def's real end is located after the + # heredoc and blank-line insertion does not land inside the heredoc body. + # + # pkg:gem/rubocop#lib/rubocop/cop/layout/empty_line_between_defs.rb:285 + def trailing_heredoc_end(node, end_location); end + class << self # pkg:gem/rubocop#lib/rubocop/cop/layout/empty_line_between_defs.rb:120 def autocorrect_incompatible_with; end @@ -10726,10 +10778,10 @@ RuboCop::Cop::Layout::FirstArrayElementLineBreak::MSG = T.let(T.unsafe(nil), Str # # bad # hash = { # key: :value -# } -# and_in_a_method_call({ -# no: :difference -# }) +# } +# in_a_method_call({ +# foo: :bar +# }) # takes_multi_pairs_hash(x: { # a: 1, # b: 2 @@ -10740,13 +10792,12 @@ RuboCop::Cop::Layout::FirstArrayElementLineBreak::MSG = T.let(T.unsafe(nil), Str # }) # # # good -# special_inside_parentheses # hash = { # key: :value # } -# but_in_a_method_call({ -# its_like: :this -# }) +# in_a_method_call({ +# foo: :bar +# }) # takes_multi_pairs_hash(x: { # a: 1, # b: 2 @@ -10765,17 +10816,17 @@ RuboCop::Cop::Layout::FirstArrayElementLineBreak::MSG = T.let(T.unsafe(nil), Str # # bad # hash = { # key: :value -# } -# but_in_a_method_call({ -# its_like: :this -# }) +# } +# in_a_method_call({ +# foo: :bar +# }) # # # good # hash = { # key: :value # } -# and_in_a_method_call({ -# no: :difference +# in_a_method_call({ +# foo: :bar # }) # # @@ -10809,58 +10860,58 @@ RuboCop::Cop::Layout::FirstArrayElementLineBreak::MSG = T.let(T.unsafe(nil), Str # d: 2 # }) # -# pkg:gem/rubocop#lib/rubocop/cop/layout/first_hash_element_indentation.rb:113 +# pkg:gem/rubocop#lib/rubocop/cop/layout/first_hash_element_indentation.rb:112 class RuboCop::Cop::Layout::FirstHashElementIndentation < ::RuboCop::Cop::Base include ::RuboCop::Cop::Alignment include ::RuboCop::Cop::ConfigurableEnforcedStyle include ::RuboCop::Cop::MultilineElementIndentation extend ::RuboCop::Cop::AutoCorrector - # pkg:gem/rubocop#lib/rubocop/cop/layout/first_hash_element_indentation.rb:133 + # pkg:gem/rubocop#lib/rubocop/cop/layout/first_hash_element_indentation.rb:132 def on_csend(node); end - # pkg:gem/rubocop#lib/rubocop/cop/layout/first_hash_element_indentation.rb:122 + # pkg:gem/rubocop#lib/rubocop/cop/layout/first_hash_element_indentation.rb:121 def on_hash(node); end - # pkg:gem/rubocop#lib/rubocop/cop/layout/first_hash_element_indentation.rb:126 + # pkg:gem/rubocop#lib/rubocop/cop/layout/first_hash_element_indentation.rb:125 def on_send(node); end private - # pkg:gem/rubocop#lib/rubocop/cop/layout/first_hash_element_indentation.rb:137 + # pkg:gem/rubocop#lib/rubocop/cop/layout/first_hash_element_indentation.rb:136 def autocorrect(corrector, node); end # Returns the description of what the correct indentation is based on. # - # pkg:gem/rubocop#lib/rubocop/cop/layout/first_hash_element_indentation.rb:197 + # pkg:gem/rubocop#lib/rubocop/cop/layout/first_hash_element_indentation.rb:196 def base_description(indent_base_type); end - # pkg:gem/rubocop#lib/rubocop/cop/layout/first_hash_element_indentation.rb:147 + # pkg:gem/rubocop#lib/rubocop/cop/layout/first_hash_element_indentation.rb:146 def brace_alignment_style; end - # pkg:gem/rubocop#lib/rubocop/cop/layout/first_hash_element_indentation.rb:151 + # pkg:gem/rubocop#lib/rubocop/cop/layout/first_hash_element_indentation.rb:150 def check(hash_node, left_parenthesis); end - # pkg:gem/rubocop#lib/rubocop/cop/layout/first_hash_element_indentation.rb:190 + # pkg:gem/rubocop#lib/rubocop/cop/layout/first_hash_element_indentation.rb:189 def check_based_on_longest_key(hash_node, left_brace, left_parenthesis); end - # pkg:gem/rubocop#lib/rubocop/cop/layout/first_hash_element_indentation.rb:170 + # pkg:gem/rubocop#lib/rubocop/cop/layout/first_hash_element_indentation.rb:169 def check_right_brace(right_brace, first_pair, left_brace, left_parenthesis); end - # pkg:gem/rubocop#lib/rubocop/cop/layout/first_hash_element_indentation.rb:233 + # pkg:gem/rubocop#lib/rubocop/cop/layout/first_hash_element_indentation.rb:232 def enforce_first_argument_with_fixed_indentation?; end - # pkg:gem/rubocop#lib/rubocop/cop/layout/first_hash_element_indentation.rb:210 + # pkg:gem/rubocop#lib/rubocop/cop/layout/first_hash_element_indentation.rb:209 def message(base_description); end - # pkg:gem/rubocop#lib/rubocop/cop/layout/first_hash_element_indentation.rb:218 + # pkg:gem/rubocop#lib/rubocop/cop/layout/first_hash_element_indentation.rb:217 def message_for_right_brace(indent_base_type); end - # pkg:gem/rubocop#lib/rubocop/cop/layout/first_hash_element_indentation.rb:184 + # pkg:gem/rubocop#lib/rubocop/cop/layout/first_hash_element_indentation.rb:183 def separator_style?(first_pair); end end -# pkg:gem/rubocop#lib/rubocop/cop/layout/first_hash_element_indentation.rb:119 +# pkg:gem/rubocop#lib/rubocop/cop/layout/first_hash_element_indentation.rb:118 RuboCop::Cop::Layout::FirstHashElementIndentation::MSG = T.let(T.unsafe(nil), String) # Checks for a line break before the first element in a @@ -11968,6 +12019,17 @@ RuboCop::Cop::Layout::IndentationStyle::MSG = T.let(T.unsafe(nil), String) # end # end # +# @example +# # bad +# value = ( +# foo - bar +# ) +# +# # good +# value = ( +# foo - bar +# ) +# # @example AllowedPatterns: ['^\s*module'] # # bad # module A @@ -12001,7 +12063,7 @@ RuboCop::Cop::Layout::IndentationStyle::MSG = T.let(T.unsafe(nil), String) # SomeJob.perform_later(message[:id]) # end # -# pkg:gem/rubocop#lib/rubocop/cop/layout/indentation_width.rb:60 +# pkg:gem/rubocop#lib/rubocop/cop/layout/indentation_width.rb:71 class RuboCop::Cop::Layout::IndentationWidth < ::RuboCop::Cop::Base include ::RuboCop::Cop::ConfigurableEnforcedStyle include ::RuboCop::Cop::RangeHelp @@ -12011,178 +12073,187 @@ class RuboCop::Cop::Layout::IndentationWidth < ::RuboCop::Cop::Base include ::RuboCop::Cop::AllowedPattern extend ::RuboCop::Cop::AutoCorrector - # pkg:gem/rubocop#lib/rubocop/cop/layout/indentation_width.rb:73 + # pkg:gem/rubocop#lib/rubocop/cop/layout/indentation_width.rb:84 def access_modifier?(param0 = T.unsafe(nil)); end - # pkg:gem/rubocop#lib/rubocop/cop/layout/indentation_width.rb:98 + # pkg:gem/rubocop#lib/rubocop/cop/layout/indentation_width.rb:109 + def on_begin(node); end + + # pkg:gem/rubocop#lib/rubocop/cop/layout/indentation_width.rb:119 def on_block(node); end - # pkg:gem/rubocop#lib/rubocop/cop/layout/indentation_width.rb:158 + # pkg:gem/rubocop#lib/rubocop/cop/layout/indentation_width.rb:179 def on_case(case_node); end - # pkg:gem/rubocop#lib/rubocop/cop/layout/indentation_width.rb:166 + # pkg:gem/rubocop#lib/rubocop/cop/layout/indentation_width.rb:187 def on_case_match(case_match); end - # pkg:gem/rubocop#lib/rubocop/cop/layout/indentation_width.rb:115 + # pkg:gem/rubocop#lib/rubocop/cop/layout/indentation_width.rb:136 def on_class(node); end - # pkg:gem/rubocop#lib/rubocop/cop/layout/indentation_width.rb:139 + # pkg:gem/rubocop#lib/rubocop/cop/layout/indentation_width.rb:160 def on_csend(node); end - # pkg:gem/rubocop#lib/rubocop/cop/layout/indentation_width.rb:141 + # pkg:gem/rubocop#lib/rubocop/cop/layout/indentation_width.rb:162 def on_def(node); end - # pkg:gem/rubocop#lib/rubocop/cop/layout/indentation_width.rb:146 + # pkg:gem/rubocop#lib/rubocop/cop/layout/indentation_width.rb:167 def on_defs(node); end - # pkg:gem/rubocop#lib/rubocop/cop/layout/indentation_width.rb:86 + # pkg:gem/rubocop#lib/rubocop/cop/layout/indentation_width.rb:97 def on_ensure(node); end - # pkg:gem/rubocop#lib/rubocop/cop/layout/indentation_width.rb:84 + # pkg:gem/rubocop#lib/rubocop/cop/layout/indentation_width.rb:95 def on_for(node); end - # pkg:gem/rubocop#lib/rubocop/cop/layout/indentation_width.rb:176 + # pkg:gem/rubocop#lib/rubocop/cop/layout/indentation_width.rb:197 def on_if(node, base = T.unsafe(nil)); end - # pkg:gem/rubocop#lib/rubocop/cop/layout/indentation_width.rb:113 + # pkg:gem/rubocop#lib/rubocop/cop/layout/indentation_width.rb:134 def on_itblock(node); end - # pkg:gem/rubocop#lib/rubocop/cop/layout/indentation_width.rb:90 + # pkg:gem/rubocop#lib/rubocop/cop/layout/indentation_width.rb:101 def on_kwbegin(node); end - # pkg:gem/rubocop#lib/rubocop/cop/layout/indentation_width.rb:122 + # pkg:gem/rubocop#lib/rubocop/cop/layout/indentation_width.rb:143 def on_module(node); end - # pkg:gem/rubocop#lib/rubocop/cop/layout/indentation_width.rb:112 + # pkg:gem/rubocop#lib/rubocop/cop/layout/indentation_width.rb:133 def on_numblock(node); end - # pkg:gem/rubocop#lib/rubocop/cop/layout/indentation_width.rb:81 + # pkg:gem/rubocop#lib/rubocop/cop/layout/indentation_width.rb:92 def on_resbody(node); end - # pkg:gem/rubocop#lib/rubocop/cop/layout/indentation_width.rb:77 + # pkg:gem/rubocop#lib/rubocop/cop/layout/indentation_width.rb:88 def on_rescue(node); end - # pkg:gem/rubocop#lib/rubocop/cop/layout/indentation_width.rb:121 + # pkg:gem/rubocop#lib/rubocop/cop/layout/indentation_width.rb:142 def on_sclass(node); end - # pkg:gem/rubocop#lib/rubocop/cop/layout/indentation_width.rb:124 + # pkg:gem/rubocop#lib/rubocop/cop/layout/indentation_width.rb:145 def on_send(node); end - # pkg:gem/rubocop#lib/rubocop/cop/layout/indentation_width.rb:156 + # pkg:gem/rubocop#lib/rubocop/cop/layout/indentation_width.rb:177 def on_until(node, base = T.unsafe(nil)); end - # pkg:gem/rubocop#lib/rubocop/cop/layout/indentation_width.rb:148 + # pkg:gem/rubocop#lib/rubocop/cop/layout/indentation_width.rb:169 def on_while(node, base = T.unsafe(nil)); end private - # pkg:gem/rubocop#lib/rubocop/cop/layout/indentation_width.rb:249 + # pkg:gem/rubocop#lib/rubocop/cop/layout/indentation_width.rb:277 def access_modifier_indentation_style; end - # pkg:gem/rubocop#lib/rubocop/cop/layout/indentation_width.rb:185 + # pkg:gem/rubocop#lib/rubocop/cop/layout/indentation_width.rb:206 def autocorrect(corrector, node); end - # pkg:gem/rubocop#lib/rubocop/cop/layout/indentation_width.rb:475 + # pkg:gem/rubocop#lib/rubocop/cop/layout/indentation_width.rb:503 def block_body_indentation_base(node, end_loc); end - # pkg:gem/rubocop#lib/rubocop/cop/layout/indentation_width.rb:257 + # pkg:gem/rubocop#lib/rubocop/cop/layout/indentation_width.rb:285 def check_assignment(node, rhs); end - # pkg:gem/rubocop#lib/rubocop/cop/layout/indentation_width.rb:277 + # pkg:gem/rubocop#lib/rubocop/cop/layout/indentation_width.rb:305 def check_if(node, body, else_clause, base_loc); end - # pkg:gem/rubocop#lib/rubocop/cop/layout/indentation_width.rb:290 + # pkg:gem/rubocop#lib/rubocop/cop/layout/indentation_width.rb:318 def check_indentation(base_loc, body_node, style = T.unsafe(nil)); end - # pkg:gem/rubocop#lib/rubocop/cop/layout/indentation_width.rb:191 + # pkg:gem/rubocop#lib/rubocop/cop/layout/indentation_width.rb:219 def check_members(base, members); end - # pkg:gem/rubocop#lib/rubocop/cop/layout/indentation_width.rb:215 + # pkg:gem/rubocop#lib/rubocop/cop/layout/indentation_width.rb:243 def check_members_for_indented_internal_methods_style(members); end - # pkg:gem/rubocop#lib/rubocop/cop/layout/indentation_width.rb:221 + # pkg:gem/rubocop#lib/rubocop/cop/layout/indentation_width.rb:249 def check_members_for_normal_style(base, members); end - # pkg:gem/rubocop#lib/rubocop/cop/layout/indentation_width.rb:384 + # pkg:gem/rubocop#lib/rubocop/cop/layout/indentation_width.rb:412 def check_rescue?(rescue_node); end - # pkg:gem/rubocop#lib/rubocop/cop/layout/indentation_width.rb:440 + # pkg:gem/rubocop#lib/rubocop/cop/layout/indentation_width.rb:468 def column_offset_between(base_range, range); end - # pkg:gem/rubocop#lib/rubocop/cop/layout/indentation_width.rb:426 + # pkg:gem/rubocop#lib/rubocop/cop/layout/indentation_width.rb:454 def contains_access_modifier?(body_node); end - # pkg:gem/rubocop#lib/rubocop/cop/layout/indentation_width.rb:487 + # pkg:gem/rubocop#lib/rubocop/cop/layout/indentation_width.rb:515 def dot_on_new_line?(node); end - # pkg:gem/rubocop#lib/rubocop/cop/layout/indentation_width.rb:229 + # pkg:gem/rubocop#lib/rubocop/cop/layout/indentation_width.rb:257 def each_member(members); end - # pkg:gem/rubocop#lib/rubocop/cop/layout/indentation_width.rb:253 + # pkg:gem/rubocop#lib/rubocop/cop/layout/indentation_width.rb:281 def indentation_consistency_style; end - # pkg:gem/rubocop#lib/rubocop/cop/layout/indentation_width.rb:432 + # pkg:gem/rubocop#lib/rubocop/cop/layout/indentation_width.rb:460 def indentation_style; end - # pkg:gem/rubocop#lib/rubocop/cop/layout/indentation_width.rb:367 + # pkg:gem/rubocop#lib/rubocop/cop/layout/indentation_width.rb:395 def indentation_to_check?(base_loc, body_node); end - # pkg:gem/rubocop#lib/rubocop/cop/layout/indentation_width.rb:241 + # pkg:gem/rubocop#lib/rubocop/cop/layout/indentation_width.rb:269 def indented_internal_methods_style?; end - # pkg:gem/rubocop#lib/rubocop/cop/layout/indentation_width.rb:469 + # pkg:gem/rubocop#lib/rubocop/cop/layout/indentation_width.rb:497 def leftmost_modifier_of(node); end - # pkg:gem/rubocop#lib/rubocop/cop/layout/indentation_width.rb:451 + # pkg:gem/rubocop#lib/rubocop/cop/layout/indentation_width.rb:479 def line_indentation(range); end - # pkg:gem/rubocop#lib/rubocop/cop/layout/indentation_width.rb:456 + # pkg:gem/rubocop#lib/rubocop/cop/layout/indentation_width.rb:484 def line_uses_tabs?(range); end - # pkg:gem/rubocop#lib/rubocop/cop/layout/indentation_width.rb:324 + # pkg:gem/rubocop#lib/rubocop/cop/layout/indentation_width.rb:352 def message(configured_indentation_width, indentation, name); end - # pkg:gem/rubocop#lib/rubocop/cop/layout/indentation_width.rb:345 + # pkg:gem/rubocop#lib/rubocop/cop/layout/indentation_width.rb:373 def message_for_spaces(configured_indentation_width, indentation, name); end - # pkg:gem/rubocop#lib/rubocop/cop/layout/indentation_width.rb:332 + # pkg:gem/rubocop#lib/rubocop/cop/layout/indentation_width.rb:360 def message_for_tabs(configured_indentation_width, indentation, name); end - # pkg:gem/rubocop#lib/rubocop/cop/layout/indentation_width.rb:403 + # pkg:gem/rubocop#lib/rubocop/cop/layout/indentation_width.rb:431 def offending_range(body_node, indentation); end - # pkg:gem/rubocop#lib/rubocop/cop/layout/indentation_width.rb:300 + # pkg:gem/rubocop#lib/rubocop/cop/layout/indentation_width.rb:328 def offense(body_node, indentation, style); end + # Returns a range at the first non-space column of the line the opening parenthesis is on, + # used as the base to indent the body from. + # + # pkg:gem/rubocop#lib/rubocop/cop/layout/indentation_width.rb:214 + def opening_line_start(begin_loc); end + # Returns true if the given node is within another node that has # already been marked for autocorrection by this cop. # - # pkg:gem/rubocop#lib/rubocop/cop/layout/indentation_width.rb:357 + # pkg:gem/rubocop#lib/rubocop/cop/layout/indentation_width.rb:385 def other_offense_in_same_range?(node); end - # pkg:gem/rubocop#lib/rubocop/cop/layout/indentation_width.rb:203 + # pkg:gem/rubocop#lib/rubocop/cop/layout/indentation_width.rb:231 def select_check_member(member); end - # pkg:gem/rubocop#lib/rubocop/cop/layout/indentation_width.rb:495 + # pkg:gem/rubocop#lib/rubocop/cop/layout/indentation_width.rb:523 def selector_on_new_line?(node); end - # pkg:gem/rubocop#lib/rubocop/cop/layout/indentation_width.rb:388 + # pkg:gem/rubocop#lib/rubocop/cop/layout/indentation_width.rb:416 def skip_check?(base_loc, body_node); end - # pkg:gem/rubocop#lib/rubocop/cop/layout/indentation_width.rb:245 + # pkg:gem/rubocop#lib/rubocop/cop/layout/indentation_width.rb:273 def special_modifier?(node); end - # pkg:gem/rubocop#lib/rubocop/cop/layout/indentation_width.rb:417 + # pkg:gem/rubocop#lib/rubocop/cop/layout/indentation_width.rb:445 def starts_with_access_modifier?(body_node); end - # pkg:gem/rubocop#lib/rubocop/cop/layout/indentation_width.rb:436 + # pkg:gem/rubocop#lib/rubocop/cop/layout/indentation_width.rb:464 def using_tabs?; end - # pkg:gem/rubocop#lib/rubocop/cop/layout/indentation_width.rb:460 + # pkg:gem/rubocop#lib/rubocop/cop/layout/indentation_width.rb:488 def visual_column(range); end end -# pkg:gem/rubocop#lib/rubocop/cop/layout/indentation_width.rb:69 +# pkg:gem/rubocop#lib/rubocop/cop/layout/indentation_width.rb:80 RuboCop::Cop::Layout::IndentationWidth::MSG = T.let(T.unsafe(nil), String) # Checks for indentation of the first non-blank non-comment @@ -15174,7 +15245,7 @@ class RuboCop::Cop::Layout::SpaceAroundOperators < ::RuboCop::Cop::Base private - # pkg:gem/rubocop#lib/rubocop/cop/layout/space_around_operators.rb:266 + # pkg:gem/rubocop#lib/rubocop/cop/layout/space_around_operators.rb:270 def align_hash_cop_config; end # pkg:gem/rubocop#lib/rubocop/cop/layout/space_around_operators.rb:205 @@ -15183,25 +15254,25 @@ class RuboCop::Cop::Layout::SpaceAroundOperators < ::RuboCop::Cop::Base # pkg:gem/rubocop#lib/rubocop/cop/layout/space_around_operators.rb:186 def check_operator(type, operator, right_operand); end - # pkg:gem/rubocop#lib/rubocop/cop/layout/space_around_operators.rb:219 + # pkg:gem/rubocop#lib/rubocop/cop/layout/space_around_operators.rb:223 def enclose_operator_with_space(corrector, range); end - # pkg:gem/rubocop#lib/rubocop/cop/layout/space_around_operators.rb:246 + # pkg:gem/rubocop#lib/rubocop/cop/layout/space_around_operators.rb:250 def excess_leading_space?(type, operator, with_space); end - # pkg:gem/rubocop#lib/rubocop/cop/layout/space_around_operators.rb:261 + # pkg:gem/rubocop#lib/rubocop/cop/layout/space_around_operators.rb:265 def excess_trailing_space?(right_operand, with_space); end - # pkg:gem/rubocop#lib/rubocop/cop/layout/space_around_operators.rb:287 + # pkg:gem/rubocop#lib/rubocop/cop/layout/space_around_operators.rb:291 def force_equal_sign_alignment?; end - # pkg:gem/rubocop#lib/rubocop/cop/layout/space_around_operators.rb:270 + # pkg:gem/rubocop#lib/rubocop/cop/layout/space_around_operators.rb:274 def hash_table_style?; end # pkg:gem/rubocop#lib/rubocop/cop/layout/space_around_operators.rb:200 def offense(type, operator, with_space, right_operand); end - # pkg:gem/rubocop#lib/rubocop/cop/layout/space_around_operators.rb:232 + # pkg:gem/rubocop#lib/rubocop/cop/layout/space_around_operators.rb:236 def offense_message(type, operator, with_space, right_operand); end # pkg:gem/rubocop#lib/rubocop/cop/layout/space_around_operators.rb:182 @@ -15210,13 +15281,13 @@ class RuboCop::Cop::Layout::SpaceAroundOperators < ::RuboCop::Cop::Base # pkg:gem/rubocop#lib/rubocop/cop/layout/space_around_operators.rb:176 def regular_operator?(send_node); end - # pkg:gem/rubocop#lib/rubocop/cop/layout/space_around_operators.rb:291 + # pkg:gem/rubocop#lib/rubocop/cop/layout/space_around_operators.rb:295 def should_not_have_surrounding_space?(operator, right_operand); end - # pkg:gem/rubocop#lib/rubocop/cop/layout/space_around_operators.rb:277 + # pkg:gem/rubocop#lib/rubocop/cop/layout/space_around_operators.rb:281 def space_around_exponent_operator?; end - # pkg:gem/rubocop#lib/rubocop/cop/layout/space_around_operators.rb:281 + # pkg:gem/rubocop#lib/rubocop/cop/layout/space_around_operators.rb:285 def space_around_slash_operator?(right_operand); end class << self @@ -16626,11 +16697,6 @@ class RuboCop::Cop::Lint::AmbiguousAssignment < ::RuboCop::Cop::Base # pkg:gem/rubocop#lib/rubocop/cop/lint/ambiguous_assignment.rb:40 def on_lvasgn(node); end - - private - - # pkg:gem/rubocop#lib/rubocop/cop/lint/ambiguous_assignment.rb:44 - def rhs(node); end end # pkg:gem/rubocop#lib/rubocop/cop/lint/ambiguous_assignment.rb:28 @@ -16799,30 +16865,27 @@ RuboCop::Cop::Lint::AmbiguousOperator::MSG_FORMAT = T.let(T.unsafe(nil), String) class RuboCop::Cop::Lint::AmbiguousOperatorPrecedence < ::RuboCop::Cop::Base extend ::RuboCop::Cop::AutoCorrector - # pkg:gem/rubocop#lib/rubocop/cop/lint/ambiguous_operator_precedence.rb:54 - def on_and(node); end - # pkg:gem/rubocop#lib/rubocop/cop/lint/ambiguous_operator_precedence.rb:47 - def on_new_investigation; end + def on_and(node); end - # pkg:gem/rubocop#lib/rubocop/cop/lint/ambiguous_operator_precedence.rb:65 + # pkg:gem/rubocop#lib/rubocop/cop/lint/ambiguous_operator_precedence.rb:58 def on_send(node); end private - # pkg:gem/rubocop#lib/rubocop/cop/lint/ambiguous_operator_precedence.rb:105 + # pkg:gem/rubocop#lib/rubocop/cop/lint/ambiguous_operator_precedence.rb:96 def autocorrect(corrector, node); end - # pkg:gem/rubocop#lib/rubocop/cop/lint/ambiguous_operator_precedence.rb:89 + # pkg:gem/rubocop#lib/rubocop/cop/lint/ambiguous_operator_precedence.rb:80 def greater_precedence?(node1, node2); end - # pkg:gem/rubocop#lib/rubocop/cop/lint/ambiguous_operator_precedence.rb:85 + # pkg:gem/rubocop#lib/rubocop/cop/lint/ambiguous_operator_precedence.rb:76 def operator?(node); end - # pkg:gem/rubocop#lib/rubocop/cop/lint/ambiguous_operator_precedence.rb:97 + # pkg:gem/rubocop#lib/rubocop/cop/lint/ambiguous_operator_precedence.rb:88 def operator_name(node); end - # pkg:gem/rubocop#lib/rubocop/cop/lint/ambiguous_operator_precedence.rb:79 + # pkg:gem/rubocop#lib/rubocop/cop/lint/ambiguous_operator_precedence.rb:72 def precedence(node); end end @@ -17101,16 +17164,24 @@ class RuboCop::Cop::Lint::AssignmentInCondition < ::RuboCop::Cop::Base # pkg:gem/rubocop#lib/rubocop/cop/lint/assignment_in_condition.rb:80 def allowed_construct?(asgn_node); end - # pkg:gem/rubocop#lib/rubocop/cop/lint/assignment_in_condition.rb:84 + # pkg:gem/rubocop#lib/rubocop/cop/lint/assignment_in_condition.rb:86 def conditional_assignment?(asgn_node); end + # An assignment that is a statement of a multi-statement `begin` + # (e.g. `(foo = bar; baz)`) has its value discarded, so it is not used + # as the condition. Wrapping it in parentheses would only conflict with + # `Style/RedundantParentheses`, so it is left alone. + # + # pkg:gem/rubocop#lib/rubocop/cop/lint/assignment_in_condition.rb:94 + def discarded_assignment?(asgn_node); end + # pkg:gem/rubocop#lib/rubocop/cop/lint/assignment_in_condition.rb:72 def message(_node); end - # pkg:gem/rubocop#lib/rubocop/cop/lint/assignment_in_condition.rb:88 + # pkg:gem/rubocop#lib/rubocop/cop/lint/assignment_in_condition.rb:100 def skip_children?(asgn_node); end - # pkg:gem/rubocop#lib/rubocop/cop/lint/assignment_in_condition.rb:94 + # pkg:gem/rubocop#lib/rubocop/cop/lint/assignment_in_condition.rb:106 def traverse_node(node, &block); end end @@ -17315,7 +17386,7 @@ class RuboCop::Cop::Lint::CircularArgumentReference < ::RuboCop::Cop::Base private - # pkg:gem/rubocop#lib/rubocop/cop/lint/circular_argument_reference.rb:84 + # pkg:gem/rubocop#lib/rubocop/cop/lint/circular_argument_reference.rb:83 def check_assignment_chain(arg_name, node); end # pkg:gem/rubocop#lib/rubocop/cop/lint/circular_argument_reference.rb:73 @@ -17840,39 +17911,36 @@ RuboCop::Cop::Lint::DataDefineOverride::RESTRICT_ON_SEND = T.let(T.unsafe(nil), # # pkg:gem/rubocop#lib/rubocop/cop/lint/debugger.rb:74 class RuboCop::Cop::Lint::Debugger < ::RuboCop::Cop::Base - # pkg:gem/rubocop#lib/rubocop/cop/lint/debugger.rb:78 + # pkg:gem/rubocop#lib/rubocop/cop/lint/debugger.rb:77 def on_send(node); end private - # pkg:gem/rubocop#lib/rubocop/cop/lint/debugger.rb:136 + # pkg:gem/rubocop#lib/rubocop/cop/lint/debugger.rb:135 def assumed_argument?(node); end - # pkg:gem/rubocop#lib/rubocop/cop/lint/debugger.rb:115 + # pkg:gem/rubocop#lib/rubocop/cop/lint/debugger.rb:114 def assumed_usage_context?(node); end - # pkg:gem/rubocop#lib/rubocop/cop/lint/debugger.rb:125 + # pkg:gem/rubocop#lib/rubocop/cop/lint/debugger.rb:124 def chained_method_name(send_node); end - # pkg:gem/rubocop#lib/rubocop/cop/lint/debugger.rb:104 + # pkg:gem/rubocop#lib/rubocop/cop/lint/debugger.rb:103 def debugger_method?(send_node); end - # pkg:gem/rubocop#lib/rubocop/cop/lint/debugger.rb:90 + # pkg:gem/rubocop#lib/rubocop/cop/lint/debugger.rb:89 def debugger_methods; end - # pkg:gem/rubocop#lib/rubocop/cop/lint/debugger.rb:108 + # pkg:gem/rubocop#lib/rubocop/cop/lint/debugger.rb:107 def debugger_require?(send_node); end - # pkg:gem/rubocop#lib/rubocop/cop/lint/debugger.rb:97 + # pkg:gem/rubocop#lib/rubocop/cop/lint/debugger.rb:96 def debugger_requires; end - # pkg:gem/rubocop#lib/rubocop/cop/lint/debugger.rb:86 + # pkg:gem/rubocop#lib/rubocop/cop/lint/debugger.rb:85 def message(node); end end -# pkg:gem/rubocop#lib/rubocop/cop/lint/debugger.rb:76 -RuboCop::Cop::Lint::Debugger::BLOCK_TYPES = T.let(T.unsafe(nil), Array) - # pkg:gem/rubocop#lib/rubocop/cop/lint/debugger.rb:75 RuboCop::Cop::Lint::Debugger::MSG = T.let(T.unsafe(nil), String) @@ -17984,13 +18052,10 @@ class RuboCop::Cop::Lint::DeprecatedConstants < ::RuboCop::Cop::Base private - # pkg:gem/rubocop#lib/rubocop/cop/lint/deprecated_constants.rb:66 - def constant_name(node, nested_constant_name); end - - # pkg:gem/rubocop#lib/rubocop/cop/lint/deprecated_constants.rb:82 + # pkg:gem/rubocop#lib/rubocop/cop/lint/deprecated_constants.rb:76 def deprecated_constants; end - # pkg:gem/rubocop#lib/rubocop/cop/lint/deprecated_constants.rb:72 + # pkg:gem/rubocop#lib/rubocop/cop/lint/deprecated_constants.rb:66 def message(good, bad, deprecated_version); end end @@ -19585,6 +19650,16 @@ RuboCop::Cop::Lint::EmptyWhen::MSG = T.let(T.unsafe(nil), String) class RuboCop::Cop::Lint::EnsureReturn < ::RuboCop::Cop::Base # pkg:gem/rubocop#lib/rubocop/cop/lint/ensure_return.rb:45 def on_ensure(node); end + + private + + # A `return` inside a nested method definition or lambda within the + # `ensure` returns from that inner scope, not from the method whose + # `ensure` this is, so it is not an offense. A `return` inside a plain + # block (or `proc`) does propagate out, so it remains an offense. + # + # pkg:gem/rubocop#lib/rubocop/cop/lint/ensure_return.rb:59 + def return_from_inner_scope?(return_node, ensure_node); end end # pkg:gem/rubocop#lib/rubocop/cop/lint/ensure_return.rb:43 @@ -19783,13 +19858,13 @@ class RuboCop::Cop::Lint::FloatComparison < ::RuboCop::Cop::Base # pkg:gem/rubocop#lib/rubocop/cop/lint/float_comparison.rb:90 def float?(node); end - # pkg:gem/rubocop#lib/rubocop/cop/lint/float_comparison.rb:111 + # pkg:gem/rubocop#lib/rubocop/cop/lint/float_comparison.rb:112 def float_send?(node); end # pkg:gem/rubocop#lib/rubocop/cop/lint/float_comparison.rb:105 def literal_safe?(node); end - # pkg:gem/rubocop#lib/rubocop/cop/lint/float_comparison.rb:122 + # pkg:gem/rubocop#lib/rubocop/cop/lint/float_comparison.rb:123 def numeric_returning_method?(node); end end @@ -20238,11 +20313,14 @@ class RuboCop::Cop::Lint::IncompatibleIoSelectWithFiberScheduler < ::RuboCop::Co private - # pkg:gem/rubocop#lib/rubocop/cop/lint/incompatible_io_select_with_fiber_scheduler.rb:69 + # pkg:gem/rubocop#lib/rubocop/cop/lint/incompatible_io_select_with_fiber_scheduler.rb:73 def preferred_method(read, write, timeout); end # pkg:gem/rubocop#lib/rubocop/cop/lint/incompatible_io_select_with_fiber_scheduler.rb:63 def scheduler_compatible?(io1, io2); end + + # pkg:gem/rubocop#lib/rubocop/cop/lint/incompatible_io_select_with_fiber_scheduler.rb:69 + def single_io_array?(node); end end # pkg:gem/rubocop#lib/rubocop/cop/lint/incompatible_io_select_with_fiber_scheduler.rb:37 @@ -20421,18 +20499,28 @@ RuboCop::Cop::Lint::InheritException::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Ar class RuboCop::Cop::Lint::InterpolationCheck < ::RuboCop::Cop::Base extend ::RuboCop::Cop::AutoCorrector - # pkg:gem/rubocop#lib/rubocop/cop/lint/interpolation_check.rb:28 + # A multiline single-quoted string is parsed as a `dstr` of `str` segments, so it + # is not covered by `on_str`. Inspect single-quoted `dstr`s here; double-quoted + # interpolation is also a `dstr`, hence the delimiter check. + # + # pkg:gem/rubocop#lib/rubocop/cop/lint/interpolation_check.rb:34 + def on_dstr(node); end + + # pkg:gem/rubocop#lib/rubocop/cop/lint/interpolation_check.rb:27 def on_str(node); end private - # pkg:gem/rubocop#lib/rubocop/cop/lint/interpolation_check.rb:41 + # pkg:gem/rubocop#lib/rubocop/cop/lint/interpolation_check.rb:56 def autocorrect(corrector, node); end - # pkg:gem/rubocop#lib/rubocop/cop/lint/interpolation_check.rb:52 + # pkg:gem/rubocop#lib/rubocop/cop/lint/interpolation_check.rb:45 + def check(node); end + + # pkg:gem/rubocop#lib/rubocop/cop/lint/interpolation_check.rb:67 def heredoc?(node); end - # pkg:gem/rubocop#lib/rubocop/cop/lint/interpolation_check.rb:56 + # pkg:gem/rubocop#lib/rubocop/cop/lint/interpolation_check.rb:71 def valid_syntax?(node); end end @@ -20669,15 +20757,21 @@ class RuboCop::Cop::Lint::LiteralAssignmentInCondition < ::RuboCop::Cop::Base private - # pkg:gem/rubocop#lib/rubocop/cop/lint/literal_assignment_in_condition.rb:62 + # pkg:gem/rubocop#lib/rubocop/cop/lint/literal_assignment_in_condition.rb:72 def all_literals?(node); end - # pkg:gem/rubocop#lib/rubocop/cop/lint/literal_assignment_in_condition.rb:79 + # pkg:gem/rubocop#lib/rubocop/cop/lint/literal_assignment_in_condition.rb:89 def offense_range(asgn_node, rhs); end - # pkg:gem/rubocop#lib/rubocop/cop/lint/literal_assignment_in_condition.rb:75 + # pkg:gem/rubocop#lib/rubocop/cop/lint/literal_assignment_in_condition.rb:85 def parallel_assignment_with_splat_operator?(node); end + # An assignment inside a block or method body within the condition belongs to + # that inner scope rather than the condition itself, so it is not inspected. + # + # pkg:gem/rubocop#lib/rubocop/cop/lint/literal_assignment_in_condition.rb:68 + def scope_body?(node, child); end + # pkg:gem/rubocop#lib/rubocop/cop/lint/literal_assignment_in_condition.rb:56 def traverse_node(node, &block); end end @@ -20716,31 +20810,34 @@ class RuboCop::Cop::Lint::LiteralInInterpolation < ::RuboCop::Cop::Base # pkg:gem/rubocop#lib/rubocop/cop/lint/literal_in_interpolation.rb:78 def autocorrected_value(node); end - # pkg:gem/rubocop#lib/rubocop/cop/lint/literal_in_interpolation.rb:145 + # pkg:gem/rubocop#lib/rubocop/cop/lint/literal_in_interpolation.rb:142 def autocorrected_value_for_array(node); end - # pkg:gem/rubocop#lib/rubocop/cop/lint/literal_in_interpolation.rb:151 + # pkg:gem/rubocop#lib/rubocop/cop/lint/literal_in_interpolation.rb:148 def autocorrected_value_for_hash(node); end # pkg:gem/rubocop#lib/rubocop/cop/lint/literal_in_interpolation.rb:121 def autocorrected_value_for_string(node); end - # pkg:gem/rubocop#lib/rubocop/cop/lint/literal_in_interpolation.rb:129 + # pkg:gem/rubocop#lib/rubocop/cop/lint/literal_in_interpolation.rb:131 def autocorrected_value_for_symbol(node); end - # pkg:gem/rubocop#lib/rubocop/cop/lint/literal_in_interpolation.rb:162 + # pkg:gem/rubocop#lib/rubocop/cop/lint/literal_in_interpolation.rb:159 def autocorrected_value_in_hash(node); end - # pkg:gem/rubocop#lib/rubocop/cop/lint/literal_in_interpolation.rb:136 + # pkg:gem/rubocop#lib/rubocop/cop/lint/literal_in_interpolation.rb:138 def autocorrected_value_in_hash_for_symbol(node); end - # pkg:gem/rubocop#lib/rubocop/cop/lint/literal_in_interpolation.rb:192 + # pkg:gem/rubocop#lib/rubocop/cop/lint/literal_in_interpolation.rb:189 def ends_heredoc_line?(node); end + # pkg:gem/rubocop#lib/rubocop/cop/lint/literal_in_interpolation.rb:127 + def escape_string_content(string); end + # pkg:gem/rubocop#lib/rubocop/cop/lint/literal_in_interpolation.rb:100 def handle_special_regexp_chars(begin_node, value); end - # pkg:gem/rubocop#lib/rubocop/cop/lint/literal_in_interpolation.rb:200 + # pkg:gem/rubocop#lib/rubocop/cop/lint/literal_in_interpolation.rb:197 def in_array_percent_literal?(node); end # pkg:gem/rubocop#lib/rubocop/cop/lint/literal_in_interpolation.rb:57 @@ -20748,10 +20845,10 @@ class RuboCop::Cop::Lint::LiteralInInterpolation < ::RuboCop::Cop::Base # Does node print its own source when converted to a string? # - # pkg:gem/rubocop#lib/rubocop/cop/lint/literal_in_interpolation.rb:183 + # pkg:gem/rubocop#lib/rubocop/cop/lint/literal_in_interpolation.rb:180 def prints_as_self?(node); end - # pkg:gem/rubocop#lib/rubocop/cop/lint/literal_in_interpolation.rb:188 + # pkg:gem/rubocop#lib/rubocop/cop/lint/literal_in_interpolation.rb:185 def space_literal?(node); end # pkg:gem/rubocop#lib/rubocop/cop/lint/literal_in_interpolation.rb:67 @@ -20831,7 +20928,7 @@ RuboCop::Cop::Lint::Loop::MSG = T.let(T.unsafe(nil), String) # cop disables on wide ranges of code, that later contributors to # a file wouldn't be aware of. # -# You can set `MaximumRangeSize` to define the maximum number of +# You can set `MaxRangeSize` to define the maximum number of # consecutive lines a cop can be disabled for. # # - `.inf` any size (default) @@ -20843,7 +20940,7 @@ RuboCop::Cop::Lint::Loop::MSG = T.let(T.unsafe(nil), String) # a = 1 # ---- # -# @example MaximumRangeSize: .inf (default) +# @example MaxRangeSize: .inf (default) # # # good # x= 0 @@ -20854,7 +20951,7 @@ RuboCop::Cop::Lint::Loop::MSG = T.let(T.unsafe(nil), String) # x= 0 # # EOF # -# @example MaximumRangeSize: 2 +# @example MaxRangeSize: 2 # # # good # x= 0 @@ -21406,26 +21503,36 @@ RuboCop::Cop::Lint::NextWithoutAccumulator::MSG = T.let(T.unsafe(nil), String) # # pkg:gem/rubocop#lib/rubocop/cop/lint/no_return_in_begin_end_blocks.rb:38 class RuboCop::Cop::Lint::NoReturnInBeginEndBlocks < ::RuboCop::Cop::Base - # pkg:gem/rubocop#lib/rubocop/cop/lint/no_return_in_begin_end_blocks.rb:51 + # pkg:gem/rubocop#lib/rubocop/cop/lint/no_return_in_begin_end_blocks.rb:53 def on_casgn(node); end - # pkg:gem/rubocop#lib/rubocop/cop/lint/no_return_in_begin_end_blocks.rb:49 + # pkg:gem/rubocop#lib/rubocop/cop/lint/no_return_in_begin_end_blocks.rb:51 def on_cvasgn(node); end - # pkg:gem/rubocop#lib/rubocop/cop/lint/no_return_in_begin_end_blocks.rb:50 + # pkg:gem/rubocop#lib/rubocop/cop/lint/no_return_in_begin_end_blocks.rb:52 def on_gvasgn(node); end - # pkg:gem/rubocop#lib/rubocop/cop/lint/no_return_in_begin_end_blocks.rb:48 + # pkg:gem/rubocop#lib/rubocop/cop/lint/no_return_in_begin_end_blocks.rb:50 def on_ivasgn(node); end # pkg:gem/rubocop#lib/rubocop/cop/lint/no_return_in_begin_end_blocks.rb:41 def on_lvasgn(node); end - # pkg:gem/rubocop#lib/rubocop/cop/lint/no_return_in_begin_end_blocks.rb:53 + # pkg:gem/rubocop#lib/rubocop/cop/lint/no_return_in_begin_end_blocks.rb:55 def on_op_asgn(node); end - # pkg:gem/rubocop#lib/rubocop/cop/lint/no_return_in_begin_end_blocks.rb:52 + # pkg:gem/rubocop#lib/rubocop/cop/lint/no_return_in_begin_end_blocks.rb:54 def on_or_asgn(node); end + + private + + # A `return` inside a nested method definition or lambda within the + # `begin..end` returns from that inner scope rather than the assignment + # context, so it is not an offense. A `return` inside a plain block (or + # `proc`) does propagate out, so it remains an offense. + # + # pkg:gem/rubocop#lib/rubocop/cop/lint/no_return_in_begin_end_blocks.rb:63 + def return_from_inner_scope?(return_node, kwbegin_node); end end # pkg:gem/rubocop#lib/rubocop/cop/lint/no_return_in_begin_end_blocks.rb:39 @@ -21789,7 +21896,7 @@ RuboCop::Cop::Lint::NonLocalExitFromIterator::MSG = T.let(T.unsafe(nil), String) # # good # 10.minutes.to_i # -# @example IgnoredClasses: [Time, DateTime] (default) +# @example AllowedClasses: [Time, DateTime] (default) # # # good # Time.now.to_datetime.to_i @@ -21814,13 +21921,13 @@ class RuboCop::Cop::Lint::NumberConversion < ::RuboCop::Cop::Base private - # pkg:gem/rubocop#lib/rubocop/cop/lint/number_conversion.rb:164 + # pkg:gem/rubocop#lib/rubocop/cop/lint/number_conversion.rb:173 def allow_receiver?(receiver); end - # pkg:gem/rubocop#lib/rubocop/cop/lint/number_conversion.rb:176 + # pkg:gem/rubocop#lib/rubocop/cop/lint/number_conversion.rb:185 def allowed_method_name?(name); end - # pkg:gem/rubocop#lib/rubocop/cop/lint/number_conversion.rb:186 + # pkg:gem/rubocop#lib/rubocop/cop/lint/number_conversion.rb:195 def conversion_method?(method_name); end # pkg:gem/rubocop#lib/rubocop/cop/lint/number_conversion.rb:150 @@ -21829,22 +21936,28 @@ class RuboCop::Cop::Lint::NumberConversion < ::RuboCop::Cop::Base # pkg:gem/rubocop#lib/rubocop/cop/lint/number_conversion.rb:154 def correct_sym_method(to_method); end + # pkg:gem/rubocop#lib/rubocop/cop/lint/number_conversion.rb:159 + def current_method(node, receiver, to_method); end + # pkg:gem/rubocop#lib/rubocop/cop/lint/number_conversion.rb:133 def handle_as_symbol(node); end # pkg:gem/rubocop#lib/rubocop/cop/lint/number_conversion.rb:114 def handle_conversion_method(node); end - # pkg:gem/rubocop#lib/rubocop/cop/lint/number_conversion.rb:194 + # pkg:gem/rubocop#lib/rubocop/cop/lint/number_conversion.rb:203 def ignored_class?(name); end - # pkg:gem/rubocop#lib/rubocop/cop/lint/number_conversion.rb:190 + # pkg:gem/rubocop#lib/rubocop/cop/lint/number_conversion.rb:199 def ignored_classes; end - # pkg:gem/rubocop#lib/rubocop/cop/lint/number_conversion.rb:159 + # pkg:gem/rubocop#lib/rubocop/cop/lint/number_conversion.rb:164 def remove_parentheses(corrector, node); end - # pkg:gem/rubocop#lib/rubocop/cop/lint/number_conversion.rb:180 + # pkg:gem/rubocop#lib/rubocop/cop/lint/number_conversion.rb:169 + def safe_navigation?(node); end + + # pkg:gem/rubocop#lib/rubocop/cop/lint/number_conversion.rb:189 def top_receiver(node); end end @@ -21946,10 +22059,10 @@ class RuboCop::Cop::Lint::NumericOperationWithConstantResult < ::RuboCop::Cop::B # pkg:gem/rubocop#lib/rubocop/cop/lint/numeric_operation_with_constant_result.rb:57 def abbreviated_assignment_with_constant_result?(param0 = T.unsafe(nil)); end - # pkg:gem/rubocop#lib/rubocop/cop/lint/numeric_operation_with_constant_result.rb:68 + # pkg:gem/rubocop#lib/rubocop/cop/lint/numeric_operation_with_constant_result.rb:71 def on_csend(node); end - # pkg:gem/rubocop#lib/rubocop/cop/lint/numeric_operation_with_constant_result.rb:70 + # pkg:gem/rubocop#lib/rubocop/cop/lint/numeric_operation_with_constant_result.rb:73 def on_op_asgn(node); end # pkg:gem/rubocop#lib/rubocop/cop/lint/numeric_operation_with_constant_result.rb:60 @@ -21960,7 +22073,7 @@ class RuboCop::Cop::Lint::NumericOperationWithConstantResult < ::RuboCop::Cop::B private - # pkg:gem/rubocop#lib/rubocop/cop/lint/numeric_operation_with_constant_result.rb:81 + # pkg:gem/rubocop#lib/rubocop/cop/lint/numeric_operation_with_constant_result.rb:84 def constant_result?(lhs, operation, rhs); end end @@ -22030,7 +22143,7 @@ class RuboCop::Cop::Lint::OrderedMagicComments < ::RuboCop::Cop::Base private # pkg:gem/rubocop#lib/rubocop/cop/lint/ordered_magic_comments.rb:55 - def autocorrect(corrector, encoding_line, frozen_string_literal_line); end + def autocorrect(corrector, encoding_line, other_magic_comment_line); end # pkg:gem/rubocop#lib/rubocop/cop/lint/ordered_magic_comments.rb:63 def magic_comment_lines; end @@ -22353,7 +22466,7 @@ RuboCop::Cop::Lint::RaiseException::MSG = T.let(T.unsafe(nil), String) RuboCop::Cop::Lint::RaiseException::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array) # Checks for `rand(1)` calls. -# Such calls always return `0`. +# Such calls always return `0`, and so do `rand(-1)`, `rand(1.0)`, and `rand(-1.0)`. # # @example # @@ -22422,7 +22535,7 @@ class RuboCop::Cop::Lint::RedundantCopDisableDirective < ::RuboCop::Cop::Base private - # pkg:gem/rubocop#lib/rubocop/cop/lint/redundant_cop_disable_directive.rb:337 + # pkg:gem/rubocop#lib/rubocop/cop/lint/redundant_cop_disable_directive.rb:340 def add_department_marker(department); end # pkg:gem/rubocop#lib/rubocop/cop/lint/redundant_cop_disable_directive.rb:243 @@ -22434,7 +22547,7 @@ class RuboCop::Cop::Lint::RedundantCopDisableDirective < ::RuboCop::Cop::Base # pkg:gem/rubocop#lib/rubocop/cop/lint/redundant_cop_disable_directive.rb:233 def add_offenses(redundant_cops); end - # pkg:gem/rubocop#lib/rubocop/cop/lint/redundant_cop_disable_directive.rb:320 + # pkg:gem/rubocop#lib/rubocop/cop/lint/redundant_cop_disable_directive.rb:323 def all_cop_names; end # pkg:gem/rubocop#lib/rubocop/cop/lint/redundant_cop_disable_directive.rb:204 @@ -22452,10 +22565,10 @@ class RuboCop::Cop::Lint::RedundantCopDisableDirective < ::RuboCop::Cop::Base # pkg:gem/rubocop#lib/rubocop/cop/lint/redundant_cop_disable_directive.rb:224 def department_disabled?(cop, comment); end - # pkg:gem/rubocop#lib/rubocop/cop/lint/redundant_cop_disable_directive.rb:329 + # pkg:gem/rubocop#lib/rubocop/cop/lint/redundant_cop_disable_directive.rb:332 def department_marker?(department); end - # pkg:gem/rubocop#lib/rubocop/cop/lint/redundant_cop_disable_directive.rb:307 + # pkg:gem/rubocop#lib/rubocop/cop/lint/redundant_cop_disable_directive.rb:310 def describe(cop); end # pkg:gem/rubocop#lib/rubocop/cop/lint/redundant_cop_disable_directive.rb:229 @@ -22476,7 +22589,7 @@ class RuboCop::Cop::Lint::RedundantCopDisableDirective < ::RuboCop::Cop::Base # pkg:gem/rubocop#lib/rubocop/cop/lint/redundant_cop_disable_directive.rb:106 def each_redundant_disable(&block); end - # pkg:gem/rubocop#lib/rubocop/cop/lint/redundant_cop_disable_directive.rb:324 + # pkg:gem/rubocop#lib/rubocop/cop/lint/redundant_cop_disable_directive.rb:327 def ends_its_line?(range); end # pkg:gem/rubocop#lib/rubocop/cop/lint/redundant_cop_disable_directive.rb:216 @@ -22506,7 +22619,7 @@ class RuboCop::Cop::Lint::RedundantCopDisableDirective < ::RuboCop::Cop::Base # pkg:gem/rubocop#lib/rubocop/cop/lint/redundant_cop_disable_directive.rb:285 def matching_range(haystack, needle); end - # pkg:gem/rubocop#lib/rubocop/cop/lint/redundant_cop_disable_directive.rb:316 + # pkg:gem/rubocop#lib/rubocop/cop/lint/redundant_cop_disable_directive.rb:319 def message(cop_names); end # pkg:gem/rubocop#lib/rubocop/cop/lint/redundant_cop_disable_directive.rb:65 @@ -22515,7 +22628,7 @@ class RuboCop::Cop::Lint::RedundantCopDisableDirective < ::RuboCop::Cop::Base # pkg:gem/rubocop#lib/rubocop/cop/lint/redundant_cop_disable_directive.rb:200 def range_with_offense?(range, offenses = T.unsafe(nil)); end - # pkg:gem/rubocop#lib/rubocop/cop/lint/redundant_cop_disable_directive.rb:333 + # pkg:gem/rubocop#lib/rubocop/cop/lint/redundant_cop_disable_directive.rb:336 def remove_department_marker(department); end # pkg:gem/rubocop#lib/rubocop/cop/lint/redundant_cop_disable_directive.rb:126 @@ -22524,7 +22637,7 @@ class RuboCop::Cop::Lint::RedundantCopDisableDirective < ::RuboCop::Cop::Base # pkg:gem/rubocop#lib/rubocop/cop/lint/redundant_cop_disable_directive.rb:130 def skip_directive?(comment); end - # pkg:gem/rubocop#lib/rubocop/cop/lint/redundant_cop_disable_directive.rb:293 + # pkg:gem/rubocop#lib/rubocop/cop/lint/redundant_cop_disable_directive.rb:296 def trailing_range?(ranges, range); end end @@ -22534,7 +22647,7 @@ RuboCop::Cop::Lint::RedundantCopDisableDirective::COP_NAME = T.let(T.unsafe(nil) # pkg:gem/rubocop#lib/rubocop/cop/lint/redundant_cop_disable_directive.rb:33 RuboCop::Cop::Lint::RedundantCopDisableDirective::DEPARTMENT_MARKER = T.let(T.unsafe(nil), String) -# pkg:gem/rubocop#lib/rubocop/cop/lint/redundant_cop_disable_directive.rb:301 +# pkg:gem/rubocop#lib/rubocop/cop/lint/redundant_cop_disable_directive.rb:304 RuboCop::Cop::Lint::RedundantCopDisableDirective::SIMILAR_COP_NAMES_CACHE = T.let(T.unsafe(nil), Hash) # removed. @@ -22568,7 +22681,7 @@ class RuboCop::Cop::Lint::RedundantCopEnableDirective < ::RuboCop::Cop::Base private - # pkg:gem/rubocop#lib/rubocop/cop/lint/redundant_cop_enable_directive.rb:116 + # pkg:gem/rubocop#lib/rubocop/cop/lint/redundant_cop_enable_directive.rb:119 def all_or_name(name); end # pkg:gem/rubocop#lib/rubocop/cop/lint/redundant_cop_enable_directive.rb:72 @@ -22577,25 +22690,25 @@ class RuboCop::Cop::Lint::RedundantCopEnableDirective < ::RuboCop::Cop::Base # pkg:gem/rubocop#lib/rubocop/cop/lint/redundant_cop_enable_directive.rb:76 def cop_name_indention(comment, name); end - # pkg:gem/rubocop#lib/rubocop/cop/lint/redundant_cop_enable_directive.rb:120 + # pkg:gem/rubocop#lib/rubocop/cop/lint/redundant_cop_enable_directive.rb:123 def department?(directive, name); end # pkg:gem/rubocop#lib/rubocop/cop/lint/redundant_cop_enable_directive.rb:67 def range_of_offense(comment, name); end - # pkg:gem/rubocop#lib/rubocop/cop/lint/redundant_cop_enable_directive.rb:91 + # pkg:gem/rubocop#lib/rubocop/cop/lint/redundant_cop_enable_directive.rb:94 def range_to_remove(begin_pos, end_pos, comment); end - # pkg:gem/rubocop#lib/rubocop/cop/lint/redundant_cop_enable_directive.rb:80 + # pkg:gem/rubocop#lib/rubocop/cop/lint/redundant_cop_enable_directive.rb:83 def range_with_comma(comment, name); end # If the list of cops is comma-separated, but without an empty space after the comma, # we should **not** remove the prepending empty space, thus begin_pos += 1 # - # pkg:gem/rubocop#lib/rubocop/cop/lint/redundant_cop_enable_directive.rb:110 + # pkg:gem/rubocop#lib/rubocop/cop/lint/redundant_cop_enable_directive.rb:113 def range_with_comma_after(comment, start, begin_pos, end_pos); end - # pkg:gem/rubocop#lib/rubocop/cop/lint/redundant_cop_enable_directive.rb:104 + # pkg:gem/rubocop#lib/rubocop/cop/lint/redundant_cop_enable_directive.rb:107 def range_with_comma_before(start, begin_pos, end_pos); end # pkg:gem/rubocop#lib/rubocop/cop/lint/redundant_cop_enable_directive.rb:49 @@ -22640,7 +22753,13 @@ class RuboCop::Cop::Lint::RedundantDirGlobSort < ::RuboCop::Cop::Base private # pkg:gem/rubocop#lib/rubocop/cop/lint/redundant_dir_glob_sort.rb:56 + def dir_glob?(receiver); end + + # pkg:gem/rubocop#lib/rubocop/cop/lint/redundant_dir_glob_sort.rb:63 def multiple_argument?(glob_method); end + + # pkg:gem/rubocop#lib/rubocop/cop/lint/redundant_dir_glob_sort.rb:67 + def sort_with_comparator?(node); end end # pkg:gem/rubocop#lib/rubocop/cop/lint/redundant_dir_glob_sort.rb:38 @@ -22938,10 +23057,10 @@ class RuboCop::Cop::Lint::RedundantSafeNavigation < ::RuboCop::Cop::Base # pkg:gem/rubocop#lib/rubocop/cop/lint/redundant_safe_navigation.rb:183 def conversion_with_default?(param0 = T.unsafe(nil)); end - # pkg:gem/rubocop#lib/rubocop/cop/lint/redundant_safe_navigation.rb:195 + # pkg:gem/rubocop#lib/rubocop/cop/lint/redundant_safe_navigation.rb:194 def on_csend(node); end - # pkg:gem/rubocop#lib/rubocop/cop/lint/redundant_safe_navigation.rb:217 + # pkg:gem/rubocop#lib/rubocop/cop/lint/redundant_safe_navigation.rb:212 def on_or(node); end # pkg:gem/rubocop#lib/rubocop/cop/lint/redundant_safe_navigation.rb:178 @@ -22949,22 +23068,27 @@ class RuboCop::Cop::Lint::RedundantSafeNavigation < ::RuboCop::Cop::Base private - # pkg:gem/rubocop#lib/rubocop/cop/lint/redundant_safe_navigation.rb:269 + # pkg:gem/rubocop#lib/rubocop/cop/lint/redundant_safe_navigation.rb:276 def additional_nil_methods; end - # pkg:gem/rubocop#lib/rubocop/cop/lint/redundant_safe_navigation.rb:233 + # pkg:gem/rubocop#lib/rubocop/cop/lint/redundant_safe_navigation.rb:240 def assume_receiver_instance_exists?(receiver); end - # pkg:gem/rubocop#lib/rubocop/cop/lint/redundant_safe_navigation.rb:250 + # pkg:gem/rubocop#lib/rubocop/cop/lint/redundant_safe_navigation.rb:257 def check?(node); end - # pkg:gem/rubocop#lib/rubocop/cop/lint/redundant_safe_navigation.rb:261 + # pkg:gem/rubocop#lib/rubocop/cop/lint/redundant_safe_navigation.rb:268 def condition?(parent, node); end - # pkg:gem/rubocop#lib/rubocop/cop/lint/redundant_safe_navigation.rb:239 + # pkg:gem/rubocop#lib/rubocop/cop/lint/redundant_safe_navigation.rb:246 def guaranteed_instance?(node); end - # pkg:gem/rubocop#lib/rubocop/cop/lint/redundant_safe_navigation.rb:265 + # Returns true when the `&.` is meaningful because the receiver may actually be nil. + # + # pkg:gem/rubocop#lib/rubocop/cop/lint/redundant_safe_navigation.rb:229 + def guarded_by_nil_receiver?(node); end + + # pkg:gem/rubocop#lib/rubocop/cop/lint/redundant_safe_navigation.rb:272 def infer_non_nil_receiver?; end end @@ -23066,40 +23190,40 @@ class RuboCop::Cop::Lint::RedundantSplatExpansion < ::RuboCop::Cop::Base private - # pkg:gem/rubocop#lib/rubocop/cop/lint/redundant_splat_expansion.rb:210 + # pkg:gem/rubocop#lib/rubocop/cop/lint/redundant_splat_expansion.rb:214 def allow_percent_literal_array_argument?; end - # pkg:gem/rubocop#lib/rubocop/cop/lint/redundant_splat_expansion.rb:131 + # pkg:gem/rubocop#lib/rubocop/cop/lint/redundant_splat_expansion.rb:135 def array_new_inside_array_literal?(array_new_node); end - # pkg:gem/rubocop#lib/rubocop/cop/lint/redundant_splat_expansion.rb:158 + # pkg:gem/rubocop#lib/rubocop/cop/lint/redundant_splat_expansion.rb:162 def array_splat?(node); end # pkg:gem/rubocop#lib/rubocop/cop/lint/redundant_splat_expansion.rb:112 def autocorrect(corrector, node); end - # pkg:gem/rubocop#lib/rubocop/cop/lint/redundant_splat_expansion.rb:162 + # pkg:gem/rubocop#lib/rubocop/cop/lint/redundant_splat_expansion.rb:166 def method_argument?(node); end - # pkg:gem/rubocop#lib/rubocop/cop/lint/redundant_splat_expansion.rb:166 + # pkg:gem/rubocop#lib/rubocop/cop/lint/redundant_splat_expansion.rb:170 def part_of_an_array?(node); end - # pkg:gem/rubocop#lib/rubocop/cop/lint/redundant_splat_expansion.rb:173 + # pkg:gem/rubocop#lib/rubocop/cop/lint/redundant_splat_expansion.rb:177 def redundant_brackets?(node); end # pkg:gem/rubocop#lib/rubocop/cop/lint/redundant_splat_expansion.rb:118 def redundant_splat_expansion(node); end - # pkg:gem/rubocop#lib/rubocop/cop/lint/redundant_splat_expansion.rb:185 + # pkg:gem/rubocop#lib/rubocop/cop/lint/redundant_splat_expansion.rb:189 def remove_brackets(array); end - # pkg:gem/rubocop#lib/rubocop/cop/lint/redundant_splat_expansion.rb:139 + # pkg:gem/rubocop#lib/rubocop/cop/lint/redundant_splat_expansion.rb:143 def replacement_range_and_content(node); end - # pkg:gem/rubocop#lib/rubocop/cop/lint/redundant_splat_expansion.rb:203 + # pkg:gem/rubocop#lib/rubocop/cop/lint/redundant_splat_expansion.rb:207 def use_percent_literal_array_argument?(node); end - # pkg:gem/rubocop#lib/rubocop/cop/lint/redundant_splat_expansion.rb:181 + # pkg:gem/rubocop#lib/rubocop/cop/lint/redundant_splat_expansion.rb:185 def wrap_in_brackets?(node); end end @@ -23185,6 +23309,7 @@ RuboCop::Cop::Lint::RedundantStringCoercion::RESTRICT_ON_SEND = T.let(T.unsafe(n # * `to_sym` when called on a symbol literal or interpolated symbol. # * `to_i` when called on an integer literal or with `Integer()`. # * `to_f` when called on a float literal or with `Float()`. +# * `to_d` when called with `BigDecimal()`. # * `to_r` when called on a rational literal or with `Rational()`. # * `to_c` when called on a complex literal or with `Complex()`. # * `to_a` when called on an array literal, or with `Array.new`, `Array()` or `Array[]`. @@ -23230,6 +23355,12 @@ RuboCop::Cop::Lint::RedundantStringCoercion::RESTRICT_ON_SEND = T.let(T.unsafe(n # # in this case, `Integer()` could return `nil` # Integer(var, exception: false).to_i # +# # bad +# BigDecimal(var).to_d +# +# # good +# BigDecimal(var) +# # # bad - chaining the same conversion # foo.to_s.to_s # @@ -23244,97 +23375,97 @@ RuboCop::Cop::Lint::RedundantStringCoercion::RESTRICT_ON_SEND = T.let(T.unsafe(n # foo.inspect # foo.to_json # -# pkg:gem/rubocop#lib/rubocop/cop/lint/redundant_type_conversion.rb:80 +# pkg:gem/rubocop#lib/rubocop/cop/lint/redundant_type_conversion.rb:87 class RuboCop::Cop::Lint::RedundantTypeConversion < ::RuboCop::Cop::Base extend ::RuboCop::Cop::AutoCorrector - # pkg:gem/rubocop#lib/rubocop/cop/lint/redundant_type_conversion.rb:160 + # pkg:gem/rubocop#lib/rubocop/cop/lint/redundant_type_conversion.rb:167 def array_constructor?(param0 = T.unsafe(nil)); end - # pkg:gem/rubocop#lib/rubocop/cop/lint/redundant_type_conversion.rb:145 + # pkg:gem/rubocop#lib/rubocop/cop/lint/redundant_type_conversion.rb:152 def bigdecimal_constructor?(param0 = T.unsafe(nil)); end - # pkg:gem/rubocop#lib/rubocop/cop/lint/redundant_type_conversion.rb:155 + # pkg:gem/rubocop#lib/rubocop/cop/lint/redundant_type_conversion.rb:162 def complex_constructor?(param0 = T.unsafe(nil)); end - # pkg:gem/rubocop#lib/rubocop/cop/lint/redundant_type_conversion.rb:184 + # pkg:gem/rubocop#lib/rubocop/cop/lint/redundant_type_conversion.rb:191 def exception_false_keyword_argument?(param0 = T.unsafe(nil)); end - # pkg:gem/rubocop#lib/rubocop/cop/lint/redundant_type_conversion.rb:140 + # pkg:gem/rubocop#lib/rubocop/cop/lint/redundant_type_conversion.rb:147 def float_constructor?(param0 = T.unsafe(nil)); end - # pkg:gem/rubocop#lib/rubocop/cop/lint/redundant_type_conversion.rb:168 + # pkg:gem/rubocop#lib/rubocop/cop/lint/redundant_type_conversion.rb:175 def hash_constructor?(param0 = T.unsafe(nil)); end - # pkg:gem/rubocop#lib/rubocop/cop/lint/redundant_type_conversion.rb:135 + # pkg:gem/rubocop#lib/rubocop/cop/lint/redundant_type_conversion.rb:142 def integer_constructor?(param0 = T.unsafe(nil)); end - # pkg:gem/rubocop#lib/rubocop/cop/lint/redundant_type_conversion.rb:205 + # pkg:gem/rubocop#lib/rubocop/cop/lint/redundant_type_conversion.rb:212 def on_csend(node); end - # pkg:gem/rubocop#lib/rubocop/cop/lint/redundant_type_conversion.rb:189 + # pkg:gem/rubocop#lib/rubocop/cop/lint/redundant_type_conversion.rb:196 def on_send(node); end - # pkg:gem/rubocop#lib/rubocop/cop/lint/redundant_type_conversion.rb:150 + # pkg:gem/rubocop#lib/rubocop/cop/lint/redundant_type_conversion.rb:157 def rational_constructor?(param0 = T.unsafe(nil)); end - # pkg:gem/rubocop#lib/rubocop/cop/lint/redundant_type_conversion.rb:177 + # pkg:gem/rubocop#lib/rubocop/cop/lint/redundant_type_conversion.rb:184 def set_constructor?(param0 = T.unsafe(nil)); end - # pkg:gem/rubocop#lib/rubocop/cop/lint/redundant_type_conversion.rb:127 + # pkg:gem/rubocop#lib/rubocop/cop/lint/redundant_type_conversion.rb:134 def string_constructor?(param0 = T.unsafe(nil)); end - # pkg:gem/rubocop#lib/rubocop/cop/lint/redundant_type_conversion.rb:122 + # pkg:gem/rubocop#lib/rubocop/cop/lint/redundant_type_conversion.rb:129 def type_constructor?(param0 = T.unsafe(nil), param1); end private - # pkg:gem/rubocop#lib/rubocop/cop/lint/redundant_type_conversion.rb:247 + # pkg:gem/rubocop#lib/rubocop/cop/lint/redundant_type_conversion.rb:254 def chained_conversion?(node, receiver); end - # pkg:gem/rubocop#lib/rubocop/cop/lint/redundant_type_conversion.rb:253 + # pkg:gem/rubocop#lib/rubocop/cop/lint/redundant_type_conversion.rb:260 def chained_to_typed_method?(node, receiver); end - # pkg:gem/rubocop#lib/rubocop/cop/lint/redundant_type_conversion.rb:234 + # pkg:gem/rubocop#lib/rubocop/cop/lint/redundant_type_conversion.rb:241 def constructor?(node, receiver); end - # pkg:gem/rubocop#lib/rubocop/cop/lint/redundant_type_conversion.rb:241 + # pkg:gem/rubocop#lib/rubocop/cop/lint/redundant_type_conversion.rb:248 def constructor_suppresses_exceptions?(receiver); end - # pkg:gem/rubocop#lib/rubocop/cop/lint/redundant_type_conversion.rb:215 + # pkg:gem/rubocop#lib/rubocop/cop/lint/redundant_type_conversion.rb:222 def find_receiver(node); end - # pkg:gem/rubocop#lib/rubocop/cop/lint/redundant_type_conversion.rb:209 + # pkg:gem/rubocop#lib/rubocop/cop/lint/redundant_type_conversion.rb:216 def hash_or_set_with_block?(node); end - # pkg:gem/rubocop#lib/rubocop/cop/lint/redundant_type_conversion.rb:228 + # pkg:gem/rubocop#lib/rubocop/cop/lint/redundant_type_conversion.rb:235 def literal_receiver?(node, receiver); end end # Maps each conversion method to the pattern matcher for that type's constructors # Not every type has a constructor, for instance Symbol. # -# pkg:gem/rubocop#lib/rubocop/cop/lint/redundant_type_conversion.rb:100 +# pkg:gem/rubocop#lib/rubocop/cop/lint/redundant_type_conversion.rb:107 RuboCop::Cop::Lint::RedundantTypeConversion::CONSTRUCTOR_MAPPING = T.let(T.unsafe(nil), Hash) -# pkg:gem/rubocop#lib/rubocop/cop/lint/redundant_type_conversion.rb:116 +# pkg:gem/rubocop#lib/rubocop/cop/lint/redundant_type_conversion.rb:123 RuboCop::Cop::Lint::RedundantTypeConversion::CONVERSION_METHODS = T.let(T.unsafe(nil), Set) # Maps conversion methods to the node types for the literals of that type # -# pkg:gem/rubocop#lib/rubocop/cop/lint/redundant_type_conversion.rb:86 +# pkg:gem/rubocop#lib/rubocop/cop/lint/redundant_type_conversion.rb:93 RuboCop::Cop::Lint::RedundantTypeConversion::LITERAL_NODE_TYPES = T.let(T.unsafe(nil), Hash) -# pkg:gem/rubocop#lib/rubocop/cop/lint/redundant_type_conversion.rb:83 +# pkg:gem/rubocop#lib/rubocop/cop/lint/redundant_type_conversion.rb:90 RuboCop::Cop::Lint::RedundantTypeConversion::MSG = T.let(T.unsafe(nil), String) -# pkg:gem/rubocop#lib/rubocop/cop/lint/redundant_type_conversion.rb:117 +# pkg:gem/rubocop#lib/rubocop/cop/lint/redundant_type_conversion.rb:124 RuboCop::Cop::Lint::RedundantTypeConversion::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Set) # Methods that already are expected to return a given type, which makes a further # conversion redundant. # -# pkg:gem/rubocop#lib/rubocop/cop/lint/redundant_type_conversion.rb:114 +# pkg:gem/rubocop#lib/rubocop/cop/lint/redundant_type_conversion.rb:121 RuboCop::Cop::Lint::RedundantTypeConversion::TYPED_METHODS = T.let(T.unsafe(nil), Hash) # Checks for redundant `with_index`. @@ -23394,6 +23525,11 @@ RuboCop::Cop::Lint::RedundantWithIndex::MSG_WITH_INDEX = T.let(T.unsafe(nil), St # Checks for redundant `with_object`. # +# @safety +# This cop's autocorrection is unsafe because the return value changes: +# `each_with_object` returns the memo object, while the corrected `each` returns +# the receiver. This matters when the result of the expression is used. +# # @example # # bad # ary.each_with_object([]) do |v| @@ -23415,36 +23551,36 @@ RuboCop::Cop::Lint::RedundantWithIndex::MSG_WITH_INDEX = T.let(T.unsafe(nil), St # v # end # -# pkg:gem/rubocop#lib/rubocop/cop/lint/redundant_with_object.rb:29 +# pkg:gem/rubocop#lib/rubocop/cop/lint/redundant_with_object.rb:34 class RuboCop::Cop::Lint::RedundantWithObject < ::RuboCop::Cop::Base include ::RuboCop::Cop::RangeHelp extend ::RuboCop::Cop::AutoCorrector - # pkg:gem/rubocop#lib/rubocop/cop/lint/redundant_with_object.rb:36 + # pkg:gem/rubocop#lib/rubocop/cop/lint/redundant_with_object.rb:41 def on_block(node); end - # pkg:gem/rubocop#lib/rubocop/cop/lint/redundant_with_object.rb:52 + # pkg:gem/rubocop#lib/rubocop/cop/lint/redundant_with_object.rb:57 def on_itblock(node); end - # pkg:gem/rubocop#lib/rubocop/cop/lint/redundant_with_object.rb:51 + # pkg:gem/rubocop#lib/rubocop/cop/lint/redundant_with_object.rb:56 def on_numblock(node); end - # pkg:gem/rubocop#lib/rubocop/cop/lint/redundant_with_object.rb:57 + # pkg:gem/rubocop#lib/rubocop/cop/lint/redundant_with_object.rb:62 def redundant_with_object?(param0 = T.unsafe(nil)); end private - # pkg:gem/rubocop#lib/rubocop/cop/lint/redundant_with_object.rb:68 + # pkg:gem/rubocop#lib/rubocop/cop/lint/redundant_with_object.rb:73 def message(node); end - # pkg:gem/rubocop#lib/rubocop/cop/lint/redundant_with_object.rb:76 + # pkg:gem/rubocop#lib/rubocop/cop/lint/redundant_with_object.rb:81 def with_object_range(send); end end -# pkg:gem/rubocop#lib/rubocop/cop/lint/redundant_with_object.rb:33 +# pkg:gem/rubocop#lib/rubocop/cop/lint/redundant_with_object.rb:38 RuboCop::Cop::Lint::RedundantWithObject::MSG_EACH_WITH_OBJECT = T.let(T.unsafe(nil), String) -# pkg:gem/rubocop#lib/rubocop/cop/lint/redundant_with_object.rb:34 +# pkg:gem/rubocop#lib/rubocop/cop/lint/redundant_with_object.rb:39 RuboCop::Cop::Lint::RedundantWithObject::MSG_WITH_OBJECT = T.let(T.unsafe(nil), String) # Checks if `include` or `prepend` is called in `refine` block. @@ -23477,16 +23613,20 @@ RuboCop::Cop::Lint::RedundantWithObject::MSG_WITH_OBJECT = T.let(T.unsafe(nil), # # pkg:gem/rubocop#lib/rubocop/cop/lint/refinement_import_methods.rb:34 class RuboCop::Cop::Lint::RefinementImportMethods < ::RuboCop::Cop::Base + extend ::RuboCop::Cop::AutoCorrector extend ::RuboCop::Cop::TargetRubyVersion - # pkg:gem/rubocop#lib/rubocop/cop/lint/refinement_import_methods.rb:42 + # pkg:gem/rubocop#lib/rubocop/cop/lint/refinement_import_methods.rb:45 def on_send(node); end end -# pkg:gem/rubocop#lib/rubocop/cop/lint/refinement_import_methods.rb:37 +# pkg:gem/rubocop#lib/rubocop/cop/lint/refinement_import_methods.rb:38 RuboCop::Cop::Lint::RefinementImportMethods::MSG = T.let(T.unsafe(nil), String) -# pkg:gem/rubocop#lib/rubocop/cop/lint/refinement_import_methods.rb:38 +# pkg:gem/rubocop#lib/rubocop/cop/lint/refinement_import_methods.rb:39 +RuboCop::Cop::Lint::RefinementImportMethods::MSG_REMOVED = T.let(T.unsafe(nil), String) + +# pkg:gem/rubocop#lib/rubocop/cop/lint/refinement_import_methods.rb:41 RuboCop::Cop::Lint::RefinementImportMethods::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array) # Checks for regexp literals used as `match-current-line`. @@ -23514,10 +23654,13 @@ end # pkg:gem/rubocop#lib/rubocop/cop/lint/regexp_as_condition.rb:22 RuboCop::Cop::Lint::RegexpAsCondition::MSG = T.let(T.unsafe(nil), String) -# Checks for expressions where there is a call to a predicate -# method with at least one argument, where no parentheses are used around -# the parameter list, and a boolean operator, && or ||, is used in the -# last argument. +# Checks for method calls with at least one argument where no parentheses +# are used around the parameter list, and the call could be misread as an +# operand of a boolean operator (`&&` or `||`). Two forms are flagged: +# +# * a predicate method whose last argument is a `&&`/`||` expression, and +# * any method whose first argument is a ternary expression with a +# `&&`/`||` condition. # # The idea behind warning for these constructs is that the user might # be under the impression that the return value from the method call is @@ -23535,26 +23678,32 @@ RuboCop::Cop::Lint::RegexpAsCondition::MSG = T.let(T.unsafe(nil), String) # # ... # end # -# pkg:gem/rubocop#lib/rubocop/cop/lint/require_parentheses.rb:26 +# # bad +# foo a && b ? c : d +# +# # good +# foo(a && b ? c : d) +# +# pkg:gem/rubocop#lib/rubocop/cop/lint/require_parentheses.rb:35 class RuboCop::Cop::Lint::RequireParentheses < ::RuboCop::Cop::Base include ::RuboCop::Cop::RangeHelp - # pkg:gem/rubocop#lib/rubocop/cop/lint/require_parentheses.rb:40 + # pkg:gem/rubocop#lib/rubocop/cop/lint/require_parentheses.rb:49 def on_csend(node); end - # pkg:gem/rubocop#lib/rubocop/cop/lint/require_parentheses.rb:31 + # pkg:gem/rubocop#lib/rubocop/cop/lint/require_parentheses.rb:40 def on_send(node); end private - # pkg:gem/rubocop#lib/rubocop/cop/lint/require_parentheses.rb:54 + # pkg:gem/rubocop#lib/rubocop/cop/lint/require_parentheses.rb:63 def check_predicate(predicate, node); end - # pkg:gem/rubocop#lib/rubocop/cop/lint/require_parentheses.rb:44 + # pkg:gem/rubocop#lib/rubocop/cop/lint/require_parentheses.rb:53 def check_ternary(ternary, node); end end -# pkg:gem/rubocop#lib/rubocop/cop/lint/require_parentheses.rb:29 +# pkg:gem/rubocop#lib/rubocop/cop/lint/require_parentheses.rb:38 RuboCop::Cop::Lint::RequireParentheses::MSG = T.let(T.unsafe(nil), String) # Checks that a range literal is enclosed in parentheses when the end of the range is @@ -23593,10 +23742,10 @@ RuboCop::Cop::Lint::RequireParentheses::MSG = T.let(T.unsafe(nil), String) # # pkg:gem/rubocop#lib/rubocop/cop/lint/require_range_parentheses.rb:40 class RuboCop::Cop::Lint::RequireRangeParentheses < ::RuboCop::Cop::Base - # pkg:gem/rubocop#lib/rubocop/cop/lint/require_range_parentheses.rb:53 + # pkg:gem/rubocop#lib/rubocop/cop/lint/require_range_parentheses.rb:54 def on_erange(node); end - # pkg:gem/rubocop#lib/rubocop/cop/lint/require_range_parentheses.rb:43 + # pkg:gem/rubocop#lib/rubocop/cop/lint/require_range_parentheses.rb:44 def on_irange(node); end end @@ -23628,9 +23777,6 @@ class RuboCop::Cop::Lint::RequireRelativeSelfPath < ::RuboCop::Cop::Base private - # pkg:gem/rubocop#lib/rubocop/cop/lint/require_relative_self_path.rb:46 - def remove_ext(file_path); end - # pkg:gem/rubocop#lib/rubocop/cop/lint/require_relative_self_path.rb:40 def same_file?(file_path, required_feature); end end @@ -23799,7 +23945,7 @@ class RuboCop::Cop::Lint::SafeNavigationChain < ::RuboCop::Cop::Base # pkg:gem/rubocop#lib/rubocop/cop/lint/safe_navigation_chain.rb:33 def bad_method?(param0 = T.unsafe(nil)); end - # pkg:gem/rubocop#lib/rubocop/cop/lint/safe_navigation_chain.rb:41 + # pkg:gem/rubocop#lib/rubocop/cop/lint/safe_navigation_chain.rb:42 def on_send(node); end private @@ -23808,32 +23954,32 @@ class RuboCop::Cop::Lint::SafeNavigationChain < ::RuboCop::Cop::Base # @param [RuboCop::AST::SendNode] send_node # @return [String] # - # pkg:gem/rubocop#lib/rubocop/cop/lint/safe_navigation_chain.rb:84 + # pkg:gem/rubocop#lib/rubocop/cop/lint/safe_navigation_chain.rb:85 def add_safe_navigation_operator(offense_range:, send_node:); end # @param [RuboCop::Cop::Corrector] corrector # @param [Parser::Source::Range] offense_range # @param [RuboCop::AST::SendNode] send_node # - # pkg:gem/rubocop#lib/rubocop/cop/lint/safe_navigation_chain.rb:103 + # pkg:gem/rubocop#lib/rubocop/cop/lint/safe_navigation_chain.rb:104 def autocorrect(corrector, offense_range:, send_node:); end - # pkg:gem/rubocop#lib/rubocop/cop/lint/safe_navigation_chain.rb:112 + # pkg:gem/rubocop#lib/rubocop/cop/lint/safe_navigation_chain.rb:113 def brackets?(send_node); end - # pkg:gem/rubocop#lib/rubocop/cop/lint/safe_navigation_chain.rb:125 + # pkg:gem/rubocop#lib/rubocop/cop/lint/safe_navigation_chain.rb:126 def operator_inside_collection_literal?(send_node); end - # pkg:gem/rubocop#lib/rubocop/cop/lint/safe_navigation_chain.rb:116 + # pkg:gem/rubocop#lib/rubocop/cop/lint/safe_navigation_chain.rb:117 def require_parentheses?(send_node); end - # pkg:gem/rubocop#lib/rubocop/cop/lint/safe_navigation_chain.rb:62 + # pkg:gem/rubocop#lib/rubocop/cop/lint/safe_navigation_chain.rb:63 def require_safe_navigation?(node); end - # pkg:gem/rubocop#lib/rubocop/cop/lint/safe_navigation_chain.rb:75 + # pkg:gem/rubocop#lib/rubocop/cop/lint/safe_navigation_chain.rb:76 def ternary_else_branch?(node, safe_nav); end - # pkg:gem/rubocop#lib/rubocop/cop/lint/safe_navigation_chain.rb:69 + # pkg:gem/rubocop#lib/rubocop/cop/lint/safe_navigation_chain.rb:70 def ternary_safe_navigation?(node, safe_nav); end end @@ -24007,7 +24153,7 @@ class RuboCop::Cop::Lint::ScriptPermission < ::RuboCop::Cop::Base # pkg:gem/rubocop#lib/rubocop/cop/lint/script_permission.rb:59 def executable?(processed_source); end - # pkg:gem/rubocop#lib/rubocop/cop/lint/script_permission.rb:66 + # pkg:gem/rubocop#lib/rubocop/cop/lint/script_permission.rb:70 def format_message_from(processed_source); end end @@ -24087,22 +24233,30 @@ class RuboCop::Cop::Lint::SelfAssignment < ::RuboCop::Cop::Base private - # pkg:gem/rubocop#lib/rubocop/cop/lint/self_assignment.rb:142 + # pkg:gem/rubocop#lib/rubocop/cop/lint/self_assignment.rb:165 def allow_rbs_inline_annotation?; end - # pkg:gem/rubocop#lib/rubocop/cop/lint/self_assignment.rb:127 + # pkg:gem/rubocop#lib/rubocop/cop/lint/self_assignment.rb:150 def handle_attribute_assignment(node); end - # pkg:gem/rubocop#lib/rubocop/cop/lint/self_assignment.rb:115 + # pkg:gem/rubocop#lib/rubocop/cop/lint/self_assignment.rb:138 def handle_key_assignment(node); end - # pkg:gem/rubocop#lib/rubocop/cop/lint/self_assignment.rb:99 + # pkg:gem/rubocop#lib/rubocop/cop/lint/self_assignment.rb:122 def multiple_self_assignment?(node); end - # pkg:gem/rubocop#lib/rubocop/cop/lint/self_assignment.rb:138 + # pkg:gem/rubocop#lib/rubocop/cop/lint/self_assignment.rb:99 + def or_and_asgn_self_assignment?(lhs, rhs); end + + # pkg:gem/rubocop#lib/rubocop/cop/lint/self_assignment.rb:161 def rbs_inline_annotation?(node); end - # pkg:gem/rubocop#lib/rubocop/cop/lint/self_assignment.rb:110 + # Compares two reader calls (attribute `foo.bar` or key `hash['foo']`). + # + # pkg:gem/rubocop#lib/rubocop/cop/lint/self_assignment.rb:111 + def reader_self_assignment?(lhs, rhs); end + + # pkg:gem/rubocop#lib/rubocop/cop/lint/self_assignment.rb:133 def rhs_matches_lhs?(rhs, lhs); end end @@ -24430,16 +24584,23 @@ class RuboCop::Cop::Lint::ShadowingOuterLocalVariable < ::RuboCop::Cop::Base private - # pkg:gem/rubocop#lib/rubocop/cop/lint/shadowing_outer_local_variable.rb:101 + # `case ... in` binds variables in the pattern itself, so a block argument in one + # `in` branch does not shadow a pattern variable from a different `in` branch of the + # same `case` (the branches are mutually exclusive). + # + # pkg:gem/rubocop#lib/rubocop/cop/lint/shadowing_outer_local_variable.rb:96 + def different_case_in_branch?(variable, outer_local_variable); end + + # pkg:gem/rubocop#lib/rubocop/cop/lint/shadowing_outer_local_variable.rb:115 def find_conditional_node_from_ascendant(node); end - # pkg:gem/rubocop#lib/rubocop/cop/lint/shadowing_outer_local_variable.rb:108 + # pkg:gem/rubocop#lib/rubocop/cop/lint/shadowing_outer_local_variable.rb:122 def node_or_its_ascendant_conditional?(node); end # pkg:gem/rubocop#lib/rubocop/cop/lint/shadowing_outer_local_variable.rb:77 def same_conditions_node_different_branch?(variable, outer_local_variable); end - # pkg:gem/rubocop#lib/rubocop/cop/lint/shadowing_outer_local_variable.rb:91 + # pkg:gem/rubocop#lib/rubocop/cop/lint/shadowing_outer_local_variable.rb:105 def variable_node(variable); end # pkg:gem/rubocop#lib/rubocop/cop/lint/shadowing_outer_local_variable.rb:73 @@ -24498,13 +24659,13 @@ RuboCop::Cop::Lint::ShadowingOuterLocalVariable::MSG = T.let(T.unsafe(nil), Stri # # pkg:gem/rubocop#lib/rubocop/cop/lint/shared_mutable_default.rb:47 class RuboCop::Cop::Lint::SharedMutableDefault < ::RuboCop::Cop::Base - # pkg:gem/rubocop#lib/rubocop/cop/lint/shared_mutable_default.rb:64 + # pkg:gem/rubocop#lib/rubocop/cop/lint/shared_mutable_default.rb:66 def capacity_keyword_argument?(param0 = T.unsafe(nil)); end # pkg:gem/rubocop#lib/rubocop/cop/lint/shared_mutable_default.rb:53 def hash_initialized_with_mutable_shared_object?(param0 = T.unsafe(nil)); end - # pkg:gem/rubocop#lib/rubocop/cop/lint/shared_mutable_default.rb:68 + # pkg:gem/rubocop#lib/rubocop/cop/lint/shared_mutable_default.rb:70 def on_send(node); end end @@ -24729,7 +24890,10 @@ class RuboCop::Cop::Lint::SuppressedExceptionInNumberConversion < ::RuboCop::Cop private - # pkg:gem/rubocop#lib/rubocop/cop/lint/suppressed_exception_in_number_conversion.rb:103 + # pkg:gem/rubocop#lib/rubocop/cop/lint/suppressed_exception_in_number_conversion.rb:107 + def exception_keyword_argument?(method); end + + # pkg:gem/rubocop#lib/rubocop/cop/lint/suppressed_exception_in_number_conversion.rb:115 def expected_exception_classes_only?(exception_classes); end end @@ -24807,36 +24971,47 @@ class RuboCop::Cop::Lint::SymbolConversion < ::RuboCop::Cop::Base include ::RuboCop::Cop::SymbolHelp extend ::RuboCop::Cop::AutoCorrector - # pkg:gem/rubocop#lib/rubocop/cop/lint/symbol_conversion.rb:105 + # Reuse the already-escaped inner source for a plain `"..."` string so embedded + # quotes stay escaped. Percent literals (`%{}`, `%Q{}`, ...) and adjacent string + # concatenation have multi-character or no delimiters, so slicing the source would + # corrupt them; fall back to the node's value there. + # + # pkg:gem/rubocop#lib/rubocop/cop/lint/symbol_conversion.rb:97 + def dstr_correction(receiver); end + + # pkg:gem/rubocop#lib/rubocop/cop/lint/symbol_conversion.rb:122 def on_hash(node); end # pkg:gem/rubocop#lib/rubocop/cop/lint/symbol_conversion.rb:78 def on_send(node); end - # pkg:gem/rubocop#lib/rubocop/cop/lint/symbol_conversion.rb:88 + # pkg:gem/rubocop#lib/rubocop/cop/lint/symbol_conversion.rb:105 def on_sym(node); end + # pkg:gem/rubocop#lib/rubocop/cop/lint/symbol_conversion.rb:85 + def symbol_conversion_correction(receiver); end + private - # pkg:gem/rubocop#lib/rubocop/cop/lint/symbol_conversion.rb:147 + # pkg:gem/rubocop#lib/rubocop/cop/lint/symbol_conversion.rb:164 def correct_hash_key(node); end - # pkg:gem/rubocop#lib/rubocop/cop/lint/symbol_conversion.rb:166 + # pkg:gem/rubocop#lib/rubocop/cop/lint/symbol_conversion.rb:183 def correct_inconsistent_hash_keys(keys); end - # pkg:gem/rubocop#lib/rubocop/cop/lint/symbol_conversion.rb:139 + # pkg:gem/rubocop#lib/rubocop/cop/lint/symbol_conversion.rb:156 def in_alias?(node); end - # pkg:gem/rubocop#lib/rubocop/cop/lint/symbol_conversion.rb:143 + # pkg:gem/rubocop#lib/rubocop/cop/lint/symbol_conversion.rb:160 def in_percent_literal_array?(node); end - # pkg:gem/rubocop#lib/rubocop/cop/lint/symbol_conversion.rb:126 + # pkg:gem/rubocop#lib/rubocop/cop/lint/symbol_conversion.rb:143 def properly_quoted?(source, value); end - # pkg:gem/rubocop#lib/rubocop/cop/lint/symbol_conversion.rb:122 + # pkg:gem/rubocop#lib/rubocop/cop/lint/symbol_conversion.rb:139 def register_offense(node, correction:, message: T.unsafe(nil)); end - # pkg:gem/rubocop#lib/rubocop/cop/lint/symbol_conversion.rb:135 + # pkg:gem/rubocop#lib/rubocop/cop/lint/symbol_conversion.rb:152 def requires_quotes?(sym_node); end end @@ -24926,11 +25101,34 @@ class RuboCop::Cop::Lint::ToEnumArguments < ::RuboCop::Cop::Base private - # pkg:gem/rubocop#lib/rubocop/cop/lint/to_enum_arguments.rb:76 + # pkg:gem/rubocop#lib/rubocop/cop/lint/to_enum_arguments.rb:103 def argument_match?(send_arg, def_arg); end # pkg:gem/rubocop#lib/rubocop/cop/lint/to_enum_arguments.rb:61 def arguments_match?(arguments, def_node); end + + # A splat or argument forwarding on the call side can expand to any arity. + # + # pkg:gem/rubocop#lib/rubocop/cop/lint/to_enum_arguments.rb:90 + def expandable_arguments?(arguments); end + + # The enumerator re-invokes the method with these arguments, so passing more + # positional arguments than the method accepts raises `ArgumentError` at runtime. + # + # pkg:gem/rubocop#lib/rubocop/cop/lint/to_enum_arguments.rb:79 + def extra_positional_arguments?(arguments, def_node); end + + # pkg:gem/rubocop#lib/rubocop/cop/lint/to_enum_arguments.rb:126 + def keyword_hash_argument?(send_arg); end + + # pkg:gem/rubocop#lib/rubocop/cop/lint/to_enum_arguments.rb:94 + def positional_arguments(arguments); end + + # pkg:gem/rubocop#lib/rubocop/cop/lint/to_enum_arguments.rb:98 + def positional_parameters(def_node); end + + # pkg:gem/rubocop#lib/rubocop/cop/lint/to_enum_arguments.rb:85 + def variadic_parameters?(def_node); end end # pkg:gem/rubocop#lib/rubocop/cop/lint/to_enum_arguments.rb:28 @@ -25042,7 +25240,7 @@ class RuboCop::Cop::Lint::TrailingCommaInAttributeDeclaration < ::RuboCop::Cop:: private - # pkg:gem/rubocop#lib/rubocop/cop/lint/trailing_comma_in_attribute_declaration.rb:47 + # pkg:gem/rubocop#lib/rubocop/cop/lint/trailing_comma_in_attribute_declaration.rb:50 def trailing_comma_range(node); end end @@ -25195,7 +25393,7 @@ class RuboCop::Cop::Lint::UnescapedBracketInRegexp < ::RuboCop::Cop::Base # pkg:gem/rubocop#lib/rubocop/cop/lint/unescaped_bracket_in_regexp.rb:45 def on_regexp(node); end - # pkg:gem/rubocop#lib/rubocop/cop/lint/unescaped_bracket_in_regexp.rb:53 + # pkg:gem/rubocop#lib/rubocop/cop/lint/unescaped_bracket_in_regexp.rb:51 def on_send(node); end # pkg:gem/rubocop#lib/rubocop/cop/lint/unescaped_bracket_in_regexp.rb:37 @@ -25203,10 +25401,21 @@ class RuboCop::Cop::Lint::UnescapedBracketInRegexp < ::RuboCop::Cop::Base private + # pkg:gem/rubocop#lib/rubocop/cop/lint/unescaped_bracket_in_regexp.rb:83 + def detect_offenses(node, expr, skip_class_closer); end + + # When a character class opens with a bare `]` (e.g. `[^]]`), `regexp_parser` parses + # `[^]` / `[]` as an empty set and reports the closing `]` as a separate literal. + # Ruby treats that `]` as the end of the class, not as an unescaped bracket, + # so the first `]` following an empty set must be skipped. + # # pkg:gem/rubocop#lib/rubocop/cop/lint/unescaped_bracket_in_regexp.rb:66 - def detect_offenses(node, expr); end + def detect_offenses_in_tree(node, tree); end - # pkg:gem/rubocop#lib/rubocop/cop/lint/unescaped_bracket_in_regexp.rb:81 + # pkg:gem/rubocop#lib/rubocop/cop/lint/unescaped_bracket_in_regexp.rb:79 + def empty_character_set?(expr); end + + # pkg:gem/rubocop#lib/rubocop/cop/lint/unescaped_bracket_in_regexp.rb:107 def range_at_index(node, index, offset); end end @@ -26318,10 +26527,10 @@ class RuboCop::Cop::Lint::UselessAssignment < ::RuboCop::Cop::Base # pkg:gem/rubocop#lib/rubocop/cop/lint/useless_assignment.rb:49 def after_leaving_scope(scope, _variable_table); end - # pkg:gem/rubocop#lib/rubocop/cop/lint/useless_assignment.rb:172 + # pkg:gem/rubocop#lib/rubocop/cop/lint/useless_assignment.rb:177 def autocorrect(corrector, assignment); end - # pkg:gem/rubocop#lib/rubocop/cop/lint/useless_assignment.rb:111 + # pkg:gem/rubocop#lib/rubocop/cop/lint/useless_assignment.rb:116 def chained_assignment?(node); end # pkg:gem/rubocop#lib/rubocop/cop/lint/useless_assignment.rb:61 @@ -26330,57 +26539,64 @@ class RuboCop::Cop::Lint::UselessAssignment < ::RuboCop::Cop::Base # pkg:gem/rubocop#lib/rubocop/cop/lint/useless_assignment.rb:53 def check_for_unused_assignments(variable); end - # pkg:gem/rubocop#lib/rubocop/cop/lint/useless_assignment.rb:156 + # pkg:gem/rubocop#lib/rubocop/cop/lint/useless_assignment.rb:161 def collect_variable_like_names(scope); end - # pkg:gem/rubocop#lib/rubocop/cop/lint/useless_assignment.rb:82 + # pkg:gem/rubocop#lib/rubocop/cop/lint/useless_assignment.rb:87 def ignored_assignment?(variable, assignment_node, assignment); end - # pkg:gem/rubocop#lib/rubocop/cop/lint/useless_assignment.rb:87 + # pkg:gem/rubocop#lib/rubocop/cop/lint/useless_assignment.rb:92 def message_for_useless_assignment(assignment); end - # pkg:gem/rubocop#lib/rubocop/cop/lint/useless_assignment.rb:117 + # pkg:gem/rubocop#lib/rubocop/cop/lint/useless_assignment.rb:122 def message_specification(assignment, variable); end - # pkg:gem/rubocop#lib/rubocop/cop/lint/useless_assignment.rb:127 + # pkg:gem/rubocop#lib/rubocop/cop/lint/useless_assignment.rb:132 def multiple_assignment_message(variable_name); end - # pkg:gem/rubocop#lib/rubocop/cop/lint/useless_assignment.rb:93 + # pkg:gem/rubocop#lib/rubocop/cop/lint/useless_assignment.rb:98 def offense_range(assignment); end - # pkg:gem/rubocop#lib/rubocop/cop/lint/useless_assignment.rb:132 + # pkg:gem/rubocop#lib/rubocop/cop/lint/useless_assignment.rb:137 def operator_assignment_message(scope, assignment); end - # pkg:gem/rubocop#lib/rubocop/cop/lint/useless_assignment.rb:189 + # pkg:gem/rubocop#lib/rubocop/cop/lint/useless_assignment.rb:194 def remove_exception_assignment_part(corrector, node); end - # pkg:gem/rubocop#lib/rubocop/cop/lint/useless_assignment.rb:210 + # pkg:gem/rubocop#lib/rubocop/cop/lint/useless_assignment.rb:215 def remove_local_variable_assignment_part(corrector, node); end - # pkg:gem/rubocop#lib/rubocop/cop/lint/useless_assignment.rb:199 + # pkg:gem/rubocop#lib/rubocop/cop/lint/useless_assignment.rb:204 def remove_trailing_character_from_operator(corrector, node); end - # pkg:gem/rubocop#lib/rubocop/cop/lint/useless_assignment.rb:195 + # pkg:gem/rubocop#lib/rubocop/cop/lint/useless_assignment.rb:200 def rename_variable_with_underscore(corrector, node); end - # pkg:gem/rubocop#lib/rubocop/cop/lint/useless_assignment.rb:203 + # pkg:gem/rubocop#lib/rubocop/cop/lint/useless_assignment.rb:208 def replace_named_capture_group_with_non_capturing_group(corrector, node, variable_name); end # TODO: More precise handling (rescue, ensure, nested begin, etc.) # - # pkg:gem/rubocop#lib/rubocop/cop/lint/useless_assignment.rb:146 + # pkg:gem/rubocop#lib/rubocop/cop/lint/useless_assignment.rb:151 def return_value_node_of_scope(scope); end - # pkg:gem/rubocop#lib/rubocop/cop/lint/useless_assignment.rb:101 + # pkg:gem/rubocop#lib/rubocop/cop/lint/useless_assignment.rb:106 def sequential_assignment?(node); end - # pkg:gem/rubocop#lib/rubocop/cop/lint/useless_assignment.rb:139 + # pkg:gem/rubocop#lib/rubocop/cop/lint/useless_assignment.rb:144 def similar_name_message(variable); end - # pkg:gem/rubocop#lib/rubocop/cop/lint/useless_assignment.rb:214 + # Autocorrect is skipped when removing a variable would cause a syntax error + # (`x = 1, y = 2`), or where rewriting `x ||= 1`/`x &&= 1` to `x = 1` would raise + # `NameError` because the variable is not declared before the operator assignment. + # + # pkg:gem/rubocop#lib/rubocop/cop/lint/useless_assignment.rb:81 + def uncorrectable_assignment?(assignment_node); end + + # pkg:gem/rubocop#lib/rubocop/cop/lint/useless_assignment.rb:219 def variable_in_loop_condition?(assignment_node, variable); end - # pkg:gem/rubocop#lib/rubocop/cop/lint/useless_assignment.rb:165 + # pkg:gem/rubocop#lib/rubocop/cop/lint/useless_assignment.rb:170 def variable_like_method_invocation?(node); end class << self @@ -26928,7 +27144,7 @@ class RuboCop::Cop::Lint::UselessRuby2Keywords < ::RuboCop::Cop::Base # `ruby2_keywords` is only allowed if there's a `restarg` and no keyword arguments # - # pkg:gem/rubocop#lib/rubocop/cop/lint/useless_ruby2_keywords.rb:118 + # pkg:gem/rubocop#lib/rubocop/cop/lint/useless_ruby2_keywords.rb:122 def allowed_arguments?(arguments); end # pkg:gem/rubocop#lib/rubocop/cop/lint/useless_ruby2_keywords.rb:109 @@ -27007,22 +27223,22 @@ class RuboCop::Cop::Lint::UselessSetterCall::MethodVariableTracker # pkg:gem/rubocop#lib/rubocop/cop/lint/useless_setter_call.rb:73 def initialize(body_node); end - # pkg:gem/rubocop#lib/rubocop/cop/lint/useless_setter_call.rb:148 + # pkg:gem/rubocop#lib/rubocop/cop/lint/useless_setter_call.rb:151 def constructor?(node); end # pkg:gem/rubocop#lib/rubocop/cop/lint/useless_setter_call.rb:78 def contain_local_object?(variable_name); end - # pkg:gem/rubocop#lib/rubocop/cop/lint/useless_setter_call.rb:140 + # pkg:gem/rubocop#lib/rubocop/cop/lint/useless_setter_call.rb:143 def process_assignment(asgn_node, rhs_node); end # pkg:gem/rubocop#lib/rubocop/cop/lint/useless_setter_call.rb:96 def process_assignment_node(node); end - # pkg:gem/rubocop#lib/rubocop/cop/lint/useless_setter_call.rb:131 + # pkg:gem/rubocop#lib/rubocop/cop/lint/useless_setter_call.rb:134 def process_binary_operator_assignment(op_asgn_node); end - # pkg:gem/rubocop#lib/rubocop/cop/lint/useless_setter_call.rb:123 + # pkg:gem/rubocop#lib/rubocop/cop/lint/useless_setter_call.rb:126 def process_logical_operator_assignment(asgn_node); end # pkg:gem/rubocop#lib/rubocop/cop/lint/useless_setter_call.rb:109 @@ -27079,15 +27295,21 @@ class RuboCop::Cop::Lint::UselessTimes < ::RuboCop::Cop::Base # pkg:gem/rubocop#lib/rubocop/cop/lint/useless_times.rb:80 def autocorrect_block_pass(corrector, node, proc_name); end - # pkg:gem/rubocop#lib/rubocop/cop/lint/useless_times.rb:94 + # pkg:gem/rubocop#lib/rubocop/cop/lint/useless_times.rb:115 def fix_indentation(source, range); end # pkg:gem/rubocop#lib/rubocop/cop/lint/useless_times.rb:72 def never_process?(count, node); end - # pkg:gem/rubocop#lib/rubocop/cop/lint/useless_times.rb:106 + # pkg:gem/rubocop#lib/rubocop/cop/lint/useless_times.rb:108 + def orphans_loop_control_keyword?(node); end + + # pkg:gem/rubocop#lib/rubocop/cop/lint/useless_times.rb:127 def own_line?(node); end + # pkg:gem/rubocop#lib/rubocop/cop/lint/useless_times.rb:94 + def reducible_to_body?(node, block_arg); end + # pkg:gem/rubocop#lib/rubocop/cop/lint/useless_times.rb:76 def remove_node(corrector, node); end end @@ -28110,9 +28332,15 @@ RuboCop::Cop::Metrics::ParameterLists::OPTIONAL_PARAMETERS_MSG = T.let(T.unsafe( # nodes count. In contrast to the CyclomaticComplexity cop, this cop # considers `else` nodes as adding complexity. # +# A `case`/`in` branch whose pattern is a simple literal (e.g. `in 1`, `in "red"`, `in 1..10`) +# or a constant/type (e.g. `in Integer`) and has no guard is just as easy to read as a `when` +# branch, so it is discounted the same way. Branches with structural patterns (e.g. array, +# hash, or find patterns), bindings, alternatives, or a guard add the full complexity of +# a decision point. +# # @example # -# def my_method # 1 +# def example_1 # 1 # if cond # 1 # case var # 2 (0.8 + 4 * 0.2, rounded) # when 1 then func_one @@ -28125,18 +28353,29 @@ RuboCop::Cop::Metrics::ParameterLists::OPTIONAL_PARAMETERS_MSG = T.let(T.unsafe( # end # === # end # 7 complexity points # -# pkg:gem/rubocop#lib/rubocop/cop/metrics/perceived_complexity.rb:29 +# def example_2 # 1 +# case color # 1 (3 * 0.2, rounded) +# in "red" then func_red +# in "blue" then func_blue +# in "green" then func_green +# end # === +# end # 2 complexity points +# +# pkg:gem/rubocop#lib/rubocop/cop/metrics/perceived_complexity.rb:43 class RuboCop::Cop::Metrics::PerceivedComplexity < ::RuboCop::Cop::Metrics::CyclomaticComplexity private - # pkg:gem/rubocop#lib/rubocop/cop/metrics/perceived_complexity.rb:36 + # pkg:gem/rubocop#lib/rubocop/cop/metrics/perceived_complexity.rb:53 def complexity_score_for(node); end + + # pkg:gem/rubocop#lib/rubocop/cop/metrics/perceived_complexity.rb:79 + def simple_in_pattern?(in_pattern_node); end end -# pkg:gem/rubocop#lib/rubocop/cop/metrics/perceived_complexity.rb:32 +# pkg:gem/rubocop#lib/rubocop/cop/metrics/perceived_complexity.rb:46 RuboCop::Cop::Metrics::PerceivedComplexity::COUNTED_NODES = T.let(T.unsafe(nil), Array) -# pkg:gem/rubocop#lib/rubocop/cop/metrics/perceived_complexity.rb:30 +# pkg:gem/rubocop#lib/rubocop/cop/metrics/perceived_complexity.rb:44 RuboCop::Cop::Metrics::PerceivedComplexity::MSG = T.let(T.unsafe(nil), String) # pkg:gem/rubocop#lib/rubocop/cop/metrics/utils/repeated_csend_discount.rb:6 @@ -29322,10 +29561,10 @@ class RuboCop::Cop::Naming::FileName < ::RuboCop::Cop::Base # pkg:gem/rubocop#lib/rubocop/cop/naming/file_name.rb:128 def regex; end - # pkg:gem/rubocop#lib/rubocop/cop/naming/file_name.rb:238 + # pkg:gem/rubocop#lib/rubocop/cop/naming/file_name.rb:239 def to_module_name(basename); end - # pkg:gem/rubocop#lib/rubocop/cop/naming/file_name.rb:211 + # pkg:gem/rubocop#lib/rubocop/cop/naming/file_name.rb:212 def to_namespace(path); end end @@ -29512,70 +29751,70 @@ class RuboCop::Cop::Naming::InclusiveLanguage < ::RuboCop::Cop::Base private - # pkg:gem/rubocop#lib/rubocop/cop/naming/inclusive_language.rb:111 + # pkg:gem/rubocop#lib/rubocop/cop/naming/inclusive_language.rb:113 def add_offenses_for_token(token, word_locations); end - # pkg:gem/rubocop#lib/rubocop/cop/naming/inclusive_language.rb:176 + # pkg:gem/rubocop#lib/rubocop/cop/naming/inclusive_language.rb:178 def add_to_flagged_term_hash(regex_string, term, term_definition); end - # pkg:gem/rubocop#lib/rubocop/cop/naming/inclusive_language.rb:202 + # pkg:gem/rubocop#lib/rubocop/cop/naming/inclusive_language.rb:208 def array_to_ignorecase_regex(strings); end - # pkg:gem/rubocop#lib/rubocop/cop/naming/inclusive_language.rb:126 + # pkg:gem/rubocop#lib/rubocop/cop/naming/inclusive_language.rb:128 def check_token?(type); end - # pkg:gem/rubocop#lib/rubocop/cop/naming/inclusive_language.rb:252 + # pkg:gem/rubocop#lib/rubocop/cop/naming/inclusive_language.rb:258 def create_message(word, message = T.unsafe(nil)); end - # pkg:gem/rubocop#lib/rubocop/cop/naming/inclusive_language.rb:226 + # pkg:gem/rubocop#lib/rubocop/cop/naming/inclusive_language.rb:232 def create_multiple_word_message_for_file(words); end - # pkg:gem/rubocop#lib/rubocop/cop/naming/inclusive_language.rb:222 + # pkg:gem/rubocop#lib/rubocop/cop/naming/inclusive_language.rb:228 def create_single_word_message_for_file(word); end - # pkg:gem/rubocop#lib/rubocop/cop/naming/inclusive_language.rb:198 + # pkg:gem/rubocop#lib/rubocop/cop/naming/inclusive_language.rb:204 def ensure_regex_string(regex); end - # pkg:gem/rubocop#lib/rubocop/cop/naming/inclusive_language.rb:169 + # pkg:gem/rubocop#lib/rubocop/cop/naming/inclusive_language.rb:171 def extract_regexp(term, term_definition); end - # pkg:gem/rubocop#lib/rubocop/cop/naming/inclusive_language.rb:260 + # pkg:gem/rubocop#lib/rubocop/cop/naming/inclusive_language.rb:266 def find_flagged_term(word); end - # pkg:gem/rubocop#lib/rubocop/cop/naming/inclusive_language.rb:274 + # pkg:gem/rubocop#lib/rubocop/cop/naming/inclusive_language.rb:280 def format_suggestions(suggestions); end - # pkg:gem/rubocop#lib/rubocop/cop/naming/inclusive_language.rb:206 + # pkg:gem/rubocop#lib/rubocop/cop/naming/inclusive_language.rb:212 def investigate_filepath; end - # pkg:gem/rubocop#lib/rubocop/cop/naming/inclusive_language.rb:100 + # pkg:gem/rubocop#lib/rubocop/cop/naming/inclusive_language.rb:102 def investigate_tokens; end - # pkg:gem/rubocop#lib/rubocop/cop/naming/inclusive_language.rb:240 + # pkg:gem/rubocop#lib/rubocop/cop/naming/inclusive_language.rb:246 def mask_input(str); end - # pkg:gem/rubocop#lib/rubocop/cop/naming/inclusive_language.rb:289 + # pkg:gem/rubocop#lib/rubocop/cop/naming/inclusive_language.rb:295 def offense_range(token, word); end - # pkg:gem/rubocop#lib/rubocop/cop/naming/inclusive_language.rb:160 + # pkg:gem/rubocop#lib/rubocop/cop/naming/inclusive_language.rb:162 def preferred_sole_term(suggestions); end - # pkg:gem/rubocop#lib/rubocop/cop/naming/inclusive_language.rb:130 + # pkg:gem/rubocop#lib/rubocop/cop/naming/inclusive_language.rb:132 def preprocess_check_config; end - # pkg:gem/rubocop#lib/rubocop/cop/naming/inclusive_language.rb:144 + # pkg:gem/rubocop#lib/rubocop/cop/naming/inclusive_language.rb:146 def preprocess_flagged_terms; end - # pkg:gem/rubocop#lib/rubocop/cop/naming/inclusive_language.rb:267 + # pkg:gem/rubocop#lib/rubocop/cop/naming/inclusive_language.rb:273 def preprocess_suggestions(suggestions); end - # pkg:gem/rubocop#lib/rubocop/cop/naming/inclusive_language.rb:188 + # pkg:gem/rubocop#lib/rubocop/cop/naming/inclusive_language.rb:194 def process_allowed_regex(allowed); end - # pkg:gem/rubocop#lib/rubocop/cop/naming/inclusive_language.rb:230 + # pkg:gem/rubocop#lib/rubocop/cop/naming/inclusive_language.rb:236 def scan_for_words(input); end - # pkg:gem/rubocop#lib/rubocop/cop/naming/inclusive_language.rb:183 + # pkg:gem/rubocop#lib/rubocop/cop/naming/inclusive_language.rb:185 def set_regexes(flagged_term_strings, allowed_strings); end end @@ -29768,13 +30007,13 @@ class RuboCop::Cop::Naming::MemoizedInstanceVariableName < ::RuboCop::Cop::Base include ::RuboCop::Cop::ConfigurableEnforcedStyle extend ::RuboCop::Cop::AutoCorrector - # pkg:gem/rubocop#lib/rubocop/cop/naming/memoized_instance_variable_name.rb:198 + # pkg:gem/rubocop#lib/rubocop/cop/naming/memoized_instance_variable_name.rb:199 def defined_memoized?(param0 = T.unsafe(nil), param1); end # pkg:gem/rubocop#lib/rubocop/cop/naming/memoized_instance_variable_name.rb:161 def method_definition?(param0 = T.unsafe(nil)); end - # pkg:gem/rubocop#lib/rubocop/cop/naming/memoized_instance_variable_name.rb:206 + # pkg:gem/rubocop#lib/rubocop/cop/naming/memoized_instance_variable_name.rb:207 def on_defined?(node); end # pkg:gem/rubocop#lib/rubocop/cop/naming/memoized_instance_variable_name.rb:171 @@ -29782,22 +30021,29 @@ class RuboCop::Cop::Naming::MemoizedInstanceVariableName < ::RuboCop::Cop::Base private - # pkg:gem/rubocop#lib/rubocop/cop/naming/memoized_instance_variable_name.rb:242 + # pkg:gem/rubocop#lib/rubocop/cop/naming/memoized_instance_variable_name.rb:244 def find_definition(node); end - # pkg:gem/rubocop#lib/rubocop/cop/naming/memoized_instance_variable_name.rb:253 + # pkg:gem/rubocop#lib/rubocop/cop/naming/memoized_instance_variable_name.rb:262 def matches?(method_name, ivar_assign); end - # pkg:gem/rubocop#lib/rubocop/cop/naming/memoized_instance_variable_name.rb:262 + # pkg:gem/rubocop#lib/rubocop/cop/naming/memoized_instance_variable_name.rb:271 def message(variable); end - # pkg:gem/rubocop#lib/rubocop/cop/naming/memoized_instance_variable_name.rb:238 + # Operator and other non-word method names (e.g. `[]`, `+`, `<=>`) cannot form a + # valid instance variable name, so there is no matching ivar to enforce and a + # suggested correction like `@[]` would be invalid Ruby. + # + # pkg:gem/rubocop#lib/rubocop/cop/naming/memoized_instance_variable_name.rb:258 + def nameable_method?(method_name); end + + # pkg:gem/rubocop#lib/rubocop/cop/naming/memoized_instance_variable_name.rb:240 def style_parameter_name; end - # pkg:gem/rubocop#lib/rubocop/cop/naming/memoized_instance_variable_name.rb:270 + # pkg:gem/rubocop#lib/rubocop/cop/naming/memoized_instance_variable_name.rb:279 def suggested_var(method_name); end - # pkg:gem/rubocop#lib/rubocop/cop/naming/memoized_instance_variable_name.rb:276 + # pkg:gem/rubocop#lib/rubocop/cop/naming/memoized_instance_variable_name.rb:285 def variable_name_candidates(method_name); end end @@ -30476,32 +30722,35 @@ class RuboCop::Cop::Naming::RescuedExceptionsVariableName < ::RuboCop::Cop::Base # pkg:gem/rubocop#lib/rubocop/cop/naming/rescued_exceptions_variable_name.rb:96 def autocorrect(corrector, node, range, offending_name, preferred_name); end - # pkg:gem/rubocop#lib/rubocop/cop/naming/rescued_exceptions_variable_name.rb:117 + # Returns the reassignment node once the exception variable is reassigned (a truthy + # signal to stop correcting later references), or `nil` when no reassignment is found. + # + # pkg:gem/rubocop#lib/rubocop/cop/naming/rescued_exceptions_variable_name.rb:122 def correct_node(corrector, node, offending_name, preferred_name); end # If the exception variable is reassigned, that assignment needs to be corrected. # Further `lvar` nodes will not be corrected though since they now refer to a # different variable. # - # pkg:gem/rubocop#lib/rubocop/cop/naming/rescued_exceptions_variable_name.rb:143 + # pkg:gem/rubocop#lib/rubocop/cop/naming/rescued_exceptions_variable_name.rb:149 def correct_reassignment(corrector, node, offending_name, preferred_name); end - # pkg:gem/rubocop#lib/rubocop/cop/naming/rescued_exceptions_variable_name.rb:160 + # pkg:gem/rubocop#lib/rubocop/cop/naming/rescued_exceptions_variable_name.rb:166 def message(node); end # pkg:gem/rubocop#lib/rubocop/cop/naming/rescued_exceptions_variable_name.rb:91 def offense_range(resbody); end - # pkg:gem/rubocop#lib/rubocop/cop/naming/rescued_exceptions_variable_name.rb:147 + # pkg:gem/rubocop#lib/rubocop/cop/naming/rescued_exceptions_variable_name.rb:153 def preferred_name(variable_name); end - # pkg:gem/rubocop#lib/rubocop/cop/naming/rescued_exceptions_variable_name.rb:166 + # pkg:gem/rubocop#lib/rubocop/cop/naming/rescued_exceptions_variable_name.rb:172 def shadowed_variable_name?(node); end - # pkg:gem/rubocop#lib/rubocop/cop/naming/rescued_exceptions_variable_name.rb:156 + # pkg:gem/rubocop#lib/rubocop/cop/naming/rescued_exceptions_variable_name.rb:162 def variable_name(node); end - # pkg:gem/rubocop#lib/rubocop/cop/naming/rescued_exceptions_variable_name.rb:106 + # pkg:gem/rubocop#lib/rubocop/cop/naming/rescued_exceptions_variable_name.rb:109 def variable_name_matches?(node, name); end end @@ -31125,7 +31374,7 @@ class RuboCop::Cop::OrderedGemCorrector private - # pkg:gem/rubocop#lib/rubocop/cop/correctors/ordered_gem_corrector.rb:26 + # pkg:gem/rubocop#lib/rubocop/cop/correctors/ordered_gem_corrector.rb:33 def declaration_with_comment(node); end end end @@ -32879,6 +33128,13 @@ class RuboCop::Cop::Style::AccessorGrouping < ::RuboCop::Cop::Base # # pkg:gem/rubocop#lib/rubocop/cop/style/accessor_grouping.rb:179 def skip_for_grouping?(node); end + + # For a single-line declaration the parser associates the trailing + # comment with the first argument, not `last_argument`, so look through + # all arguments for a comment that trails the whole node. + # + # pkg:gem/rubocop#lib/rubocop/cop/style/accessor_grouping.rb:217 + def trailing_argument_comment(node); end end # pkg:gem/rubocop#lib/rubocop/cop/style/accessor_grouping.rb:61 @@ -33566,7 +33822,7 @@ RuboCop::Cop::Style::ArrayCoercion::SPLAT_MSG = T.let(T.unsafe(nil), String) class RuboCop::Cop::Style::ArrayFirstLast < ::RuboCop::Cop::Base extend ::RuboCop::Cop::AutoCorrector - # pkg:gem/rubocop#lib/rubocop/cop/style/array_first_last.rb:52 + # pkg:gem/rubocop#lib/rubocop/cop/style/array_first_last.rb:53 def on_csend(node); end # pkg:gem/rubocop#lib/rubocop/cop/style/array_first_last.rb:35 @@ -33574,16 +33830,25 @@ class RuboCop::Cop::Style::ArrayFirstLast < ::RuboCop::Cop::Base private - # pkg:gem/rubocop#lib/rubocop/cop/style/array_first_last.rb:74 + # pkg:gem/rubocop#lib/rubocop/cop/style/array_first_last.rb:79 def brace_method?(node); end - # pkg:gem/rubocop#lib/rubocop/cop/style/array_first_last.rb:61 + # `arr[0] += 1` etc. would autocorrect to `arr.first += 1`, which calls the + # nonexistent `first=`/`last=` setter and raises `NoMethodError`. + # + # pkg:gem/rubocop#lib/rubocop/cop/style/array_first_last.rb:85 + def compound_assignment_target?(node); end + + # pkg:gem/rubocop#lib/rubocop/cop/style/array_first_last.rb:66 def find_offense_range(node); end - # pkg:gem/rubocop#lib/rubocop/cop/style/array_first_last.rb:69 + # pkg:gem/rubocop#lib/rubocop/cop/style/array_first_last.rb:74 def innermost_braces_node(node); end - # pkg:gem/rubocop#lib/rubocop/cop/style/array_first_last.rb:56 + # pkg:gem/rubocop#lib/rubocop/cop/style/array_first_last.rb:57 + def preferred_name(value); end + + # pkg:gem/rubocop#lib/rubocop/cop/style/array_first_last.rb:61 def preferred_value(node, value); end end @@ -33684,16 +33949,16 @@ class RuboCop::Cop::Style::ArrayIntersect < ::RuboCop::Cop::Base # pkg:gem/rubocop#lib/rubocop/cop/style/array_intersect.rb:105 def intersection_size_check?(param0 = T.unsafe(nil)); end - # pkg:gem/rubocop#lib/rubocop/cop/style/array_intersect.rb:154 + # pkg:gem/rubocop#lib/rubocop/cop/style/array_intersect.rb:158 def on_block(node); end - # pkg:gem/rubocop#lib/rubocop/cop/style/array_intersect.rb:152 + # pkg:gem/rubocop#lib/rubocop/cop/style/array_intersect.rb:156 def on_csend(node); end - # pkg:gem/rubocop#lib/rubocop/cop/style/array_intersect.rb:164 + # pkg:gem/rubocop#lib/rubocop/cop/style/array_intersect.rb:168 def on_itblock(node); end - # pkg:gem/rubocop#lib/rubocop/cop/style/array_intersect.rb:163 + # pkg:gem/rubocop#lib/rubocop/cop/style/array_intersect.rb:167 def on_numblock(node); end # pkg:gem/rubocop#lib/rubocop/cop/style/array_intersect.rb:142 @@ -33701,16 +33966,16 @@ class RuboCop::Cop::Style::ArrayIntersect < ::RuboCop::Cop::Base private - # pkg:gem/rubocop#lib/rubocop/cop/style/array_intersect.rb:168 + # pkg:gem/rubocop#lib/rubocop/cop/style/array_intersect.rb:172 def bad_intersection?(node); end - # pkg:gem/rubocop#lib/rubocop/cop/style/array_intersect.rb:173 + # pkg:gem/rubocop#lib/rubocop/cop/style/array_intersect.rb:177 def bad_intersection_predicates; end - # pkg:gem/rubocop#lib/rubocop/cop/style/array_intersect.rb:185 + # pkg:gem/rubocop#lib/rubocop/cop/style/array_intersect.rb:189 def register_offense(node, replacement); end - # pkg:gem/rubocop#lib/rubocop/cop/style/array_intersect.rb:181 + # pkg:gem/rubocop#lib/rubocop/cop/style/array_intersect.rb:185 def straight?(method_name); end end @@ -33751,7 +34016,7 @@ RuboCop::Cop::Style::ArrayIntersect::STRAIGHT_METHODS = T.let(T.unsafe(nil), Arr class RuboCop::Cop::Style::ArrayIntersectWithSingleElement < ::RuboCop::Cop::Base extend ::RuboCop::Cop::AutoCorrector - # pkg:gem/rubocop#lib/rubocop/cop/style/array_intersect_with_single_element.rb:43 + # pkg:gem/rubocop#lib/rubocop/cop/style/array_intersect_with_single_element.rb:46 def on_csend(node); end # pkg:gem/rubocop#lib/rubocop/cop/style/array_intersect_with_single_element.rb:29 @@ -34397,49 +34662,49 @@ class RuboCop::Cop::Style::BlockDelimiters < ::RuboCop::Cop::Base private - # pkg:gem/rubocop#lib/rubocop/cop/style/block_delimiters.rb:477 + # pkg:gem/rubocop#lib/rubocop/cop/style/block_delimiters.rb:491 def array_or_range?(node); end # pkg:gem/rubocop#lib/rubocop/cop/style/block_delimiters.rb:216 def autocorrect(corrector, node); end - # pkg:gem/rubocop#lib/rubocop/cop/style/block_delimiters.rb:481 + # pkg:gem/rubocop#lib/rubocop/cop/style/block_delimiters.rb:495 def begin_required?(block_node); end # pkg:gem/rubocop#lib/rubocop/cop/style/block_delimiters.rb:242 def braces_for_chaining_message(node); end - # pkg:gem/rubocop#lib/rubocop/cop/style/block_delimiters.rb:420 + # pkg:gem/rubocop#lib/rubocop/cop/style/block_delimiters.rb:434 def braces_for_chaining_style?(node); end # pkg:gem/rubocop#lib/rubocop/cop/style/block_delimiters.rb:254 def braces_required_message(node); end - # pkg:gem/rubocop#lib/rubocop/cop/style/block_delimiters.rb:397 + # pkg:gem/rubocop#lib/rubocop/cop/style/block_delimiters.rb:411 def braces_required_method?(method_name); end - # pkg:gem/rubocop#lib/rubocop/cop/style/block_delimiters.rb:401 + # pkg:gem/rubocop#lib/rubocop/cop/style/block_delimiters.rb:415 def braces_required_methods; end - # pkg:gem/rubocop#lib/rubocop/cop/style/block_delimiters.rb:428 + # pkg:gem/rubocop#lib/rubocop/cop/style/block_delimiters.rb:442 def correction_would_break_code?(node); end # pkg:gem/rubocop#lib/rubocop/cop/style/block_delimiters.rb:330 def end_of_chain(node); end - # pkg:gem/rubocop#lib/rubocop/cop/style/block_delimiters.rb:442 + # pkg:gem/rubocop#lib/rubocop/cop/style/block_delimiters.rb:456 def functional_block?(node); end - # pkg:gem/rubocop#lib/rubocop/cop/style/block_delimiters.rb:434 + # pkg:gem/rubocop#lib/rubocop/cop/style/block_delimiters.rb:448 def functional_method?(method_name); end - # pkg:gem/rubocop#lib/rubocop/cop/style/block_delimiters.rb:438 + # pkg:gem/rubocop#lib/rubocop/cop/style/block_delimiters.rb:452 def functional_methods; end # pkg:gem/rubocop#lib/rubocop/cop/style/block_delimiters.rb:348 def get_blocks(node, &block); end - # pkg:gem/rubocop#lib/rubocop/cop/style/block_delimiters.rb:405 + # pkg:gem/rubocop#lib/rubocop/cop/style/block_delimiters.rb:419 def line_count_based_block_style?(node); end # pkg:gem/rubocop#lib/rubocop/cop/style/block_delimiters.rb:226 @@ -34448,16 +34713,19 @@ class RuboCop::Cop::Style::BlockDelimiters < ::RuboCop::Cop::Base # pkg:gem/rubocop#lib/rubocop/cop/style/block_delimiters.rb:258 def message(node); end + # pkg:gem/rubocop#lib/rubocop/cop/style/block_delimiters.rb:403 + def modifier_rescue?(rescue_node); end + # pkg:gem/rubocop#lib/rubocop/cop/style/block_delimiters.rb:306 def move_comment_before_block(corrector, comment, block_node, closing_brace); end - # pkg:gem/rubocop#lib/rubocop/cop/style/block_delimiters.rb:450 + # pkg:gem/rubocop#lib/rubocop/cop/style/block_delimiters.rb:464 def procedural_method?(method_name); end - # pkg:gem/rubocop#lib/rubocop/cop/style/block_delimiters.rb:454 + # pkg:gem/rubocop#lib/rubocop/cop/style/block_delimiters.rb:468 def procedural_methods; end - # pkg:gem/rubocop#lib/rubocop/cop/style/block_delimiters.rb:446 + # pkg:gem/rubocop#lib/rubocop/cop/style/block_delimiters.rb:460 def procedural_oneliners_may_have_braces?; end # pkg:gem/rubocop#lib/rubocop/cop/style/block_delimiters.rb:374 @@ -34475,19 +34743,19 @@ class RuboCop::Cop::Style::BlockDelimiters < ::RuboCop::Cop::Base # pkg:gem/rubocop#lib/rubocop/cop/style/block_delimiters.rb:390 def require_do_end?(node); end - # pkg:gem/rubocop#lib/rubocop/cop/style/block_delimiters.rb:470 + # pkg:gem/rubocop#lib/rubocop/cop/style/block_delimiters.rb:484 def return_value_of_scope?(node); end - # pkg:gem/rubocop#lib/rubocop/cop/style/block_delimiters.rb:458 + # pkg:gem/rubocop#lib/rubocop/cop/style/block_delimiters.rb:472 def return_value_used?(node); end - # pkg:gem/rubocop#lib/rubocop/cop/style/block_delimiters.rb:409 + # pkg:gem/rubocop#lib/rubocop/cop/style/block_delimiters.rb:423 def semantic_block_style?(node); end # pkg:gem/rubocop#lib/rubocop/cop/style/block_delimiters.rb:234 def semantic_message(node); end - # pkg:gem/rubocop#lib/rubocop/cop/style/block_delimiters.rb:487 + # pkg:gem/rubocop#lib/rubocop/cop/style/block_delimiters.rb:501 def single_argument_operator_method?(node); end # pkg:gem/rubocop#lib/rubocop/cop/style/block_delimiters.rb:320 @@ -34516,27 +34784,27 @@ RuboCop::Cop::Style::BlockDelimiters::BRACES_REQUIRED_MESSAGE = T.let(T.unsafe(n # Corrector to correct conditional assignment in `case` statements. # -# pkg:gem/rubocop#lib/rubocop/cop/style/conditional_assignment.rb:608 +# pkg:gem/rubocop#lib/rubocop/cop/style/conditional_assignment.rb:611 class RuboCop::Cop::Style::CaseCorrector extend ::RuboCop::Cop::Style::ConditionalAssignmentHelper extend ::RuboCop::Cop::Style::ConditionalCorrectorHelper class << self - # pkg:gem/rubocop#lib/rubocop/cop/style/conditional_assignment.rb:613 + # pkg:gem/rubocop#lib/rubocop/cop/style/conditional_assignment.rb:616 def correct(corrector, cop, node); end - # pkg:gem/rubocop#lib/rubocop/cop/style/conditional_assignment.rb:623 + # pkg:gem/rubocop#lib/rubocop/cop/style/conditional_assignment.rb:626 def move_assignment_inside_condition(corrector, node); end private - # pkg:gem/rubocop#lib/rubocop/cop/style/conditional_assignment.rb:643 + # pkg:gem/rubocop#lib/rubocop/cop/style/conditional_assignment.rb:646 def extract_branches(case_node); end - # pkg:gem/rubocop#lib/rubocop/cop/style/conditional_assignment.rb:637 + # pkg:gem/rubocop#lib/rubocop/cop/style/conditional_assignment.rb:640 def extract_tail_branches(node); end - # pkg:gem/rubocop#lib/rubocop/cop/style/conditional_assignment.rb:653 + # pkg:gem/rubocop#lib/rubocop/cop/style/conditional_assignment.rb:656 def move_branch_inside_condition(corrector, branch, condition, assignment, column); end end end @@ -34608,9 +34876,18 @@ class RuboCop::Cop::Style::CaseEquality < ::RuboCop::Cop::Base # pkg:gem/rubocop#lib/rubocop/cop/style/case_equality.rb:74 def offending_receiver?(node); end + # `Array === a + b` must become `(a + b).is_a?(Array)`, not + # `a + b.is_a?(Array)` (which parses as `a + (b.is_a?(Array))`). + # + # pkg:gem/rubocop#lib/rubocop/cop/style/case_equality.rb:110 + def parenthesize_if_needed(node); end + # pkg:gem/rubocop#lib/rubocop/cop/style/case_equality.rb:81 def replacement(lhs, rhs); end + # pkg:gem/rubocop#lib/rubocop/cop/style/case_equality.rb:114 + def requires_parentheses?(node); end + # pkg:gem/rubocop#lib/rubocop/cop/style/case_equality.rb:102 def send_replacement(lhs, rhs); end end @@ -35032,19 +35309,22 @@ class RuboCop::Cop::Style::ClassEqualityComparison < ::RuboCop::Cop::Base # pkg:gem/rubocop#lib/rubocop/cop/style/class_equality_comparison.rb:92 def class_name(class_node, node); end - # pkg:gem/rubocop#lib/rubocop/cop/style/class_equality_comparison.rb:112 + # pkg:gem/rubocop#lib/rubocop/cop/style/class_equality_comparison.rb:120 def class_name_method?(method_name); end - # pkg:gem/rubocop#lib/rubocop/cop/style/class_equality_comparison.rb:128 + # pkg:gem/rubocop#lib/rubocop/cop/style/class_equality_comparison.rb:136 def offense_range(receiver_node, node); end - # pkg:gem/rubocop#lib/rubocop/cop/style/class_equality_comparison.rb:116 + # pkg:gem/rubocop#lib/rubocop/cop/style/class_equality_comparison.rb:124 def require_cbase?(class_node); end - # pkg:gem/rubocop#lib/rubocop/cop/style/class_equality_comparison.rb:124 + # pkg:gem/rubocop#lib/rubocop/cop/style/class_equality_comparison.rb:113 + def string_class_name(class_node); end + + # pkg:gem/rubocop#lib/rubocop/cop/style/class_equality_comparison.rb:132 def trim_string_quotes(class_node); end - # pkg:gem/rubocop#lib/rubocop/cop/style/class_equality_comparison.rb:120 + # pkg:gem/rubocop#lib/rubocop/cop/style/class_equality_comparison.rb:128 def unable_to_determine_type?(class_node); end end @@ -35180,9 +35460,15 @@ class RuboCop::Cop::Style::ClassMethodsDefinitions < ::RuboCop::Cop::Base # pkg:gem/rubocop#lib/rubocop/cop/style/class_methods_definitions.rb:141 def extract_def_from_sclass(def_node, sclass_node); end - # pkg:gem/rubocop#lib/rubocop/cop/style/class_methods_definitions.rb:152 + # pkg:gem/rubocop#lib/rubocop/cop/style/class_methods_definitions.rb:158 def indentation_diff(node1, node2); end + # Splice in `self.` at the actual `def` keyword rather than substituting the + # first textual `def `, which may appear inside a preceding comment. + # + # pkg:gem/rubocop#lib/rubocop/cop/style/class_methods_definitions.rb:150 + def prefix_def_with_self(range, def_node); end + # pkg:gem/rubocop#lib/rubocop/cop/style/class_methods_definitions.rb:137 def sclass_only_has_methods?(node); end end @@ -35570,13 +35856,18 @@ class RuboCop::Cop::Style::ColonMethodCall < ::RuboCop::Cop::Base extend ::RuboCop::Cop::AutoCorrector # pkg:gem/rubocop#lib/rubocop/cop/style/colon_method_call.rb:28 - def java_type_node?(param0 = T.unsafe(nil)); end + def java_root?(param0 = T.unsafe(nil)); end - # pkg:gem/rubocop#lib/rubocop/cop/style/colon_method_call.rb:37 + # pkg:gem/rubocop#lib/rubocop/cop/style/colon_method_call.rb:36 def on_send(node); end + private + + # pkg:gem/rubocop#lib/rubocop/cop/style/colon_method_call.rb:47 + def java_interop?(node); end + class << self - # pkg:gem/rubocop#lib/rubocop/cop/style/colon_method_call.rb:33 + # pkg:gem/rubocop#lib/rubocop/cop/style/colon_method_call.rb:32 def autocorrect_incompatible_with; end end end @@ -35745,19 +36036,19 @@ class RuboCop::Cop::Style::CombinableLoops < ::RuboCop::Cop::Base private - # pkg:gem/rubocop#lib/rubocop/cop/style/combinable_loops.rb:96 + # pkg:gem/rubocop#lib/rubocop/cop/style/combinable_loops.rb:101 def collection_looping_method?(node); end - # pkg:gem/rubocop#lib/rubocop/cop/style/combinable_loops.rb:113 + # pkg:gem/rubocop#lib/rubocop/cop/style/combinable_loops.rb:118 def combine_with_left_sibling(corrector, node); end - # pkg:gem/rubocop#lib/rubocop/cop/style/combinable_loops.rb:120 + # pkg:gem/rubocop#lib/rubocop/cop/style/combinable_loops.rb:125 def correct_end_of_block(corrector, node); end - # pkg:gem/rubocop#lib/rubocop/cop/style/combinable_loops.rb:101 + # pkg:gem/rubocop#lib/rubocop/cop/style/combinable_loops.rb:106 def same_collection_looping_block?(node, sibling); end - # pkg:gem/rubocop#lib/rubocop/cop/style/combinable_loops.rb:109 + # pkg:gem/rubocop#lib/rubocop/cop/style/combinable_loops.rb:114 def same_collection_looping_for?(node, sibling); end end @@ -36178,6 +36469,12 @@ class RuboCop::Cop::Style::ComparableClamp < ::RuboCop::Cop::Base # pkg:gem/rubocop#lib/rubocop/cop/style/comparable_clamp.rb:117 def min_condition?(if_condition, else_body); end + + # `a + b` must become `(a + b).clamp(low, high)`, not `a + b.clamp(low, high)` + # (which parses as `a + (b.clamp(low, high))`). + # + # pkg:gem/rubocop#lib/rubocop/cop/style/comparable_clamp.rb:125 + def parenthesize_if_needed(node); end end # pkg:gem/rubocop#lib/rubocop/cop/style/comparable_clamp.rb:42 @@ -36212,7 +36509,7 @@ RuboCop::Cop::Style::ComparableClamp::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Ar class RuboCop::Cop::Style::ConcatArrayLiterals < ::RuboCop::Cop::Base extend ::RuboCop::Cop::AutoCorrector - # pkg:gem/rubocop#lib/rubocop/cop/style/concat_array_literals.rb:68 + # pkg:gem/rubocop#lib/rubocop/cop/style/concat_array_literals.rb:72 def on_csend(node); end # pkg:gem/rubocop#lib/rubocop/cop/style/concat_array_literals.rb:34 @@ -36220,13 +36517,13 @@ class RuboCop::Cop::Style::ConcatArrayLiterals < ::RuboCop::Cop::Base private - # pkg:gem/rubocop#lib/rubocop/cop/style/concat_array_literals.rb:72 + # pkg:gem/rubocop#lib/rubocop/cop/style/concat_array_literals.rb:76 def offense_range(node); end - # pkg:gem/rubocop#lib/rubocop/cop/style/concat_array_literals.rb:89 + # pkg:gem/rubocop#lib/rubocop/cop/style/concat_array_literals.rb:93 def percent_literals_includes_only_basic_literals?(node); end - # pkg:gem/rubocop#lib/rubocop/cop/style/concat_array_literals.rb:76 + # pkg:gem/rubocop#lib/rubocop/cop/style/concat_array_literals.rb:80 def preferred_method(node); end end @@ -36342,7 +36639,7 @@ class RuboCop::Cop::Style::ConditionalAssignment < ::RuboCop::Cop::Base # pkg:gem/rubocop#lib/rubocop/cop/style/conditional_assignment.rb:218 def assignment_type?(param0 = T.unsafe(nil)); end - # pkg:gem/rubocop#lib/rubocop/cop/style/conditional_assignment.rb:299 + # pkg:gem/rubocop#lib/rubocop/cop/style/conditional_assignment.rb:302 def candidate_condition?(param0 = T.unsafe(nil)); end # pkg:gem/rubocop#lib/rubocop/cop/style/conditional_assignment.rb:226 @@ -36386,31 +36683,31 @@ class RuboCop::Cop::Style::ConditionalAssignment < ::RuboCop::Cop::Base private - # pkg:gem/rubocop#lib/rubocop/cop/style/conditional_assignment.rb:305 + # pkg:gem/rubocop#lib/rubocop/cop/style/conditional_assignment.rb:308 def allowed_single_line?(branches); end - # pkg:gem/rubocop#lib/rubocop/cop/style/conditional_assignment.rb:379 + # pkg:gem/rubocop#lib/rubocop/cop/style/conditional_assignment.rb:382 def allowed_statements?(branches); end - # pkg:gem/rubocop#lib/rubocop/cop/style/conditional_assignment.rb:301 + # pkg:gem/rubocop#lib/rubocop/cop/style/conditional_assignment.rb:304 def allowed_ternary?(assignment); end - # pkg:gem/rubocop#lib/rubocop/cop/style/conditional_assignment.rb:309 + # pkg:gem/rubocop#lib/rubocop/cop/style/conditional_assignment.rb:312 def assignment_node(node); end - # pkg:gem/rubocop#lib/rubocop/cop/style/conditional_assignment.rb:356 + # pkg:gem/rubocop#lib/rubocop/cop/style/conditional_assignment.rb:359 def assignment_types_match?(*nodes); end - # pkg:gem/rubocop#lib/rubocop/cop/style/conditional_assignment.rb:371 + # pkg:gem/rubocop#lib/rubocop/cop/style/conditional_assignment.rb:374 def autocorrect(corrector, node); end - # pkg:gem/rubocop#lib/rubocop/cop/style/conditional_assignment.rb:294 + # pkg:gem/rubocop#lib/rubocop/cop/style/conditional_assignment.rb:297 def candidate_node?(node); end # pkg:gem/rubocop#lib/rubocop/cop/style/conditional_assignment.rb:276 def check_assignment_to_condition(node); end - # pkg:gem/rubocop#lib/rubocop/cop/style/conditional_assignment.rb:362 + # pkg:gem/rubocop#lib/rubocop/cop/style/conditional_assignment.rb:365 def check_node(node, branches); end # If `Layout/LineLength` is enabled, we do not want to introduce an @@ -36421,31 +36718,31 @@ class RuboCop::Cop::Style::ConditionalAssignment < ::RuboCop::Cop::Base # of the longest line + the length of the corrected assignment is # greater than the max configured line length # - # pkg:gem/rubocop#lib/rubocop/cop/style/conditional_assignment.rb:395 + # pkg:gem/rubocop#lib/rubocop/cop/style/conditional_assignment.rb:398 def correction_exceeds_line_limit?(node, branches); end - # pkg:gem/rubocop#lib/rubocop/cop/style/conditional_assignment.rb:418 + # pkg:gem/rubocop#lib/rubocop/cop/style/conditional_assignment.rb:421 def include_ternary?; end - # pkg:gem/rubocop#lib/rubocop/cop/style/conditional_assignment.rb:349 + # pkg:gem/rubocop#lib/rubocop/cop/style/conditional_assignment.rb:352 def lhs_all_match?(branches); end - # pkg:gem/rubocop#lib/rubocop/cop/style/conditional_assignment.rb:407 + # pkg:gem/rubocop#lib/rubocop/cop/style/conditional_assignment.rb:410 def longest_line(node, assignment); end - # pkg:gem/rubocop#lib/rubocop/cop/style/conditional_assignment.rb:403 + # pkg:gem/rubocop#lib/rubocop/cop/style/conditional_assignment.rb:406 def longest_line_exceeds_line_limit?(node, assignment); end - # pkg:gem/rubocop#lib/rubocop/cop/style/conditional_assignment.rb:333 + # pkg:gem/rubocop#lib/rubocop/cop/style/conditional_assignment.rb:336 def move_assignment_inside_condition(corrector, node); end - # pkg:gem/rubocop#lib/rubocop/cop/style/conditional_assignment.rb:323 + # pkg:gem/rubocop#lib/rubocop/cop/style/conditional_assignment.rb:326 def move_assignment_outside_condition(corrector, node); end - # pkg:gem/rubocop#lib/rubocop/cop/style/conditional_assignment.rb:414 + # pkg:gem/rubocop#lib/rubocop/cop/style/conditional_assignment.rb:417 def single_line_conditions_only?; end - # pkg:gem/rubocop#lib/rubocop/cop/style/conditional_assignment.rb:345 + # pkg:gem/rubocop#lib/rubocop/cop/style/conditional_assignment.rb:348 def ternary_condition?(node); end end @@ -36530,27 +36827,27 @@ RuboCop::Cop::Style::ConditionalAssignmentHelper::KEYWORD = T.let(T.unsafe(nil), # Helper module to provide common methods to ConditionalAssignment # correctors # -# pkg:gem/rubocop#lib/rubocop/cop/style/conditional_assignment.rb:425 +# pkg:gem/rubocop#lib/rubocop/cop/style/conditional_assignment.rb:428 module RuboCop::Cop::Style::ConditionalCorrectorHelper - # pkg:gem/rubocop#lib/rubocop/cop/style/conditional_assignment.rb:463 + # pkg:gem/rubocop#lib/rubocop/cop/style/conditional_assignment.rb:466 def assignment(node); end - # pkg:gem/rubocop#lib/rubocop/cop/style/conditional_assignment.rb:492 + # pkg:gem/rubocop#lib/rubocop/cop/style/conditional_assignment.rb:495 def correct_branches(corrector, branches); end - # pkg:gem/rubocop#lib/rubocop/cop/style/conditional_assignment.rb:469 + # pkg:gem/rubocop#lib/rubocop/cop/style/conditional_assignment.rb:472 def correct_if_branches(corrector, cop, node); end - # pkg:gem/rubocop#lib/rubocop/cop/style/conditional_assignment.rb:427 + # pkg:gem/rubocop#lib/rubocop/cop/style/conditional_assignment.rb:430 def remove_whitespace_in_branches(corrector, branch, condition, column); end - # pkg:gem/rubocop#lib/rubocop/cop/style/conditional_assignment.rb:479 + # pkg:gem/rubocop#lib/rubocop/cop/style/conditional_assignment.rb:482 def replace_branch_assignment(corrector, branch); end - # pkg:gem/rubocop#lib/rubocop/cop/style/conditional_assignment.rb:448 + # pkg:gem/rubocop#lib/rubocop/cop/style/conditional_assignment.rb:451 def same_line?(node1, node2); end - # pkg:gem/rubocop#lib/rubocop/cop/style/conditional_assignment.rb:452 + # pkg:gem/rubocop#lib/rubocop/cop/style/conditional_assignment.rb:455 def white_space_range(node, column); end end @@ -36728,7 +37025,7 @@ class RuboCop::Cop::Style::DataInheritance < ::RuboCop::Cop::Base # pkg:gem/rubocop#lib/rubocop/cop/style/data_inheritance.rb:62 def correct_parent(parent, corrector); end - # pkg:gem/rubocop#lib/rubocop/cop/style/data_inheritance.rb:72 + # pkg:gem/rubocop#lib/rubocop/cop/style/data_inheritance.rb:76 def range_for_empty_class_body(class_node, data_define); end end @@ -36982,7 +37279,7 @@ class RuboCop::Cop::Style::DirEmpty < ::RuboCop::Cop::Base private - # pkg:gem/rubocop#lib/rubocop/cop/style/dir_empty.rb:48 + # pkg:gem/rubocop#lib/rubocop/cop/style/dir_empty.rb:52 def bang(node); end end @@ -37755,10 +38052,16 @@ class RuboCop::Cop::Style::EmptyCaseCondition < ::RuboCop::Cop::Base # pkg:gem/rubocop#lib/rubocop/cop/style/empty_case_condition.rb:82 def correct_when_conditions(corrector, when_nodes); end - # pkg:gem/rubocop#lib/rubocop/cop/style/empty_case_condition.rb:97 + # pkg:gem/rubocop#lib/rubocop/cop/style/empty_case_condition.rb:107 def keep_first_when_comment(case_range, corrector); end - # pkg:gem/rubocop#lib/rubocop/cop/style/empty_case_condition.rb:107 + # A condition that binds looser than `||` (e.g. a ternary, range, or + # assignment) must be parenthesized so the joined `||` keeps its meaning. + # + # pkg:gem/rubocop#lib/rubocop/cop/style/empty_case_condition.rb:99 + def parenthesize_condition(condition); end + + # pkg:gem/rubocop#lib/rubocop/cop/style/empty_case_condition.rb:117 def replace_then_with_line_break(corrector, conditions, when_node); end end @@ -37841,11 +38144,17 @@ class RuboCop::Cop::Style::EmptyClassDefinition < ::RuboCop::Cop::Base # pkg:gem/rubocop#lib/rubocop/cop/style/empty_class_definition.rb:98 def allowed_parent_classes; end - # pkg:gem/rubocop#lib/rubocop/cop/style/empty_class_definition.rb:110 + # pkg:gem/rubocop#lib/rubocop/cop/style/empty_class_definition.rb:117 def autocorrect_class_definition(corrector, node); end # pkg:gem/rubocop#lib/rubocop/cop/style/empty_class_definition.rb:102 def autocorrect_class_new(corrector, node, class_new_node); end + + # Preserve any namespace on the assigned constant (e.g. `Foo::Bar`), + # which `node.name` drops. + # + # pkg:gem/rubocop#lib/rubocop/cop/style/empty_class_definition.rb:112 + def constant_name(node); end end # pkg:gem/rubocop#lib/rubocop/cop/style/empty_class_definition.rb:61 @@ -38139,19 +38448,19 @@ class RuboCop::Cop::Style::EmptyLiteral < ::RuboCop::Cop::Base # pkg:gem/rubocop#lib/rubocop/cop/style/empty_literal.rb:47 def array_with_block(param0 = T.unsafe(nil)); end - # pkg:gem/rubocop#lib/rubocop/cop/style/empty_literal.rb:58 + # pkg:gem/rubocop#lib/rubocop/cop/style/empty_literal.rb:63 def array_with_index(param0 = T.unsafe(nil)); end # pkg:gem/rubocop#lib/rubocop/cop/style/empty_literal.rb:41 def hash_node(param0 = T.unsafe(nil)); end - # pkg:gem/rubocop#lib/rubocop/cop/style/empty_literal.rb:50 + # pkg:gem/rubocop#lib/rubocop/cop/style/empty_literal.rb:55 def hash_with_block(param0 = T.unsafe(nil)); end - # pkg:gem/rubocop#lib/rubocop/cop/style/empty_literal.rb:66 + # pkg:gem/rubocop#lib/rubocop/cop/style/empty_literal.rb:71 def hash_with_index(param0 = T.unsafe(nil)); end - # pkg:gem/rubocop#lib/rubocop/cop/style/empty_literal.rb:73 + # pkg:gem/rubocop#lib/rubocop/cop/style/empty_literal.rb:78 def on_send(node); end # pkg:gem/rubocop#lib/rubocop/cop/style/empty_literal.rb:44 @@ -38159,25 +38468,25 @@ class RuboCop::Cop::Style::EmptyLiteral < ::RuboCop::Cop::Base private - # pkg:gem/rubocop#lib/rubocop/cop/style/empty_literal.rb:122 + # pkg:gem/rubocop#lib/rubocop/cop/style/empty_literal.rb:127 def correction(node); end - # pkg:gem/rubocop#lib/rubocop/cop/style/empty_literal.rb:93 + # pkg:gem/rubocop#lib/rubocop/cop/style/empty_literal.rb:98 def first_argument_unparenthesized?(node); end - # pkg:gem/rubocop#lib/rubocop/cop/style/empty_literal.rb:140 + # pkg:gem/rubocop#lib/rubocop/cop/style/empty_literal.rb:145 def frozen_strings?; end - # pkg:gem/rubocop#lib/rubocop/cop/style/empty_literal.rb:113 + # pkg:gem/rubocop#lib/rubocop/cop/style/empty_literal.rb:118 def offense_array_node?(node); end - # pkg:gem/rubocop#lib/rubocop/cop/style/empty_literal.rb:117 + # pkg:gem/rubocop#lib/rubocop/cop/style/empty_literal.rb:122 def offense_hash_node?(node); end - # pkg:gem/rubocop#lib/rubocop/cop/style/empty_literal.rb:83 + # pkg:gem/rubocop#lib/rubocop/cop/style/empty_literal.rb:88 def offense_message(node); end - # pkg:gem/rubocop#lib/rubocop/cop/style/empty_literal.rb:100 + # pkg:gem/rubocop#lib/rubocop/cop/style/empty_literal.rb:105 def replacement_range(node); end end @@ -38319,22 +38628,28 @@ class RuboCop::Cop::Style::EmptyStringInsideInterpolation < ::RuboCop::Cop::Base include ::RuboCop::Cop::Interpolation extend ::RuboCop::Cop::AutoCorrector - # pkg:gem/rubocop#lib/rubocop/cop/style/empty_string_inside_interpolation.rb:49 + # pkg:gem/rubocop#lib/rubocop/cop/style/empty_string_inside_interpolation.rb:48 def on_interpolation(node); end private - # pkg:gem/rubocop#lib/rubocop/cop/style/empty_string_inside_interpolation.rb:86 + # pkg:gem/rubocop#lib/rubocop/cop/style/empty_string_inside_interpolation.rb:96 def empty_branch_outcome?(branch); end - # pkg:gem/rubocop#lib/rubocop/cop/style/empty_string_inside_interpolation.rb:82 + # pkg:gem/rubocop#lib/rubocop/cop/style/empty_string_inside_interpolation.rb:92 def empty_else_outcome?(node); end - # pkg:gem/rubocop#lib/rubocop/cop/style/empty_string_inside_interpolation.rb:78 + # pkg:gem/rubocop#lib/rubocop/cop/style/empty_string_inside_interpolation.rb:88 def empty_if_outcome?(node); end - # pkg:gem/rubocop#lib/rubocop/cop/style/empty_string_inside_interpolation.rb:92 + # pkg:gem/rubocop#lib/rubocop/cop/style/empty_string_inside_interpolation.rb:74 + def ternary_correction(node, child_node); end + + # pkg:gem/rubocop#lib/rubocop/cop/style/empty_string_inside_interpolation.rb:102 def ternary_style_autocorrect(node, outcome, condition); end + + # pkg:gem/rubocop#lib/rubocop/cop/style/empty_string_inside_interpolation.rb:60 + def trailing_conditional_correction(child_node); end end # pkg:gem/rubocop#lib/rubocop/cop/style/empty_string_inside_interpolation.rb:46 @@ -38800,6 +39115,9 @@ class RuboCop::Cop::Style::EvenOdd < ::RuboCop::Cop::Base private # pkg:gem/rubocop#lib/rubocop/cop/style/even_odd.rb:45 + def receiver_source(node); end + + # pkg:gem/rubocop#lib/rubocop/cop/style/even_odd.rb:55 def replacement_method(arg, method); end end @@ -38835,7 +39153,7 @@ class RuboCop::Cop::Style::ExactRegexpMatch < ::RuboCop::Cop::Base # pkg:gem/rubocop#lib/rubocop/cop/style/exact_regexp_match.rb:32 def exact_regexp_match(param0 = T.unsafe(nil)); end - # pkg:gem/rubocop#lib/rubocop/cop/style/exact_regexp_match.rb:52 + # pkg:gem/rubocop#lib/rubocop/cop/style/exact_regexp_match.rb:53 def on_csend(node); end # pkg:gem/rubocop#lib/rubocop/cop/style/exact_regexp_match.rb:40 @@ -38843,10 +39161,16 @@ class RuboCop::Cop::Style::ExactRegexpMatch < ::RuboCop::Cop::Base private - # pkg:gem/rubocop#lib/rubocop/cop/style/exact_regexp_match.rb:56 - def exact_match_pattern?(parsed_regexp); end + # Escape characters that are special inside a single-quoted string so the + # generated literal (e.g. for `/\Afoo'bar\z/`) stays valid Ruby. + # + # pkg:gem/rubocop#lib/rubocop/cop/style/exact_regexp_match.rb:59 + def escape_single_quotes(text); end # pkg:gem/rubocop#lib/rubocop/cop/style/exact_regexp_match.rb:63 + def exact_match_pattern?(parsed_regexp); end + + # pkg:gem/rubocop#lib/rubocop/cop/style/exact_regexp_match.rb:70 def new_method(node); end end @@ -39593,14 +39917,21 @@ class RuboCop::Cop::Style::FileWrite < ::RuboCop::Cop::Base def file_open_write?(node); end # pkg:gem/rubocop#lib/rubocop/cop/style/file_write.rb:126 - def find_heredoc(node); end - - # pkg:gem/rubocop#lib/rubocop/cop/style/file_write.rb:116 - def heredoc_in_write(write_node); end + def find_heredocs(node); end # pkg:gem/rubocop#lib/rubocop/cop/style/file_write.rb:122 def heredoc_range(heredoc); end + # pkg:gem/rubocop#lib/rubocop/cop/style/file_write.rb:132 + def removed?(heredoc, write_node); end + + # Heredocs opened in the arguments keep working in the replacement, but their + # bodies are lost when they lie within the replaced range, so they need to be + # restored after the replacement. + # + # pkg:gem/rubocop#lib/rubocop/cop/style/file_write.rb:116 + def removed_heredocs(filename, content, write_node); end + # pkg:gem/rubocop#lib/rubocop/cop/style/file_write.rb:105 def replacement(mode, filename, content, write_node); end @@ -39876,6 +40207,12 @@ class RuboCop::Cop::Style::FormatString < ::RuboCop::Cop::Base # pkg:gem/rubocop#lib/rubocop/cop/style/format_string.rb:99 def method_name(style_name); end + + # An argument that binds looser than `%` (a ternary, range, assignment, or + # operator call) must be parenthesized to keep its meaning. + # + # pkg:gem/rubocop#lib/rubocop/cop/style/format_string.rb:159 + def requires_parentheses?(arg); end end # Known conversion methods whose return value is not an array. @@ -41085,6 +41422,22 @@ RuboCop::Cop::Style::HashLookupMethod::RESTRICT_ON_SEND = T.let(T.unsafe(nil), A # This cop is unsafe because it cannot be guaranteed that the receiver # is a `Hash` or responds to the replacement method. # +# Additionally, the replacement may change the order of the resulting +# hash: `Hash#slice` returns entries in the order the keys are given, +# whereas `select`, `filter`, and `reject` preserve the entry order of +# the receiver. +# +# For example: +# +# [source,ruby] +# ---- +# hash = {foo: 1, bar: 2, baz: 3} +# keys = %i[baz foo] +# +# hash.select { |k, _v| keys.include?(k) } # => {foo: 1, baz: 3} +# hash.slice(*keys) # => {baz: 3, foo: 1} +# ---- +# # @example # # # bad @@ -41124,7 +41477,7 @@ RuboCop::Cop::Style::HashLookupMethod::RESTRICT_ON_SEND = T.let(T.unsafe(nil), A # # good # {foo: 1, bar: 2, baz: 3}.slice(:bar) # -# pkg:gem/rubocop#lib/rubocop/cop/style/hash_slice.rb:61 +# pkg:gem/rubocop#lib/rubocop/cop/style/hash_slice.rb:77 class RuboCop::Cop::Style::HashSlice < ::RuboCop::Cop::Base include ::RuboCop::Cop::RangeHelp include ::RuboCop::Cop::HashSubset @@ -41133,10 +41486,10 @@ class RuboCop::Cop::Style::HashSlice < ::RuboCop::Cop::Base private - # pkg:gem/rubocop#lib/rubocop/cop/style/hash_slice.rb:74 + # pkg:gem/rubocop#lib/rubocop/cop/style/hash_slice.rb:90 def preferred_method_name; end - # pkg:gem/rubocop#lib/rubocop/cop/style/hash_slice.rb:70 + # pkg:gem/rubocop#lib/rubocop/cop/style/hash_slice.rb:86 def semantically_subset_method?(node); end end @@ -41299,16 +41652,16 @@ class RuboCop::Cop::Style::HashSyntax < ::RuboCop::Cop::Base # pkg:gem/rubocop#lib/rubocop/cop/style/hash_syntax.rb:221 def acceptable_19_syntax_symbol?(sym_name); end - # pkg:gem/rubocop#lib/rubocop/cop/style/hash_syntax.rb:278 + # pkg:gem/rubocop#lib/rubocop/cop/style/hash_syntax.rb:280 def argument_without_space?(node); end # pkg:gem/rubocop#lib/rubocop/cop/style/hash_syntax.rb:200 def autocorrect(corrector, node); end - # pkg:gem/rubocop#lib/rubocop/cop/style/hash_syntax.rb:284 + # pkg:gem/rubocop#lib/rubocop/cop/style/hash_syntax.rb:286 def autocorrect_hash_rockets(corrector, pair_node); end - # pkg:gem/rubocop#lib/rubocop/cop/style/hash_syntax.rb:293 + # pkg:gem/rubocop#lib/rubocop/cop/style/hash_syntax.rb:295 def autocorrect_no_mixed_keys(corrector, pair_node); end # pkg:gem/rubocop#lib/rubocop/cop/style/hash_syntax.rb:257 @@ -41317,10 +41670,10 @@ class RuboCop::Cop::Style::HashSyntax < ::RuboCop::Cop::Base # pkg:gem/rubocop#lib/rubocop/cop/style/hash_syntax.rb:242 def check(pairs, delim, msg); end - # pkg:gem/rubocop#lib/rubocop/cop/style/hash_syntax.rb:301 + # pkg:gem/rubocop#lib/rubocop/cop/style/hash_syntax.rb:303 def force_hash_rockets?(pairs); end - # pkg:gem/rubocop#lib/rubocop/cop/style/hash_syntax.rb:270 + # pkg:gem/rubocop#lib/rubocop/cop/style/hash_syntax.rb:272 def range_for_autocorrect_ruby19(pair_node); end # pkg:gem/rubocop#lib/rubocop/cop/style/hash_syntax.rb:210 @@ -41626,24 +41979,24 @@ RuboCop::Cop::Style::IdenticalConditionalBranches::MSG = T.let(T.unsafe(nil), St # Corrector to correct conditional assignment in `if` statements. # -# pkg:gem/rubocop#lib/rubocop/cop/style/conditional_assignment.rb:561 +# pkg:gem/rubocop#lib/rubocop/cop/style/conditional_assignment.rb:564 class RuboCop::Cop::Style::IfCorrector extend ::RuboCop::Cop::Style::ConditionalAssignmentHelper extend ::RuboCop::Cop::Style::ConditionalCorrectorHelper class << self - # pkg:gem/rubocop#lib/rubocop/cop/style/conditional_assignment.rb:566 + # pkg:gem/rubocop#lib/rubocop/cop/style/conditional_assignment.rb:569 def correct(corrector, cop, node); end - # pkg:gem/rubocop#lib/rubocop/cop/style/conditional_assignment.rb:570 + # pkg:gem/rubocop#lib/rubocop/cop/style/conditional_assignment.rb:573 def move_assignment_inside_condition(corrector, node); end private - # pkg:gem/rubocop#lib/rubocop/cop/style/conditional_assignment.rb:584 + # pkg:gem/rubocop#lib/rubocop/cop/style/conditional_assignment.rb:587 def extract_tail_branches(node); end - # pkg:gem/rubocop#lib/rubocop/cop/style/conditional_assignment.rb:591 + # pkg:gem/rubocop#lib/rubocop/cop/style/conditional_assignment.rb:594 def move_branch_inside_condition(corrector, branch, condition, assignment, column); end end end @@ -42098,7 +42451,7 @@ class RuboCop::Cop::Style::IfWithSemicolon < ::RuboCop::Cop::Base # pkg:gem/rubocop#lib/rubocop/cop/style/if_with_semicolon.rb:55 def autocorrect(corrector, node); end - # pkg:gem/rubocop#lib/rubocop/cop/style/if_with_semicolon.rb:106 + # pkg:gem/rubocop#lib/rubocop/cop/style/if_with_semicolon.rb:114 def build_else_branch(second_condition); end # pkg:gem/rubocop#lib/rubocop/cop/style/if_with_semicolon.rb:97 @@ -42113,12 +42466,19 @@ class RuboCop::Cop::Style::IfWithSemicolon < ::RuboCop::Cop::Base # pkg:gem/rubocop#lib/rubocop/cop/style/if_with_semicolon.rb:77 def replacement(node); end - # pkg:gem/rubocop#lib/rubocop/cop/style/if_with_semicolon.rb:126 + # pkg:gem/rubocop#lib/rubocop/cop/style/if_with_semicolon.rb:134 def require_argument_parentheses?(node); end # pkg:gem/rubocop#lib/rubocop/cop/style/if_with_semicolon.rb:63 def require_newline?(node); end + # An assignment used as the condition must be parenthesized, otherwise the + # assignment would capture the whole ternary (`a = b ? c : d` instead of + # `(a = b) ? c : d`), changing what gets assigned. + # + # pkg:gem/rubocop#lib/rubocop/cop/style/if_with_semicolon.rb:109 + def ternary_condition(node); end + # pkg:gem/rubocop#lib/rubocop/cop/style/if_with_semicolon.rb:67 def use_masgn_or_block_in_branches?(node); end @@ -42785,7 +43145,7 @@ class RuboCop::Cop::Style::KeywordArgumentsMerging < ::RuboCop::Cop::Base private - # pkg:gem/rubocop#lib/rubocop/cop/style/keyword_arguments_merging.rb:48 + # pkg:gem/rubocop#lib/rubocop/cop/style/keyword_arguments_merging.rb:52 def autocorrect(corrector, kwsplat_node, hash_node, other_hash_node); end end @@ -42836,7 +43196,7 @@ class RuboCop::Cop::Style::KeywordParametersOrder < ::RuboCop::Cop::Base # pkg:gem/rubocop#lib/rubocop/cop/style/keyword_parameters_order.rb:55 def autocorrect(corrector, node, defining_node, kwarg_nodes); end - # pkg:gem/rubocop#lib/rubocop/cop/style/keyword_parameters_order.rb:72 + # pkg:gem/rubocop#lib/rubocop/cop/style/keyword_parameters_order.rb:76 def remove_kwargs(kwarg_nodes, corrector); end end @@ -43284,6 +43644,17 @@ RuboCop::Cop::Style::MagicCommentFormat::SNAKE_SEPARATOR = T.let(T.unsafe(nil), # Prefer `select` or `reject` over `map { ... }.compact`. # This cop also handles `filter_map { ... }`, similar to `map { ... }.compact`. # +# @safety +# This cop is unsafe because `compact` also removes `nil` elements that +# were already present in the receiver, whereas `select`/`reject` keep +# them. The result therefore differs when the collection contains `nil`: +# +# [source,ruby] +# ---- +# [nil, 1].map { |e| e if e }.compact # => [1] +# [nil, 1].select { |e| e } # => [nil, 1] +# ---- +# # @example # # # bad @@ -43319,50 +43690,50 @@ RuboCop::Cop::Style::MagicCommentFormat::SNAKE_SEPARATOR = T.let(T.unsafe(nil), # # good # array.reject { |e| some_condition? } # -# pkg:gem/rubocop#lib/rubocop/cop/style/map_compact_with_conditional_block.rb:44 +# pkg:gem/rubocop#lib/rubocop/cop/style/map_compact_with_conditional_block.rb:55 class RuboCop::Cop::Style::MapCompactWithConditionalBlock < ::RuboCop::Cop::Base extend ::RuboCop::Cop::AutoCorrector - # pkg:gem/rubocop#lib/rubocop/cop/style/map_compact_with_conditional_block.rb:51 + # pkg:gem/rubocop#lib/rubocop/cop/style/map_compact_with_conditional_block.rb:62 def conditional_block(param0 = T.unsafe(nil)); end - # pkg:gem/rubocop#lib/rubocop/cop/style/map_compact_with_conditional_block.rb:92 + # pkg:gem/rubocop#lib/rubocop/cop/style/map_compact_with_conditional_block.rb:103 def on_csend(node); end - # pkg:gem/rubocop#lib/rubocop/cop/style/map_compact_with_conditional_block.rb:76 + # pkg:gem/rubocop#lib/rubocop/cop/style/map_compact_with_conditional_block.rb:87 def on_send(node); end private - # pkg:gem/rubocop#lib/rubocop/cop/style/map_compact_with_conditional_block.rb:148 + # pkg:gem/rubocop#lib/rubocop/cop/style/map_compact_with_conditional_block.rb:159 def current(node); end - # pkg:gem/rubocop#lib/rubocop/cop/style/map_compact_with_conditional_block.rb:162 + # pkg:gem/rubocop#lib/rubocop/cop/style/map_compact_with_conditional_block.rb:173 def filter_map_range(node); end - # pkg:gem/rubocop#lib/rubocop/cop/style/map_compact_with_conditional_block.rb:96 + # pkg:gem/rubocop#lib/rubocop/cop/style/map_compact_with_conditional_block.rb:107 def inspect(node, block_argument_node, condition_node, return_value_node, range); end - # pkg:gem/rubocop#lib/rubocop/cop/style/map_compact_with_conditional_block.rb:158 + # pkg:gem/rubocop#lib/rubocop/cop/style/map_compact_with_conditional_block.rb:169 def map_with_compact_range(node); end - # pkg:gem/rubocop#lib/rubocop/cop/style/map_compact_with_conditional_block.rb:114 + # pkg:gem/rubocop#lib/rubocop/cop/style/map_compact_with_conditional_block.rb:125 def returns_block_argument?(block_argument_node, return_value_node); end - # pkg:gem/rubocop#lib/rubocop/cop/style/map_compact_with_conditional_block.rb:118 + # pkg:gem/rubocop#lib/rubocop/cop/style/map_compact_with_conditional_block.rb:129 def truthy_branch?(node); end - # pkg:gem/rubocop#lib/rubocop/cop/style/map_compact_with_conditional_block.rb:138 + # pkg:gem/rubocop#lib/rubocop/cop/style/map_compact_with_conditional_block.rb:149 def truthy_branch_for_guard?(node); end - # pkg:gem/rubocop#lib/rubocop/cop/style/map_compact_with_conditional_block.rb:128 + # pkg:gem/rubocop#lib/rubocop/cop/style/map_compact_with_conditional_block.rb:139 def truthy_branch_for_if?(node); end end -# pkg:gem/rubocop#lib/rubocop/cop/style/map_compact_with_conditional_block.rb:47 +# pkg:gem/rubocop#lib/rubocop/cop/style/map_compact_with_conditional_block.rb:58 RuboCop::Cop::Style::MapCompactWithConditionalBlock::MSG = T.let(T.unsafe(nil), String) -# pkg:gem/rubocop#lib/rubocop/cop/style/map_compact_with_conditional_block.rb:48 +# pkg:gem/rubocop#lib/rubocop/cop/style/map_compact_with_conditional_block.rb:59 RuboCop::Cop::Style::MapCompactWithConditionalBlock::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array) # Checks for usages of `each` with `<<`, `push`, or `append` which @@ -44134,7 +44505,7 @@ class RuboCop::Cop::Style::MethodCallWithoutArgsParentheses < ::RuboCop::Cop::Ba # pkg:gem/rubocop#lib/rubocop/cop/style/method_call_without_args_parentheses.rb:67 def allowed_method_name?(name); end - # pkg:gem/rubocop#lib/rubocop/cop/style/method_call_without_args_parentheses.rb:97 + # pkg:gem/rubocop#lib/rubocop/cop/style/method_call_without_args_parentheses.rb:101 def any_assignment?(node); end # pkg:gem/rubocop#lib/rubocop/cop/style/method_call_without_args_parentheses.rb:63 @@ -44143,7 +44514,7 @@ class RuboCop::Cop::Style::MethodCallWithoutArgsParentheses < ::RuboCop::Cop::Ba # pkg:gem/rubocop#lib/rubocop/cop/style/method_call_without_args_parentheses.rb:59 def ineligible_node?(node); end - # pkg:gem/rubocop#lib/rubocop/cop/style/method_call_without_args_parentheses.rb:114 + # pkg:gem/rubocop#lib/rubocop/cop/style/method_call_without_args_parentheses.rb:118 def offense_range(node); end # Respects `Lint/ItWithoutArgumentsInBlock` cop and the following Ruby 3.3's warning: @@ -44161,7 +44532,7 @@ class RuboCop::Cop::Style::MethodCallWithoutArgsParentheses < ::RuboCop::Cop::Ba # pkg:gem/rubocop#lib/rubocop/cop/style/method_call_without_args_parentheses.rb:71 def same_name_assignment?(node); end - # pkg:gem/rubocop#lib/rubocop/cop/style/method_call_without_args_parentheses.rb:110 + # pkg:gem/rubocop#lib/rubocop/cop/style/method_call_without_args_parentheses.rb:114 def variable_in_mass_assignment?(variable_name, node); end end @@ -44428,10 +44799,10 @@ class RuboCop::Cop::Style::MinMaxComparison < ::RuboCop::Cop::Base private - # pkg:gem/rubocop#lib/rubocop/cop/style/min_max_comparison.rb:80 + # pkg:gem/rubocop#lib/rubocop/cop/style/min_max_comparison.rb:83 def autocorrect(corrector, node, replacement); end - # pkg:gem/rubocop#lib/rubocop/cop/style/min_max_comparison.rb:72 + # pkg:gem/rubocop#lib/rubocop/cop/style/min_max_comparison.rb:75 def preferred_method(operator, lhs, rhs, if_branch, else_branch); end end @@ -45197,13 +45568,16 @@ class RuboCop::Cop::Style::MultilineMemoization < ::RuboCop::Cop::Base # pkg:gem/rubocop#lib/rubocop/cop/style/multiline_memoization.rb:62 def bad_rhs?(rhs); end - # pkg:gem/rubocop#lib/rubocop/cop/style/multiline_memoization.rb:72 - def keyword_autocorrect(node, corrector); end + # pkg:gem/rubocop#lib/rubocop/cop/style/multiline_memoization.rb:74 + def contains_rescue_or_ensure?(node); end # pkg:gem/rubocop#lib/rubocop/cop/style/multiline_memoization.rb:78 + def keyword_autocorrect(node, corrector); end + + # pkg:gem/rubocop#lib/rubocop/cop/style/multiline_memoization.rb:84 def keyword_begin_str(node, node_buf); end - # pkg:gem/rubocop#lib/rubocop/cop/style/multiline_memoization.rb:86 + # pkg:gem/rubocop#lib/rubocop/cop/style/multiline_memoization.rb:92 def keyword_end_str(node, node_buf); end end @@ -45244,22 +45618,22 @@ class RuboCop::Cop::Style::MultilineMethodSignature < ::RuboCop::Cop::Base # pkg:gem/rubocop#lib/rubocop/cop/style/multiline_method_signature.rb:42 def autocorrect(corrector, node, begin_of_arguments); end - # pkg:gem/rubocop#lib/rubocop/cop/style/multiline_method_signature.rb:73 + # pkg:gem/rubocop#lib/rubocop/cop/style/multiline_method_signature.rb:75 def closing_line(node); end - # pkg:gem/rubocop#lib/rubocop/cop/style/multiline_method_signature.rb:77 + # pkg:gem/rubocop#lib/rubocop/cop/style/multiline_method_signature.rb:79 def correction_exceeds_max_line_length?(node); end - # pkg:gem/rubocop#lib/rubocop/cop/style/multiline_method_signature.rb:87 + # pkg:gem/rubocop#lib/rubocop/cop/style/multiline_method_signature.rb:89 def definition_width(node); end - # pkg:gem/rubocop#lib/rubocop/cop/style/multiline_method_signature.rb:83 + # pkg:gem/rubocop#lib/rubocop/cop/style/multiline_method_signature.rb:85 def indentation_width(node); end - # pkg:gem/rubocop#lib/rubocop/cop/style/multiline_method_signature.rb:65 + # pkg:gem/rubocop#lib/rubocop/cop/style/multiline_method_signature.rb:67 def last_line_source_of_arguments(arguments); end - # pkg:gem/rubocop#lib/rubocop/cop/style/multiline_method_signature.rb:69 + # pkg:gem/rubocop#lib/rubocop/cop/style/multiline_method_signature.rb:71 def opening_line(node); end end @@ -45476,6 +45850,14 @@ RuboCop::Cop::Style::MultipleComparison::MSG = T.let(T.unsafe(nil), String) # Checks whether some constant value isn't a # mutable literal (e.g. array or hash). # +# When the `Recursive` option is enabled, mutable literals nested inside +# arrays and hashes are also frozen, so an offense on the outermost +# unfrozen literal will autocorrect every nested mutable literal as well. +# When the outer literal already has `.freeze` appended, the cop descends +# into it and reports each outermost unfrozen literal underneath. The +# option is disabled by default to preserve existing behavior; opt in to +# get strict nested freezing. +# # Strict mode can be used to freeze all constants, rather than # just literals. # Strict mode is considered an experimental feature. It has not been @@ -45519,6 +45901,17 @@ RuboCop::Cop::Style::MultipleComparison::MSG = T.let(T.unsafe(nil), String) # CONST = Something.new # # +# @example Recursive: false (default) +# # good - only the outer container needs to be frozen +# CONST = [{ a: [], b: 'foo' }].freeze +# +# @example Recursive: true +# # bad - nested mutable literals must be frozen too +# CONST = [{ a: [], b: 'foo' }].freeze +# +# # good +# CONST = [{ a: [].freeze, b: 'foo'.freeze }.freeze].freeze +# # @example EnforcedStyle: strict # # bad # CONST = Something.new @@ -45548,59 +45941,89 @@ RuboCop::Cop::Style::MultipleComparison::MSG = T.let(T.unsafe(nil), String) # # good # CONST = [1, 2, 3] # -# pkg:gem/rubocop#lib/rubocop/cop/style/mutable_constant.rb:83 +# pkg:gem/rubocop#lib/rubocop/cop/style/mutable_constant.rb:102 class RuboCop::Cop::Style::MutableConstant < ::RuboCop::Cop::Base include ::RuboCop::Cop::Style::MutableConstant::ShareableConstantValue include ::RuboCop::Cop::FrozenStringLiteral include ::RuboCop::Cop::ConfigurableEnforcedStyle extend ::RuboCop::Cop::AutoCorrector - # pkg:gem/rubocop#lib/rubocop/cop/style/mutable_constant.rb:127 + # pkg:gem/rubocop#lib/rubocop/cop/style/mutable_constant.rb:146 def on_casgn(node); end - # pkg:gem/rubocop#lib/rubocop/cop/style/mutable_constant.rb:223 + # pkg:gem/rubocop#lib/rubocop/cop/style/mutable_constant.rb:317 def operation_produces_immutable_object?(param0 = T.unsafe(nil)); end - # pkg:gem/rubocop#lib/rubocop/cop/style/mutable_constant.rb:240 + # pkg:gem/rubocop#lib/rubocop/cop/style/mutable_constant.rb:334 def range_enclosed_in_parentheses?(param0 = T.unsafe(nil)); end - # pkg:gem/rubocop#lib/rubocop/cop/style/mutable_constant.rb:216 + # pkg:gem/rubocop#lib/rubocop/cop/style/mutable_constant.rb:310 def splat_value(param0 = T.unsafe(nil)); end private - # pkg:gem/rubocop#lib/rubocop/cop/style/mutable_constant.rb:168 + # pkg:gem/rubocop#lib/rubocop/cop/style/mutable_constant.rb:209 def autocorrect(corrector, node); end - # pkg:gem/rubocop#lib/rubocop/cop/style/mutable_constant.rb:157 - def check(value); end - - # pkg:gem/rubocop#lib/rubocop/cop/style/mutable_constant.rb:207 + # pkg:gem/rubocop#lib/rubocop/cop/style/mutable_constant.rb:301 def correct_splat_expansion(corrector, expr, splat_value); end - # pkg:gem/rubocop#lib/rubocop/cop/style/mutable_constant.rb:199 + # pkg:gem/rubocop#lib/rubocop/cop/style/mutable_constant.rb:267 + def explicitly_frozen_literal?(node); end + + # pkg:gem/rubocop#lib/rubocop/cop/style/mutable_constant.rb:243 + def freezable_nested_literal?(node); end + + # Recursively freezes every nested mutable literal inside an array or + # hash literal. Already-frozen subtrees are not re-frozen, but their + # children are still inspected for unfrozen literals deeper down. + # + # pkg:gem/rubocop#lib/rubocop/cop/style/mutable_constant.rb:233 + def freeze_nested_literals(corrector, node); end + + # pkg:gem/rubocop#lib/rubocop/cop/style/mutable_constant.rb:293 def frozen_regexp_or_range_literals?(node); end - # pkg:gem/rubocop#lib/rubocop/cop/style/mutable_constant.rb:189 + # pkg:gem/rubocop#lib/rubocop/cop/style/mutable_constant.rb:283 def immutable_literal?(node); end - # pkg:gem/rubocop#lib/rubocop/cop/style/mutable_constant.rb:183 + # pkg:gem/rubocop#lib/rubocop/cop/style/mutable_constant.rb:196 + def literal_check(value); end + + # Returns the child literals of an array or hash node that may + # themselves need freezing. For hashes, both keys and values are + # included. Percent-literal arrays (e.g. `%w(a b)`) are skipped because + # `.freeze` cannot be appended to their contents. + # + # pkg:gem/rubocop#lib/rubocop/cop/style/mutable_constant.rb:254 + def literal_children(node); end + + # pkg:gem/rubocop#lib/rubocop/cop/style/mutable_constant.rb:277 def mutable_literal?(value); end - # pkg:gem/rubocop#lib/rubocop/cop/style/mutable_constant.rb:140 + # pkg:gem/rubocop#lib/rubocop/cop/style/mutable_constant.rb:173 + def mutable_nodes(value, &block); end + + # pkg:gem/rubocop#lib/rubocop/cop/style/mutable_constant.rb:204 + def mutable_or_unfrozen_range?(value); end + + # pkg:gem/rubocop#lib/rubocop/cop/style/mutable_constant.rb:159 def on_assignment(value); end - # pkg:gem/rubocop#lib/rubocop/cop/style/mutable_constant.rb:203 + # pkg:gem/rubocop#lib/rubocop/cop/style/mutable_constant.rb:273 + def recursive?; end + + # pkg:gem/rubocop#lib/rubocop/cop/style/mutable_constant.rb:297 def requires_parentheses?(node); end - # pkg:gem/rubocop#lib/rubocop/cop/style/mutable_constant.rb:193 + # pkg:gem/rubocop#lib/rubocop/cop/style/mutable_constant.rb:287 def shareable_constant_value?(node); end - # pkg:gem/rubocop#lib/rubocop/cop/style/mutable_constant.rb:148 + # pkg:gem/rubocop#lib/rubocop/cop/style/mutable_constant.rb:187 def strict_check(value); end end -# pkg:gem/rubocop#lib/rubocop/cop/style/mutable_constant.rb:125 +# pkg:gem/rubocop#lib/rubocop/cop/style/mutable_constant.rb:144 RuboCop::Cop::Style::MutableConstant::MSG = T.let(T.unsafe(nil), String) # Handles magic comment shareable_constant_value with O(n ^ 2) complexity @@ -45608,33 +46031,33 @@ RuboCop::Cop::Style::MutableConstant::MSG = T.let(T.unsafe(nil), String) # Iterates over all lines before a CONSTANT # until it reaches shareable_constant_value # -# pkg:gem/rubocop#lib/rubocop/cop/style/mutable_constant.rb:88 +# pkg:gem/rubocop#lib/rubocop/cop/style/mutable_constant.rb:107 module RuboCop::Cop::Style::MutableConstant::ShareableConstantValue private # Identifies the most recent magic comment with valid shareable constant values # that's in scope for this node # - # pkg:gem/rubocop#lib/rubocop/cop/style/mutable_constant.rb:102 + # pkg:gem/rubocop#lib/rubocop/cop/style/mutable_constant.rb:121 def magic_comment_in_scope(node); end - # pkg:gem/rubocop#lib/rubocop/cop/style/mutable_constant.rb:110 + # pkg:gem/rubocop#lib/rubocop/cop/style/mutable_constant.rb:129 def processed_source_till_node(node); end - # pkg:gem/rubocop#lib/rubocop/cop/style/mutable_constant.rb:91 + # pkg:gem/rubocop#lib/rubocop/cop/style/mutable_constant.rb:110 def recent_shareable_value?(node); end - # pkg:gem/rubocop#lib/rubocop/cop/style/mutable_constant.rb:114 + # pkg:gem/rubocop#lib/rubocop/cop/style/mutable_constant.rb:133 def shareable_constant_value_enabled?(value); end class << self # Identifies the most recent magic comment with valid shareable constant values # that's in scope for this node # - # pkg:gem/rubocop#lib/rubocop/cop/style/mutable_constant.rb:102 + # pkg:gem/rubocop#lib/rubocop/cop/style/mutable_constant.rb:121 def magic_comment_in_scope(node); end - # pkg:gem/rubocop#lib/rubocop/cop/style/mutable_constant.rb:91 + # pkg:gem/rubocop#lib/rubocop/cop/style/mutable_constant.rb:110 def recent_shareable_value?(node); end end end @@ -46441,6 +46864,11 @@ RuboCop::Cop::Style::NilComparison::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Arra # Checks for lambdas and procs that always return nil, # which can be replaced with an empty lambda or proc instead. # +# NOTE: A `proc` that returns nil via an explicit `return` is allowed, +# because in a `proc` `return` exits the enclosing method, so removing it +# would change behavior. A lambda is still reported, since there `return` +# only exits the lambda itself. +# # @example # # bad # -> { nil } @@ -46467,24 +46895,24 @@ RuboCop::Cop::Style::NilComparison::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Arra # # Proc.new { nil if x } # -# pkg:gem/rubocop#lib/rubocop/cop/style/nil_lambda.rb:35 +# pkg:gem/rubocop#lib/rubocop/cop/style/nil_lambda.rb:40 class RuboCop::Cop::Style::NilLambda < ::RuboCop::Cop::Base include ::RuboCop::Cop::RangeHelp extend ::RuboCop::Cop::AutoCorrector - # pkg:gem/rubocop#lib/rubocop/cop/style/nil_lambda.rb:42 + # pkg:gem/rubocop#lib/rubocop/cop/style/nil_lambda.rb:47 def nil_return?(param0 = T.unsafe(nil)); end - # pkg:gem/rubocop#lib/rubocop/cop/style/nil_lambda.rb:46 + # pkg:gem/rubocop#lib/rubocop/cop/style/nil_lambda.rb:51 def on_block(node); end private - # pkg:gem/rubocop#lib/rubocop/cop/style/nil_lambda.rb:58 + # pkg:gem/rubocop#lib/rubocop/cop/style/nil_lambda.rb:66 def autocorrect(corrector, node); end end -# pkg:gem/rubocop#lib/rubocop/cop/style/nil_lambda.rb:39 +# pkg:gem/rubocop#lib/rubocop/cop/style/nil_lambda.rb:44 RuboCop::Cop::Style::NilLambda::MSG = T.let(T.unsafe(nil), String) # Checks for non-nil checks, which are usually redundant. @@ -47457,12 +47885,15 @@ class RuboCop::Cop::Style::OptionalArguments < ::RuboCop::Cop::Base # pkg:gem/rubocop#lib/rubocop/cop/style/optional_arguments.rb:27 def on_def(node); end + # pkg:gem/rubocop#lib/rubocop/cop/style/optional_arguments.rb:30 + def on_defs(node); end + private - # pkg:gem/rubocop#lib/rubocop/cop/style/optional_arguments.rb:45 + # pkg:gem/rubocop#lib/rubocop/cop/style/optional_arguments.rb:46 def argument_positions(arguments); end - # pkg:gem/rubocop#lib/rubocop/cop/style/optional_arguments.rb:33 + # pkg:gem/rubocop#lib/rubocop/cop/style/optional_arguments.rb:34 def each_misplaced_optional_arg(arguments); end end @@ -47610,7 +48041,7 @@ class RuboCop::Cop::Style::ParallelAssignment < ::RuboCop::Cop::Base include ::RuboCop::Cop::RescueNode extend ::RuboCop::Cop::AutoCorrector - # pkg:gem/rubocop#lib/rubocop/cop/style/parallel_assignment.rb:114 + # pkg:gem/rubocop#lib/rubocop/cop/style/parallel_assignment.rb:121 def implicit_self_getter?(param0 = T.unsafe(nil)); end # pkg:gem/rubocop#lib/rubocop/cop/style/parallel_assignment.rb:33 @@ -47622,7 +48053,7 @@ class RuboCop::Cop::Style::ParallelAssignment < ::RuboCop::Cop::Base # This makes the sorting algorithm work for expressions such as # `self.a, self.b = b, a`. # - # pkg:gem/rubocop#lib/rubocop/cop/style/parallel_assignment.rb:107 + # pkg:gem/rubocop#lib/rubocop/cop/style/parallel_assignment.rb:114 def add_self_to_getters(right_elements); end # pkg:gem/rubocop#lib/rubocop/cop/style/parallel_assignment.rb:66 @@ -47634,98 +48065,108 @@ class RuboCop::Cop::Style::ParallelAssignment < ::RuboCop::Cop::Base # pkg:gem/rubocop#lib/rubocop/cop/style/parallel_assignment.rb:72 def allowed_rhs?(node); end - # pkg:gem/rubocop#lib/rubocop/cop/style/parallel_assignment.rb:80 + # pkg:gem/rubocop#lib/rubocop/cop/style/parallel_assignment.rb:87 def assignment_corrector(node, rhs, order); end # pkg:gem/rubocop#lib/rubocop/cop/style/parallel_assignment.rb:53 def autocorrect(corrector, node, rhs); end - # pkg:gem/rubocop#lib/rubocop/cop/style/parallel_assignment.rb:96 + # Autocorrection splits the assignment into single assignments on + # consecutive lines, which would put following assignments into the + # heredoc body unless the heredoc bodies were moved along. + # + # pkg:gem/rubocop#lib/rubocop/cop/style/parallel_assignment.rb:83 + def contains_heredoc?(node); end + + # pkg:gem/rubocop#lib/rubocop/cop/style/parallel_assignment.rb:103 def find_valid_order(left_elements, right_elements); end - # pkg:gem/rubocop#lib/rubocop/cop/style/parallel_assignment.rb:190 + # pkg:gem/rubocop#lib/rubocop/cop/style/parallel_assignment.rb:197 def modifier_statement?(node); end end # Topologically sorts the assignments with Kahn's algorithm. # https://en.wikipedia.org/wiki/Topological_sorting#Kahn's_algorithm # -# pkg:gem/rubocop#lib/rubocop/cop/style/parallel_assignment.rb:118 +# pkg:gem/rubocop#lib/rubocop/cop/style/parallel_assignment.rb:125 class RuboCop::Cop::Style::ParallelAssignment::AssignmentSorter extend ::RuboCop::AST::NodePattern::Macros - # pkg:gem/rubocop#lib/rubocop/cop/style/parallel_assignment.rb:130 + # pkg:gem/rubocop#lib/rubocop/cop/style/parallel_assignment.rb:137 def initialize(assignments); end # `lhs` is an assignment method call like `obj.attr=` or `ary[idx]=`. # Does `rhs` access the same value which is assigned by `lhs`? # - # pkg:gem/rubocop#lib/rubocop/cop/style/parallel_assignment.rb:177 + # pkg:gem/rubocop#lib/rubocop/cop/style/parallel_assignment.rb:184 def accesses?(rhs, lhs); end # Returns all the assignments which must come after `assignment` # (due to dependencies on the previous value of the assigned var) # - # pkg:gem/rubocop#lib/rubocop/cop/style/parallel_assignment.rb:156 + # pkg:gem/rubocop#lib/rubocop/cop/style/parallel_assignment.rb:163 def dependencies_for_assignment(assignment); end - # pkg:gem/rubocop#lib/rubocop/cop/style/parallel_assignment.rb:170 + # pkg:gem/rubocop#lib/rubocop/cop/style/parallel_assignment.rb:177 def dependency?(lhs, rhs); end - # pkg:gem/rubocop#lib/rubocop/cop/style/parallel_assignment.rb:128 + # pkg:gem/rubocop#lib/rubocop/cop/style/parallel_assignment.rb:135 def matching_calls(param0, param1, param2); end - # pkg:gem/rubocop#lib/rubocop/cop/style/parallel_assignment.rb:134 + # pkg:gem/rubocop#lib/rubocop/cop/style/parallel_assignment.rb:141 def tsort; end - # pkg:gem/rubocop#lib/rubocop/cop/style/parallel_assignment.rb:125 + # pkg:gem/rubocop#lib/rubocop/cop/style/parallel_assignment.rb:132 def uses_var?(param0, param1); end - # pkg:gem/rubocop#lib/rubocop/cop/style/parallel_assignment.rb:122 + # pkg:gem/rubocop#lib/rubocop/cop/style/parallel_assignment.rb:129 def var_name(param0 = T.unsafe(nil)); end end # An internal class for correcting parallel assignment # -# pkg:gem/rubocop#lib/rubocop/cop/style/parallel_assignment.rb:197 +# pkg:gem/rubocop#lib/rubocop/cop/style/parallel_assignment.rb:204 class RuboCop::Cop::Style::ParallelAssignment::GenericCorrector include ::RuboCop::Cop::Alignment - # pkg:gem/rubocop#lib/rubocop/cop/style/parallel_assignment.rb:202 + # pkg:gem/rubocop#lib/rubocop/cop/style/parallel_assignment.rb:209 def initialize(node, rhs, modifier, config, new_elements); end - # pkg:gem/rubocop#lib/rubocop/cop/style/parallel_assignment.rb:200 + # pkg:gem/rubocop#lib/rubocop/cop/style/parallel_assignment.rb:207 def config; end - # pkg:gem/rubocop#lib/rubocop/cop/style/parallel_assignment.rb:210 + # pkg:gem/rubocop#lib/rubocop/cop/style/parallel_assignment.rb:217 def correction; end - # pkg:gem/rubocop#lib/rubocop/cop/style/parallel_assignment.rb:214 + # pkg:gem/rubocop#lib/rubocop/cop/style/parallel_assignment.rb:221 def correction_range; end - # pkg:gem/rubocop#lib/rubocop/cop/style/parallel_assignment.rb:200 + # pkg:gem/rubocop#lib/rubocop/cop/style/parallel_assignment.rb:207 def node; end - # pkg:gem/rubocop#lib/rubocop/cop/style/parallel_assignment.rb:200 + # pkg:gem/rubocop#lib/rubocop/cop/style/parallel_assignment.rb:207 def rescue_result; end - # pkg:gem/rubocop#lib/rubocop/cop/style/parallel_assignment.rb:200 + # pkg:gem/rubocop#lib/rubocop/cop/style/parallel_assignment.rb:207 def rhs; end protected - # pkg:gem/rubocop#lib/rubocop/cop/style/parallel_assignment.rb:220 + # pkg:gem/rubocop#lib/rubocop/cop/style/parallel_assignment.rb:227 def assignment; end private - # pkg:gem/rubocop#lib/rubocop/cop/style/parallel_assignment.rb:241 + # pkg:gem/rubocop#lib/rubocop/cop/style/parallel_assignment.rb:257 def cop_config; end - # pkg:gem/rubocop#lib/rubocop/cop/style/parallel_assignment.rb:237 + # pkg:gem/rubocop#lib/rubocop/cop/style/parallel_assignment.rb:253 def extract_sources(node); end - # pkg:gem/rubocop#lib/rubocop/cop/style/parallel_assignment.rb:226 + # pkg:gem/rubocop#lib/rubocop/cop/style/parallel_assignment.rb:249 + def quote(string); end + + # pkg:gem/rubocop#lib/rubocop/cop/style/parallel_assignment.rb:233 def source(node, loc); end end @@ -47735,37 +48176,37 @@ RuboCop::Cop::Style::ParallelAssignment::MSG = T.let(T.unsafe(nil), String) # An internal class for correcting parallel assignment # guarded by if, unless, while, or until # -# pkg:gem/rubocop#lib/rubocop/cop/style/parallel_assignment.rb:283 +# pkg:gem/rubocop#lib/rubocop/cop/style/parallel_assignment.rb:299 class RuboCop::Cop::Style::ParallelAssignment::ModifierCorrector < ::RuboCop::Cop::Style::ParallelAssignment::GenericCorrector - # pkg:gem/rubocop#lib/rubocop/cop/style/parallel_assignment.rb:284 + # pkg:gem/rubocop#lib/rubocop/cop/style/parallel_assignment.rb:300 def correction; end - # pkg:gem/rubocop#lib/rubocop/cop/style/parallel_assignment.rb:293 + # pkg:gem/rubocop#lib/rubocop/cop/style/parallel_assignment.rb:309 def correction_range; end private - # pkg:gem/rubocop#lib/rubocop/cop/style/parallel_assignment.rb:299 + # pkg:gem/rubocop#lib/rubocop/cop/style/parallel_assignment.rb:315 def modifier_range(node); end end # An internal class for correcting parallel assignment # protected by rescue # -# pkg:gem/rubocop#lib/rubocop/cop/style/parallel_assignment.rb:248 +# pkg:gem/rubocop#lib/rubocop/cop/style/parallel_assignment.rb:264 class RuboCop::Cop::Style::ParallelAssignment::RescueCorrector < ::RuboCop::Cop::Style::ParallelAssignment::GenericCorrector - # pkg:gem/rubocop#lib/rubocop/cop/style/parallel_assignment.rb:249 + # pkg:gem/rubocop#lib/rubocop/cop/style/parallel_assignment.rb:265 def correction; end - # pkg:gem/rubocop#lib/rubocop/cop/style/parallel_assignment.rb:260 + # pkg:gem/rubocop#lib/rubocop/cop/style/parallel_assignment.rb:276 def correction_range; end private - # pkg:gem/rubocop#lib/rubocop/cop/style/parallel_assignment.rb:271 + # pkg:gem/rubocop#lib/rubocop/cop/style/parallel_assignment.rb:287 def begin_correction(rescue_result); end - # pkg:gem/rubocop#lib/rubocop/cop/style/parallel_assignment.rb:266 + # pkg:gem/rubocop#lib/rubocop/cop/style/parallel_assignment.rb:282 def def_correction(rescue_result); end end @@ -48068,7 +48509,7 @@ class RuboCop::Cop::Style::PercentLiteralDelimiters < ::RuboCop::Cop::Base # pkg:gem/rubocop#lib/rubocop/cop/style/percent_literal_delimiters.rb:88 def include_same_character_as_used_for_delimiter?(node, type); end - # pkg:gem/rubocop#lib/rubocop/cop/style/percent_literal_delimiters.rb:109 + # pkg:gem/rubocop#lib/rubocop/cop/style/percent_literal_delimiters.rb:111 def matchpairs(begin_delimiter); end # pkg:gem/rubocop#lib/rubocop/cop/style/percent_literal_delimiters.rb:69 @@ -48143,7 +48584,7 @@ RuboCop::Cop::Style::PercentQLiterals::UPPER_CASE_Q_MSG = T.let(T.unsafe(nil), S # Looks for uses of Perl-style regexp match # backreferences and their English versions like -# $1, $2, $&, &+, $MATCH, $PREMATCH, etc. +# $1, $2, $&, $MATCH, $PREMATCH, etc. # # @example # # bad @@ -48171,7 +48612,7 @@ class RuboCop::Cop::Style::PerlBackrefs < ::RuboCop::Cop::Base # @param [RuboCop::AST::Node] node # @return [String] # - # pkg:gem/rubocop#lib/rubocop/cop/style/perl_backrefs.rb:99 + # pkg:gem/rubocop#lib/rubocop/cop/style/perl_backrefs.rb:101 def constant_prefix(node); end # @private @@ -48192,7 +48633,7 @@ class RuboCop::Cop::Style::PerlBackrefs < ::RuboCop::Cop::Base # @private # @param [RuboCop::AST::Node] node # - # pkg:gem/rubocop#lib/rubocop/cop/style/perl_backrefs.rb:109 + # pkg:gem/rubocop#lib/rubocop/cop/style/perl_backrefs.rb:111 def on_back_ref_or_gvar_or_nth_ref(node); end # @private @@ -48213,7 +48654,7 @@ class RuboCop::Cop::Style::PerlBackrefs < ::RuboCop::Cop::Base # @param [RuboCop::AST::Node] node # @return [String, nil] # - # pkg:gem/rubocop#lib/rubocop/cop/style/perl_backrefs.rb:89 + # pkg:gem/rubocop#lib/rubocop/cop/style/perl_backrefs.rb:91 def preferred_expression_to_node_with_constant_prefix(node); end end @@ -49608,10 +50049,10 @@ RuboCop::Cop::Style::RedundantEach::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Arra class RuboCop::Cop::Style::RedundantException < ::RuboCop::Cop::Base extend ::RuboCop::Cop::AutoCorrector - # pkg:gem/rubocop#lib/rubocop/cop/style/redundant_exception.rb:79 + # pkg:gem/rubocop#lib/rubocop/cop/style/redundant_exception.rb:85 def compact?(param0 = T.unsafe(nil)); end - # pkg:gem/rubocop#lib/rubocop/cop/style/redundant_exception.rb:74 + # pkg:gem/rubocop#lib/rubocop/cop/style/redundant_exception.rb:80 def exploded?(param0 = T.unsafe(nil)); end # Switch `raise RuntimeError, 'message'` to `raise 'message'`, and @@ -49622,19 +50063,19 @@ class RuboCop::Cop::Style::RedundantException < ::RuboCop::Cop::Base private - # pkg:gem/rubocop#lib/rubocop/cop/style/redundant_exception.rb:57 + # pkg:gem/rubocop#lib/rubocop/cop/style/redundant_exception.rb:61 def fix_compact(node); end # pkg:gem/rubocop#lib/rubocop/cop/style/redundant_exception.rb:39 def fix_exploded(node); end - # pkg:gem/rubocop#lib/rubocop/cop/style/redundant_exception.rb:65 + # pkg:gem/rubocop#lib/rubocop/cop/style/redundant_exception.rb:71 def replaced_compact(message); end - # pkg:gem/rubocop#lib/rubocop/cop/style/redundant_exception.rb:47 + # pkg:gem/rubocop#lib/rubocop/cop/style/redundant_exception.rb:51 def replaced_exploded(node, command, message); end - # pkg:gem/rubocop#lib/rubocop/cop/style/redundant_exception.rb:53 + # pkg:gem/rubocop#lib/rubocop/cop/style/redundant_exception.rb:57 def string_message?(message); end end @@ -49918,66 +50359,79 @@ class RuboCop::Cop::Style::RedundantFormat < ::RuboCop::Cop::Base private - # pkg:gem/rubocop#lib/rubocop/cop/style/redundant_format.rb:138 + # pkg:gem/rubocop#lib/rubocop/cop/style/redundant_format.rb:159 def all_fields_literal?(string, arguments); end - # pkg:gem/rubocop#lib/rubocop/cop/style/redundant_format.rb:245 + # pkg:gem/rubocop#lib/rubocop/cop/style/redundant_format.rb:266 def argument_value(argument); end - # pkg:gem/rubocop#lib/rubocop/cop/style/redundant_format.rb:241 + # pkg:gem/rubocop#lib/rubocop/cop/style/redundant_format.rb:262 def argument_values(arguments); end - # pkg:gem/rubocop#lib/rubocop/cop/style/redundant_format.rb:277 + # pkg:gem/rubocop#lib/rubocop/cop/style/redundant_format.rb:306 def complex_value(complex_node); end - # pkg:gem/rubocop#lib/rubocop/cop/style/redundant_format.rb:109 + # pkg:gem/rubocop#lib/rubocop/cop/style/redundant_format.rb:129 def detect_unnecessary_fields(node); end - # pkg:gem/rubocop#lib/rubocop/cop/style/redundant_format.rb:263 + # pkg:gem/rubocop#lib/rubocop/cop/style/redundant_format.rb:292 def dsym_value(dsym_node); end # Escape any control characters in the string (eg. `\t` or `\n` become `\\t` or `\\n`) # - # pkg:gem/rubocop#lib/rubocop/cop/style/redundant_format.rb:237 + # pkg:gem/rubocop#lib/rubocop/cop/style/redundant_format.rb:258 def escape_control_chars(string); end - # pkg:gem/rubocop#lib/rubocop/cop/style/redundant_format.rb:169 + # pkg:gem/rubocop#lib/rubocop/cop/style/redundant_format.rb:190 def find_argument(sequence, arguments, hash); end - # pkg:gem/rubocop#lib/rubocop/cop/style/redundant_format.rb:212 + # pkg:gem/rubocop#lib/rubocop/cop/style/redundant_format.rb:233 def float?(argument); end - # pkg:gem/rubocop#lib/rubocop/cop/style/redundant_format.rb:267 + # pkg:gem/rubocop#lib/rubocop/cop/style/redundant_format.rb:296 def hash_value(hash_node); end - # pkg:gem/rubocop#lib/rubocop/cop/style/redundant_format.rb:208 + # pkg:gem/rubocop#lib/rubocop/cop/style/redundant_format.rb:229 def integer?(argument); end - # pkg:gem/rubocop#lib/rubocop/cop/style/redundant_format.rb:184 + # pkg:gem/rubocop#lib/rubocop/cop/style/redundant_format.rb:205 def matching_argument?(sequence, argument); end - # pkg:gem/rubocop#lib/rubocop/cop/style/redundant_format.rb:105 + # pkg:gem/rubocop#lib/rubocop/cop/style/redundant_format.rb:125 def message(node, prefer); end - # pkg:gem/rubocop#lib/rubocop/cop/style/redundant_format.rb:202 + # pkg:gem/rubocop#lib/rubocop/cop/style/redundant_format.rb:223 def numeric?(argument); end # Add correct quotes to the formatted string, preferring retaining the existing # quotes if possible. # - # pkg:gem/rubocop#lib/rubocop/cop/style/redundant_format.rb:218 + # pkg:gem/rubocop#lib/rubocop/cop/style/redundant_format.rb:239 def quote(string, node); end - # pkg:gem/rubocop#lib/rubocop/cop/style/redundant_format.rb:273 + # pkg:gem/rubocop#lib/rubocop/cop/style/redundant_format.rb:302 def rational_value(rational_node); end - # pkg:gem/rubocop#lib/rubocop/cop/style/redundant_format.rb:121 + # pkg:gem/rubocop#lib/rubocop/cop/style/redundant_format.rb:142 def register_all_fields_literal(node, string, arguments); end + # pkg:gem/rubocop#lib/rubocop/cop/style/redundant_format.rb:117 + def static_string_value(node); end + + # A single-argument `format` whose string still contains a format sequence is + # not redundant: `format('%s')` raises at runtime, and `format('%%')` returns + # `'%'`, so replacing it with the literal would change behavior. + # + # pkg:gem/rubocop#lib/rubocop/cop/style/redundant_format.rb:110 + def string_with_format_sequence?(node); end + + # pkg:gem/rubocop#lib/rubocop/cop/style/redundant_format.rb:276 + def typed_argument_value(argument); end + # If the sequence has a variable (`*`) width, it cannot be autocorrected # if the width is not given as a numeric literal argument # - # pkg:gem/rubocop#lib/rubocop/cop/style/redundant_format.rb:161 + # pkg:gem/rubocop#lib/rubocop/cop/style/redundant_format.rb:182 def unknown_variable_width?(sequence, arguments); end end @@ -50407,10 +50861,10 @@ class RuboCop::Cop::Style::RedundantLineContinuation < ::RuboCop::Cop::Base private - # pkg:gem/rubocop#lib/rubocop/cop/style/redundant_line_continuation.rb:234 + # pkg:gem/rubocop#lib/rubocop/cop/style/redundant_line_continuation.rb:242 def argument_is_method?(node); end - # pkg:gem/rubocop#lib/rubocop/cop/style/redundant_line_continuation.rb:200 + # pkg:gem/rubocop#lib/rubocop/cop/style/redundant_line_continuation.rb:208 def argument_newline?(node); end # pkg:gem/rubocop#lib/rubocop/cop/style/redundant_line_continuation.rb:179 @@ -50419,10 +50873,10 @@ class RuboCop::Cop::Style::RedundantLineContinuation < ::RuboCop::Cop::Base # pkg:gem/rubocop#lib/rubocop/cop/style/redundant_line_continuation.rb:113 def ends_with_uncommented_backslash?(range); end - # pkg:gem/rubocop#lib/rubocop/cop/style/redundant_line_continuation.rb:214 + # pkg:gem/rubocop#lib/rubocop/cop/style/redundant_line_continuation.rb:222 def find_node_for_line(last_line); end - # pkg:gem/rubocop#lib/rubocop/cop/style/redundant_line_continuation.rb:185 + # pkg:gem/rubocop#lib/rubocop/cop/style/redundant_line_continuation.rb:193 def inside_string_literal?(range, token); end # pkg:gem/rubocop#lib/rubocop/cop/style/redundant_line_continuation.rb:126 @@ -50437,7 +50891,7 @@ class RuboCop::Cop::Style::RedundantLineContinuation < ::RuboCop::Cop::Base # pkg:gem/rubocop#lib/rubocop/cop/style/redundant_line_continuation.rb:151 def leading_dot_method_chain_with_blank_line?(range); end - # pkg:gem/rubocop#lib/rubocop/cop/style/redundant_line_continuation.rb:241 + # pkg:gem/rubocop#lib/rubocop/cop/style/redundant_line_continuation.rb:249 def method_call_with_arguments?(node); end # A method call without parentheses such as the following cannot remove `\`: @@ -50445,7 +50899,7 @@ class RuboCop::Cop::Style::RedundantLineContinuation < ::RuboCop::Cop::Base # do_something \ # argument # - # pkg:gem/rubocop#lib/rubocop/cop/style/redundant_line_continuation.rb:193 + # pkg:gem/rubocop#lib/rubocop/cop/style/redundant_line_continuation.rb:201 def method_with_argument?(line_range, current_token, next_token); end # pkg:gem/rubocop#lib/rubocop/cop/style/redundant_line_continuation.rb:157 @@ -50454,14 +50908,21 @@ class RuboCop::Cop::Style::RedundantLineContinuation < ::RuboCop::Cop::Base # pkg:gem/rubocop#lib/rubocop/cop/style/redundant_line_continuation.rb:104 def require_line_continuation?(range); end - # pkg:gem/rubocop#lib/rubocop/cop/style/redundant_line_continuation.rb:220 + # pkg:gem/rubocop#lib/rubocop/cop/style/redundant_line_continuation.rb:228 def same_line?(node, line); end - # pkg:gem/rubocop#lib/rubocop/cop/style/redundant_line_continuation.rb:245 + # pkg:gem/rubocop#lib/rubocop/cop/style/redundant_line_continuation.rb:253 def start_with_arithmetic_operator?(range); end # pkg:gem/rubocop#lib/rubocop/cop/style/redundant_line_continuation.rb:122 def string_concatenation?(source_line); end + + # The backslash is the last character of the line; locate it by the line's + # position in the buffer rather than treating the column as an absolute offset + # (which corrupts an earlier line in multi-line files). + # + # pkg:gem/rubocop#lib/rubocop/cop/style/redundant_line_continuation.rb:188 + def trailing_line_continuation_range(line_number); end end # pkg:gem/rubocop#lib/rubocop/cop/style/redundant_line_continuation.rb:74 @@ -50996,14 +51457,14 @@ class RuboCop::Cop::Style::RedundantRegexpEscape < ::RuboCop::Cop::Base # pkg:gem/rubocop#lib/rubocop/cop/style/redundant_regexp_escape.rb:94 def delimiter?(node, char); end - # pkg:gem/rubocop#lib/rubocop/cop/style/redundant_regexp_escape.rb:106 + # pkg:gem/rubocop#lib/rubocop/cop/style/redundant_regexp_escape.rb:110 def each_escape(node); end - # pkg:gem/rubocop#lib/rubocop/cop/style/redundant_regexp_escape.rb:118 + # pkg:gem/rubocop#lib/rubocop/cop/style/redundant_regexp_escape.rb:122 def escape_range_at_index(node, index); end # pkg:gem/rubocop#lib/rubocop/cop/style/redundant_regexp_escape.rb:100 - def requires_escape_to_avoid_interpolation?(char_before_escape, escaped_char); end + def requires_escape_to_avoid_interpolation?(node, index, escaped_char); end end # pkg:gem/rubocop#lib/rubocop/cop/style/redundant_regexp_escape.rb:41 @@ -51199,7 +51660,7 @@ class RuboCop::Cop::Style::RedundantSelf < ::RuboCop::Cop::Base # pkg:gem/rubocop#lib/rubocop/cop/style/redundant_self.rb:87 def on_args(node); end - # pkg:gem/rubocop#lib/rubocop/cop/style/redundant_self.rb:119 + # pkg:gem/rubocop#lib/rubocop/cop/style/redundant_self.rb:128 def on_block(node); end # pkg:gem/rubocop#lib/rubocop/cop/style/redundant_self.rb:91 @@ -51213,13 +51674,13 @@ class RuboCop::Cop::Style::RedundantSelf < ::RuboCop::Cop::Base # pkg:gem/rubocop#lib/rubocop/cop/style/redundant_self.rb:85 def on_defs(node); end - # pkg:gem/rubocop#lib/rubocop/cop/style/redundant_self.rb:126 + # pkg:gem/rubocop#lib/rubocop/cop/style/redundant_self.rb:135 def on_if(node); end - # pkg:gem/rubocop#lib/rubocop/cop/style/redundant_self.rb:103 + # pkg:gem/rubocop#lib/rubocop/cop/style/redundant_self.rb:112 def on_in_pattern(node); end - # pkg:gem/rubocop#lib/rubocop/cop/style/redundant_self.rb:124 + # pkg:gem/rubocop#lib/rubocop/cop/style/redundant_self.rb:133 def on_itblock(node); end # pkg:gem/rubocop#lib/rubocop/cop/style/redundant_self.rb:99 @@ -51228,7 +51689,7 @@ class RuboCop::Cop::Style::RedundantSelf < ::RuboCop::Cop::Base # pkg:gem/rubocop#lib/rubocop/cop/style/redundant_self.rb:95 def on_masgn(node); end - # pkg:gem/rubocop#lib/rubocop/cop/style/redundant_self.rb:123 + # pkg:gem/rubocop#lib/rubocop/cop/style/redundant_self.rb:132 def on_numblock(node); end # pkg:gem/rubocop#lib/rubocop/cop/style/redundant_self.rb:76 @@ -51239,33 +51700,39 @@ class RuboCop::Cop::Style::RedundantSelf < ::RuboCop::Cop::Base # pkg:gem/rubocop#lib/rubocop/cop/style/redundant_self.rb:68 def on_or_asgn(node); end - # pkg:gem/rubocop#lib/rubocop/cop/style/redundant_self.rb:107 + # Register the exception variable of `rescue => e` so that `self.e` in the + # body is not treated as redundant (it disambiguates the local variable). + # + # pkg:gem/rubocop#lib/rubocop/cop/style/redundant_self.rb:105 + def on_resbody(node); end + + # pkg:gem/rubocop#lib/rubocop/cop/style/redundant_self.rb:116 def on_send(node); end - # pkg:gem/rubocop#lib/rubocop/cop/style/redundant_self.rb:138 + # pkg:gem/rubocop#lib/rubocop/cop/style/redundant_self.rb:147 def on_until(node); end - # pkg:gem/rubocop#lib/rubocop/cop/style/redundant_self.rb:137 + # pkg:gem/rubocop#lib/rubocop/cop/style/redundant_self.rb:146 def on_while(node); end private - # pkg:gem/rubocop#lib/rubocop/cop/style/redundant_self.rb:193 + # pkg:gem/rubocop#lib/rubocop/cop/style/redundant_self.rb:202 def add_lhs_to_local_variables_scopes(rhs, lhs); end - # pkg:gem/rubocop#lib/rubocop/cop/style/redundant_self.rb:201 + # pkg:gem/rubocop#lib/rubocop/cop/style/redundant_self.rb:210 def add_masgn_lhs_variables(rhs, lhs); end - # pkg:gem/rubocop#lib/rubocop/cop/style/redundant_self.rb:207 + # pkg:gem/rubocop#lib/rubocop/cop/style/redundant_self.rb:216 def add_match_var_scopes(in_pattern_node); end - # pkg:gem/rubocop#lib/rubocop/cop/style/redundant_self.rb:142 + # pkg:gem/rubocop#lib/rubocop/cop/style/redundant_self.rb:151 def add_scope(node, local_variables = T.unsafe(nil)); end - # pkg:gem/rubocop#lib/rubocop/cop/style/redundant_self.rb:187 + # pkg:gem/rubocop#lib/rubocop/cop/style/redundant_self.rb:196 def allow_self(node); end - # pkg:gem/rubocop#lib/rubocop/cop/style/redundant_self.rb:148 + # pkg:gem/rubocop#lib/rubocop/cop/style/redundant_self.rb:157 def allowed_send_node?(node); end # Respects `Lint/ItWithoutArgumentsInBlock` cop and the following Ruby 3.3's warning: @@ -51274,13 +51741,13 @@ class RuboCop::Cop::Style::RedundantSelf < ::RuboCop::Cop::Base # -e:1: warning: `it` calls without arguments will refer to the first block param in # Ruby 3.4; use it() or self.it # - # pkg:gem/rubocop#lib/rubocop/cop/style/redundant_self.rb:163 + # pkg:gem/rubocop#lib/rubocop/cop/style/redundant_self.rb:172 def it_method_in_block?(node); end - # pkg:gem/rubocop#lib/rubocop/cop/style/redundant_self.rb:179 + # pkg:gem/rubocop#lib/rubocop/cop/style/redundant_self.rb:188 def on_argument(node); end - # pkg:gem/rubocop#lib/rubocop/cop/style/redundant_self.rb:171 + # pkg:gem/rubocop#lib/rubocop/cop/style/redundant_self.rb:180 def regular_method_call?(node); end class << self @@ -51754,6 +52221,12 @@ class RuboCop::Cop::Style::RedundantStructKeywordInit < ::RuboCop::Cop::Base # pkg:gem/rubocop#lib/rubocop/cop/style/redundant_struct_keyword_init.rb:102 def range(redundant_keyword_init); end + # pkg:gem/rubocop#lib/rubocop/cop/style/redundant_struct_keyword_init.rb:123 + def range_emptying_hash(pair); end + + # pkg:gem/rubocop#lib/rubocop/cop/style/redundant_struct_keyword_init.rb:113 + def range_within_hash(pair); end + # pkg:gem/rubocop#lib/rubocop/cop/style/redundant_struct_keyword_init.rb:92 def register_offense(keyword_init); end @@ -53162,28 +53635,34 @@ class RuboCop::Cop::Style::Semicolon < ::RuboCop::Cop::Base # pkg:gem/rubocop#lib/rubocop/cop/style/semicolon.rb:117 def exist_semicolon_before_right_string_interpolation_brace?(tokens); end - # pkg:gem/rubocop#lib/rubocop/cop/style/semicolon.rb:151 + # pkg:gem/rubocop#lib/rubocop/cop/style/semicolon.rb:166 def expressions_per_line(exprs); end - # pkg:gem/rubocop#lib/rubocop/cop/style/semicolon.rb:165 + # pkg:gem/rubocop#lib/rubocop/cop/style/semicolon.rb:180 def find_node(nodes, token_before_semicolon); end - # pkg:gem/rubocop#lib/rubocop/cop/style/semicolon.rb:157 + # pkg:gem/rubocop#lib/rubocop/cop/style/semicolon.rb:172 def find_semicolon_positions(line); end - # pkg:gem/rubocop#lib/rubocop/cop/style/semicolon.rb:171 + # pkg:gem/rubocop#lib/rubocop/cop/style/semicolon.rb:159 + def heredoc_opened_before_semicolon?(semicolon_range); end + + # pkg:gem/rubocop#lib/rubocop/cop/style/semicolon.rb:186 def range_nodes; end # pkg:gem/rubocop#lib/rubocop/cop/style/semicolon.rb:126 def register_semicolon(line, column, after_expression, token_before_semicolon = T.unsafe(nil)); end + # pkg:gem/rubocop#lib/rubocop/cop/style/semicolon.rb:151 + def replace_semicolon_with_line_break(corrector, range); end + # pkg:gem/rubocop#lib/rubocop/cop/style/semicolon.rb:87 def semicolon_position(tokens); end # pkg:gem/rubocop#lib/rubocop/cop/style/semicolon.rb:82 def tokens_for_lines; end - # pkg:gem/rubocop#lib/rubocop/cop/style/semicolon.rb:179 + # pkg:gem/rubocop#lib/rubocop/cop/style/semicolon.rb:194 def value_omission_pair_nodes; end class << self @@ -53613,19 +54092,25 @@ class RuboCop::Cop::Style::SingleLineDoEndBlock < ::RuboCop::Cop::Base # pkg:gem/rubocop#lib/rubocop/cop/style/single_line_do_end_block.rb:40 def on_block(node); end - # pkg:gem/rubocop#lib/rubocop/cop/style/single_line_do_end_block.rb:59 + # pkg:gem/rubocop#lib/rubocop/cop/style/single_line_do_end_block.rb:60 def on_itblock(node); end - # pkg:gem/rubocop#lib/rubocop/cop/style/single_line_do_end_block.rb:58 + # pkg:gem/rubocop#lib/rubocop/cop/style/single_line_do_end_block.rb:59 def on_numblock(node); end private - # pkg:gem/rubocop#lib/rubocop/cop/style/single_line_do_end_block.rb:63 + # pkg:gem/rubocop#lib/rubocop/cop/style/single_line_do_end_block.rb:76 def do_line(node); end - # pkg:gem/rubocop#lib/rubocop/cop/style/single_line_do_end_block.rb:72 + # pkg:gem/rubocop#lib/rubocop/cop/style/single_line_do_end_block.rb:85 def single_line_blocks_preferred?; end + + # Returns the heredoc opened on the block's line whose body extends the + # furthest down, whether it is the block body itself or nested within it. + # + # pkg:gem/rubocop#lib/rubocop/cop/style/single_line_do_end_block.rb:66 + def trailing_heredoc(node_body); end end # pkg:gem/rubocop#lib/rubocop/cop/style/single_line_do_end_block.rb:37 @@ -55318,36 +55803,36 @@ RuboCop::Cop::Style::TallyMethod::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array) # Corrector to correct conditional assignment in ternary conditions. # -# pkg:gem/rubocop#lib/rubocop/cop/style/conditional_assignment.rb:501 +# pkg:gem/rubocop#lib/rubocop/cop/style/conditional_assignment.rb:504 class RuboCop::Cop::Style::TernaryCorrector extend ::RuboCop::Cop::Style::ConditionalAssignmentHelper extend ::RuboCop::Cop::Style::ConditionalCorrectorHelper class << self - # pkg:gem/rubocop#lib/rubocop/cop/style/conditional_assignment.rb:506 + # pkg:gem/rubocop#lib/rubocop/cop/style/conditional_assignment.rb:509 def correct(corrector, node); end - # pkg:gem/rubocop#lib/rubocop/cop/style/conditional_assignment.rb:510 + # pkg:gem/rubocop#lib/rubocop/cop/style/conditional_assignment.rb:513 def move_assignment_inside_condition(corrector, node); end private - # pkg:gem/rubocop#lib/rubocop/cop/style/conditional_assignment.rb:524 + # pkg:gem/rubocop#lib/rubocop/cop/style/conditional_assignment.rb:527 def correction(node); end - # pkg:gem/rubocop#lib/rubocop/cop/style/conditional_assignment.rb:537 + # pkg:gem/rubocop#lib/rubocop/cop/style/conditional_assignment.rb:540 def element_assignment?(node); end - # pkg:gem/rubocop#lib/rubocop/cop/style/conditional_assignment.rb:541 + # pkg:gem/rubocop#lib/rubocop/cop/style/conditional_assignment.rb:544 def extract_branches(node); end - # pkg:gem/rubocop#lib/rubocop/cop/style/conditional_assignment.rb:554 + # pkg:gem/rubocop#lib/rubocop/cop/style/conditional_assignment.rb:557 def move_branch_inside_condition(corrector, branch, assignment); end - # pkg:gem/rubocop#lib/rubocop/cop/style/conditional_assignment.rb:549 + # pkg:gem/rubocop#lib/rubocop/cop/style/conditional_assignment.rb:552 def remove_parentheses(corrector, node); end - # pkg:gem/rubocop#lib/rubocop/cop/style/conditional_assignment.rb:528 + # pkg:gem/rubocop#lib/rubocop/cop/style/conditional_assignment.rb:531 def ternary(node); end end end @@ -55411,7 +55896,7 @@ class RuboCop::Cop::Style::TernaryParentheses < ::RuboCop::Cop::Base include ::RuboCop::Cop::SurroundingSpace extend ::RuboCop::Cop::AutoCorrector - # pkg:gem/rubocop#lib/rubocop/cop/style/ternary_parentheses.rb:191 + # pkg:gem/rubocop#lib/rubocop/cop/style/ternary_parentheses.rb:202 def method_name(param0 = T.unsafe(nil)); end # pkg:gem/rubocop#lib/rubocop/cop/style/ternary_parentheses.rb:69 @@ -55422,40 +55907,40 @@ class RuboCop::Cop::Style::TernaryParentheses < ::RuboCop::Cop::Base # pkg:gem/rubocop#lib/rubocop/cop/style/ternary_parentheses.rb:100 def autocorrect(corrector, node); end - # pkg:gem/rubocop#lib/rubocop/cop/style/ternary_parentheses.rb:181 + # pkg:gem/rubocop#lib/rubocop/cop/style/ternary_parentheses.rb:192 def below_ternary_precedence?(child); end # If the condition is parenthesized we recurse and check for any # complex expressions within it. # - # pkg:gem/rubocop#lib/rubocop/cop/style/ternary_parentheses.rb:131 + # pkg:gem/rubocop#lib/rubocop/cop/style/ternary_parentheses.rb:135 def complex_condition?(condition); end # pkg:gem/rubocop#lib/rubocop/cop/style/ternary_parentheses.rb:89 def condition_as_parenthesized_one_line_pattern_matching?(condition); end - # pkg:gem/rubocop#lib/rubocop/cop/style/ternary_parentheses.rb:196 + # pkg:gem/rubocop#lib/rubocop/cop/style/ternary_parentheses.rb:207 def correct_parenthesized(corrector, condition); end - # pkg:gem/rubocop#lib/rubocop/cop/style/ternary_parentheses.rb:210 + # pkg:gem/rubocop#lib/rubocop/cop/style/ternary_parentheses.rb:221 def correct_unparenthesized(corrector, condition); end - # pkg:gem/rubocop#lib/rubocop/cop/style/ternary_parentheses.rb:151 + # pkg:gem/rubocop#lib/rubocop/cop/style/ternary_parentheses.rb:155 def message(node); end - # pkg:gem/rubocop#lib/rubocop/cop/style/ternary_parentheses.rb:227 + # pkg:gem/rubocop#lib/rubocop/cop/style/ternary_parentheses.rb:238 def node_args_need_parens?(send_node); end - # pkg:gem/rubocop#lib/rubocop/cop/style/ternary_parentheses.rb:234 + # pkg:gem/rubocop#lib/rubocop/cop/style/ternary_parentheses.rb:245 def node_with_args?(node); end # Anything that is not a variable, constant, or method/.method call # will be counted as a complex expression. # - # pkg:gem/rubocop#lib/rubocop/cop/style/ternary_parentheses.rb:141 + # pkg:gem/rubocop#lib/rubocop/cop/style/ternary_parentheses.rb:145 def non_complex_expression?(condition); end - # pkg:gem/rubocop#lib/rubocop/cop/style/ternary_parentheses.rb:145 + # pkg:gem/rubocop#lib/rubocop/cop/style/ternary_parentheses.rb:149 def non_complex_send?(node); end # pkg:gem/rubocop#lib/rubocop/cop/style/ternary_parentheses.rb:113 @@ -55464,25 +55949,28 @@ class RuboCop::Cop::Style::TernaryParentheses < ::RuboCop::Cop::Base # pkg:gem/rubocop#lib/rubocop/cop/style/ternary_parentheses.rb:85 def only_closing_parenthesis_is_last_line?(condition); end - # pkg:gem/rubocop#lib/rubocop/cop/style/ternary_parentheses.rb:214 + # pkg:gem/rubocop#lib/rubocop/cop/style/ternary_parentheses.rb:225 def parenthesize_condition_arguments(corrector, send_node); end - # pkg:gem/rubocop#lib/rubocop/cop/style/ternary_parentheses.rb:169 + # pkg:gem/rubocop#lib/rubocop/cop/style/ternary_parentheses.rb:173 def parenthesized?(node); end - # pkg:gem/rubocop#lib/rubocop/cop/style/ternary_parentheses.rb:161 - def require_parentheses?; end + # pkg:gem/rubocop#lib/rubocop/cop/style/ternary_parentheses.rb:181 + def parenthesized_modifier_condition?(condition); end # pkg:gem/rubocop#lib/rubocop/cop/style/ternary_parentheses.rb:165 + def require_parentheses?; end + + # pkg:gem/rubocop#lib/rubocop/cop/style/ternary_parentheses.rb:169 def require_parentheses_when_complex?; end - # pkg:gem/rubocop#lib/rubocop/cop/style/ternary_parentheses.rb:177 + # pkg:gem/rubocop#lib/rubocop/cop/style/ternary_parentheses.rb:188 def unparenthesized_method_call?(child); end - # pkg:gem/rubocop#lib/rubocop/cop/style/ternary_parentheses.rb:173 + # pkg:gem/rubocop#lib/rubocop/cop/style/ternary_parentheses.rb:177 def unsafe_autocorrect?(condition); end - # pkg:gem/rubocop#lib/rubocop/cop/style/ternary_parentheses.rb:222 + # pkg:gem/rubocop#lib/rubocop/cop/style/ternary_parentheses.rb:233 def whitespace_after?(node); end end @@ -56266,7 +56754,7 @@ class RuboCop::Cop::Style::TrailingUnderscoreVariable < ::RuboCop::Cop::Base # pkg:gem/rubocop#lib/rubocop/cop/style/trailing_underscore_variable.rb:92 def allow_named_underscore_variables; end - # pkg:gem/rubocop#lib/rubocop/cop/style/trailing_underscore_variable.rb:125 + # pkg:gem/rubocop#lib/rubocop/cop/style/trailing_underscore_variable.rb:123 def children_offenses(variables); end # pkg:gem/rubocop#lib/rubocop/cop/style/trailing_underscore_variable.rb:57 @@ -56278,7 +56766,7 @@ class RuboCop::Cop::Style::TrailingUnderscoreVariable < ::RuboCop::Cop::Base # pkg:gem/rubocop#lib/rubocop/cop/style/trailing_underscore_variable.rb:108 def main_node_offense(node); end - # pkg:gem/rubocop#lib/rubocop/cop/style/trailing_underscore_variable.rb:146 + # pkg:gem/rubocop#lib/rubocop/cop/style/trailing_underscore_variable.rb:145 def range_for_parentheses(offense, left); end # pkg:gem/rubocop#lib/rubocop/cop/style/trailing_underscore_variable.rb:88 @@ -56290,10 +56778,10 @@ class RuboCop::Cop::Style::TrailingUnderscoreVariable < ::RuboCop::Cop::Base # pkg:gem/rubocop#lib/rubocop/cop/style/trailing_underscore_variable.rb:96 def unneeded_ranges(node); end - # pkg:gem/rubocop#lib/rubocop/cop/style/trailing_underscore_variable.rb:133 - def unused_range(node_type, mlhs_node, right); end + # pkg:gem/rubocop#lib/rubocop/cop/style/trailing_underscore_variable.rb:131 + def unused_range(node, mlhs_node); end - # pkg:gem/rubocop#lib/rubocop/cop/style/trailing_underscore_variable.rb:129 + # pkg:gem/rubocop#lib/rubocop/cop/style/trailing_underscore_variable.rb:127 def unused_variables_only?(offense, variables); end end @@ -56722,11 +57210,16 @@ RuboCop::Cop::Style::WhenThen::MSG = T.let(T.unsafe(nil), String) class RuboCop::Cop::Style::WhileUntilDo < ::RuboCop::Cop::Base extend ::RuboCop::Cop::AutoCorrector - # pkg:gem/rubocop#lib/rubocop/cop/style/while_until_do.rb:43 + # pkg:gem/rubocop#lib/rubocop/cop/style/while_until_do.rb:44 def on_until(node); end # pkg:gem/rubocop#lib/rubocop/cop/style/while_until_do.rb:34 def on_while(node); end + + private + + # pkg:gem/rubocop#lib/rubocop/cop/style/while_until_do.rb:48 + def same_line_body?(node); end end # pkg:gem/rubocop#lib/rubocop/cop/style/while_until_do.rb:32 @@ -56874,22 +57367,22 @@ class RuboCop::Cop::Style::WordArray < ::RuboCop::Cop::Base private - # pkg:gem/rubocop#lib/rubocop/cop/style/word_array.rb:138 + # pkg:gem/rubocop#lib/rubocop/cop/style/word_array.rb:139 def build_bracketed_array(node); end - # pkg:gem/rubocop#lib/rubocop/cop/style/word_array.rb:118 + # pkg:gem/rubocop#lib/rubocop/cop/style/word_array.rb:119 def complex_content?(strings, complex_regex: T.unsafe(nil)); end - # pkg:gem/rubocop#lib/rubocop/cop/style/word_array.rb:129 + # pkg:gem/rubocop#lib/rubocop/cop/style/word_array.rb:130 def invalid_percent_array_contents?(node); end - # pkg:gem/rubocop#lib/rubocop/cop/style/word_array.rb:113 + # pkg:gem/rubocop#lib/rubocop/cop/style/word_array.rb:114 def matrix_of_complex_content?(array); end - # pkg:gem/rubocop#lib/rubocop/cop/style/word_array.rb:107 + # pkg:gem/rubocop#lib/rubocop/cop/style/word_array.rb:108 def within_matrix_of_complex_content?(node); end - # pkg:gem/rubocop#lib/rubocop/cop/style/word_array.rb:134 + # pkg:gem/rubocop#lib/rubocop/cop/style/word_array.rb:135 def word_regex; end class << self @@ -57177,8 +57670,10 @@ RuboCop::Cop::Style::YodaExpression::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Arr # `receiver.length < 1` and `receiver.size == 0` that can be # replaced by `receiver.empty?` and `!receiver.empty?`. # -# NOTE: `File`, `Tempfile`, and `StringIO` do not have `empty?` -# so allow `size == 0` and `size.zero?`. +# NOTE: `File`, `Tempfile`, `StringIO`, and `File::Stat` do not have `empty?` +# so allow `size == 0` and `size.zero?`. Note that when a `File::Stat` object +# is stored in a variable (e.g. `stat = File.stat(path); stat.size.zero?`), +# the cop cannot detect the type and may still register a false positive. # # @safety # This cop is unsafe because it cannot be guaranteed that the receiver @@ -57203,56 +57698,56 @@ RuboCop::Cop::Style::YodaExpression::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Arr # !string.empty? # !hash.empty? # -# pkg:gem/rubocop#lib/rubocop/cop/style/zero_length_predicate.rb:37 +# pkg:gem/rubocop#lib/rubocop/cop/style/zero_length_predicate.rb:39 class RuboCop::Cop::Style::ZeroLengthPredicate < ::RuboCop::Cop::Base extend ::RuboCop::Cop::AutoCorrector - # pkg:gem/rubocop#lib/rubocop/cop/style/zero_length_predicate.rb:147 + # pkg:gem/rubocop#lib/rubocop/cop/style/zero_length_predicate.rb:149 def non_polymorphic_collection?(param0 = T.unsafe(nil)); end - # pkg:gem/rubocop#lib/rubocop/cop/style/zero_length_predicate.rb:114 + # pkg:gem/rubocop#lib/rubocop/cop/style/zero_length_predicate.rb:116 def nonzero_length_comparison(param0 = T.unsafe(nil)); end - # pkg:gem/rubocop#lib/rubocop/cop/style/zero_length_predicate.rb:51 + # pkg:gem/rubocop#lib/rubocop/cop/style/zero_length_predicate.rb:53 def on_csend(node); end - # pkg:gem/rubocop#lib/rubocop/cop/style/zero_length_predicate.rb:45 + # pkg:gem/rubocop#lib/rubocop/cop/style/zero_length_predicate.rb:47 def on_send(node); end - # pkg:gem/rubocop#lib/rubocop/cop/style/zero_length_predicate.rb:138 + # pkg:gem/rubocop#lib/rubocop/cop/style/zero_length_predicate.rb:140 def other_length_node(param0 = T.unsafe(nil)); end - # pkg:gem/rubocop#lib/rubocop/cop/style/zero_length_predicate.rb:106 + # pkg:gem/rubocop#lib/rubocop/cop/style/zero_length_predicate.rb:108 def zero_length_comparison(param0 = T.unsafe(nil)); end - # pkg:gem/rubocop#lib/rubocop/cop/style/zero_length_predicate.rb:130 + # pkg:gem/rubocop#lib/rubocop/cop/style/zero_length_predicate.rb:132 def zero_length_node(param0 = T.unsafe(nil)); end - # pkg:gem/rubocop#lib/rubocop/cop/style/zero_length_predicate.rb:101 + # pkg:gem/rubocop#lib/rubocop/cop/style/zero_length_predicate.rb:103 def zero_length_predicate?(param0 = T.unsafe(nil)); end private - # pkg:gem/rubocop#lib/rubocop/cop/style/zero_length_predicate.rb:85 + # pkg:gem/rubocop#lib/rubocop/cop/style/zero_length_predicate.rb:87 def check_nonzero_length_comparison(node); end - # pkg:gem/rubocop#lib/rubocop/cop/style/zero_length_predicate.rb:70 + # pkg:gem/rubocop#lib/rubocop/cop/style/zero_length_predicate.rb:72 def check_zero_length_comparison(node); end - # pkg:gem/rubocop#lib/rubocop/cop/style/zero_length_predicate.rb:58 + # pkg:gem/rubocop#lib/rubocop/cop/style/zero_length_predicate.rb:60 def check_zero_length_predicate(node); end - # pkg:gem/rubocop#lib/rubocop/cop/style/zero_length_predicate.rb:119 + # pkg:gem/rubocop#lib/rubocop/cop/style/zero_length_predicate.rb:121 def replacement(node); end end -# pkg:gem/rubocop#lib/rubocop/cop/style/zero_length_predicate.rb:41 +# pkg:gem/rubocop#lib/rubocop/cop/style/zero_length_predicate.rb:43 RuboCop::Cop::Style::ZeroLengthPredicate::NONZERO_MSG = T.let(T.unsafe(nil), String) -# pkg:gem/rubocop#lib/rubocop/cop/style/zero_length_predicate.rb:43 +# pkg:gem/rubocop#lib/rubocop/cop/style/zero_length_predicate.rb:45 RuboCop::Cop::Style::ZeroLengthPredicate::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array) -# pkg:gem/rubocop#lib/rubocop/cop/style/zero_length_predicate.rb:40 +# pkg:gem/rubocop#lib/rubocop/cop/style/zero_length_predicate.rb:42 RuboCop::Cop::Style::ZeroLengthPredicate::ZERO_MSG = T.let(T.unsafe(nil), String) # Common functionality for checking and correcting surrounding whitespace. @@ -59859,61 +60354,64 @@ class RuboCop::Formatter::DisabledConfigFormatter < ::RuboCop::Formatter::BaseFo # pkg:gem/rubocop#lib/rubocop/formatter/disabled_config_formatter.rb:90 def command; end - # pkg:gem/rubocop#lib/rubocop/formatter/disabled_config_formatter.rb:185 + # pkg:gem/rubocop#lib/rubocop/formatter/disabled_config_formatter.rb:192 def cop_config_params(default_cfg, cfg); end - # pkg:gem/rubocop#lib/rubocop/formatter/disabled_config_formatter.rb:203 + # pkg:gem/rubocop#lib/rubocop/formatter/disabled_config_formatter.rb:210 def default_config(cop_name); end - # pkg:gem/rubocop#lib/rubocop/formatter/disabled_config_formatter.rb:247 + # pkg:gem/rubocop#lib/rubocop/formatter/disabled_config_formatter.rb:106 + def exclude_limit_option; end + + # pkg:gem/rubocop#lib/rubocop/formatter/disabled_config_formatter.rb:254 def excludes(offending_files, cop_name, parent); end - # pkg:gem/rubocop#lib/rubocop/formatter/disabled_config_formatter.rb:218 + # pkg:gem/rubocop#lib/rubocop/formatter/disabled_config_formatter.rb:225 def filtered_config(cfg); end # Returns true if the given arr include the given elm or if any of the # given arr is a regexp that matches the given elm. # - # pkg:gem/rubocop#lib/rubocop/formatter/disabled_config_formatter.rb:295 + # pkg:gem/rubocop#lib/rubocop/formatter/disabled_config_formatter.rb:302 def include_or_match?(arr, elm); end - # pkg:gem/rubocop#lib/rubocop/formatter/disabled_config_formatter.rb:268 + # pkg:gem/rubocop#lib/rubocop/formatter/disabled_config_formatter.rb:275 def merge_mode_for_exclude?(cfg); end - # pkg:gem/rubocop#lib/rubocop/formatter/disabled_config_formatter.rb:289 + # pkg:gem/rubocop#lib/rubocop/formatter/disabled_config_formatter.rb:296 def no_exclude_limit?; end - # pkg:gem/rubocop#lib/rubocop/formatter/disabled_config_formatter.rb:119 + # pkg:gem/rubocop#lib/rubocop/formatter/disabled_config_formatter.rb:126 def output_cop(cop_name, offense_count); end - # pkg:gem/rubocop#lib/rubocop/formatter/disabled_config_formatter.rb:157 + # pkg:gem/rubocop#lib/rubocop/formatter/disabled_config_formatter.rb:164 def output_cop_comments(output_buffer, cfg, cop_name, offense_count); end - # pkg:gem/rubocop#lib/rubocop/formatter/disabled_config_formatter.rb:207 + # pkg:gem/rubocop#lib/rubocop/formatter/disabled_config_formatter.rb:214 def output_cop_config(output_buffer, cfg, cop_name); end - # pkg:gem/rubocop#lib/rubocop/formatter/disabled_config_formatter.rb:189 + # pkg:gem/rubocop#lib/rubocop/formatter/disabled_config_formatter.rb:196 def output_cop_param_comments(output_buffer, params, default_cfg); end - # pkg:gem/rubocop#lib/rubocop/formatter/disabled_config_formatter.rb:237 + # pkg:gem/rubocop#lib/rubocop/formatter/disabled_config_formatter.rb:244 def output_exclude_list(output_buffer, offending_files, cop_name); end - # pkg:gem/rubocop#lib/rubocop/formatter/disabled_config_formatter.rb:272 + # pkg:gem/rubocop#lib/rubocop/formatter/disabled_config_formatter.rb:279 def output_exclude_path(output_buffer, exclude_path, parent); end - # pkg:gem/rubocop#lib/rubocop/formatter/disabled_config_formatter.rb:226 + # pkg:gem/rubocop#lib/rubocop/formatter/disabled_config_formatter.rb:233 def output_offending_files(output_buffer, cfg, cop_name); end - # pkg:gem/rubocop#lib/rubocop/formatter/disabled_config_formatter.rb:113 + # pkg:gem/rubocop#lib/rubocop/formatter/disabled_config_formatter.rb:120 def output_offenses; end - # pkg:gem/rubocop#lib/rubocop/formatter/disabled_config_formatter.rb:285 + # pkg:gem/rubocop#lib/rubocop/formatter/disabled_config_formatter.rb:292 def safe_autocorrect?(config); end - # pkg:gem/rubocop#lib/rubocop/formatter/disabled_config_formatter.rb:133 + # pkg:gem/rubocop#lib/rubocop/formatter/disabled_config_formatter.rb:140 def set_max(cfg, cop_name); end - # pkg:gem/rubocop#lib/rubocop/formatter/disabled_config_formatter.rb:145 + # pkg:gem/rubocop#lib/rubocop/formatter/disabled_config_formatter.rb:152 def should_set_max?(cop_name); end # pkg:gem/rubocop#lib/rubocop/formatter/disabled_config_formatter.rb:82 @@ -59922,13 +60420,13 @@ class RuboCop::Formatter::DisabledConfigFormatter < ::RuboCop::Formatter::BaseFo # pkg:gem/rubocop#lib/rubocop/formatter/disabled_config_formatter.rb:78 def show_timestamp?; end - # pkg:gem/rubocop#lib/rubocop/formatter/disabled_config_formatter.rb:177 + # pkg:gem/rubocop#lib/rubocop/formatter/disabled_config_formatter.rb:184 def supports_safe_autocorrect?(cop_class, default_cfg); end - # pkg:gem/rubocop#lib/rubocop/formatter/disabled_config_formatter.rb:181 + # pkg:gem/rubocop#lib/rubocop/formatter/disabled_config_formatter.rb:188 def supports_unsafe_autocorrect?(cop_class, default_cfg); end - # pkg:gem/rubocop#lib/rubocop/formatter/disabled_config_formatter.rb:109 + # pkg:gem/rubocop#lib/rubocop/formatter/disabled_config_formatter.rb:116 def timestamp; end class << self @@ -61931,130 +62429,130 @@ class RuboCop::Runner private - # pkg:gem/rubocop#lib/rubocop/runner.rb:267 + # pkg:gem/rubocop#lib/rubocop/runner.rb:269 def add_redundant_disables(file, offenses, source); end - # pkg:gem/rubocop#lib/rubocop/runner.rb:241 + # pkg:gem/rubocop#lib/rubocop/runner.rb:243 def cached_result(file, team); end - # pkg:gem/rubocop#lib/rubocop/runner.rb:322 + # pkg:gem/rubocop#lib/rubocop/runner.rb:324 def cached_run?; end # Check whether a run created source identical to a previous run, which # means that we definitely have an infinite loop. # - # pkg:gem/rubocop#lib/rubocop/runner.rb:398 + # pkg:gem/rubocop#lib/rubocop/runner.rb:400 def check_for_infinite_loop(processed_source, offenses_by_iteration); end - # pkg:gem/rubocop#lib/rubocop/runner.rb:293 + # pkg:gem/rubocop#lib/rubocop/runner.rb:295 def check_for_redundant_disables?(source); end - # pkg:gem/rubocop#lib/rubocop/runner.rb:501 + # pkg:gem/rubocop#lib/rubocop/runner.rb:503 def considered_failure?(offense); end - # pkg:gem/rubocop#lib/rubocop/runner.rb:538 + # pkg:gem/rubocop#lib/rubocop/runner.rb:540 def default_config(cop_name); end - # pkg:gem/rubocop#lib/rubocop/runner.rb:340 + # pkg:gem/rubocop#lib/rubocop/runner.rb:342 def do_inspection_loop(file); end - # pkg:gem/rubocop#lib/rubocop/runner.rb:307 + # pkg:gem/rubocop#lib/rubocop/runner.rb:309 def except_redundant_cop_disable_directive?; end - # pkg:gem/rubocop#lib/rubocop/runner.rb:420 + # pkg:gem/rubocop#lib/rubocop/runner.rb:422 def extract_ruby_sources(processed_source); end - # pkg:gem/rubocop#lib/rubocop/runner.rb:316 + # pkg:gem/rubocop#lib/rubocop/runner.rb:318 def file_finished(file, offenses); end - # pkg:gem/rubocop#lib/rubocop/runner.rb:138 + # pkg:gem/rubocop#lib/rubocop/runner.rb:137 def file_iterator(files, &block); end - # pkg:gem/rubocop#lib/rubocop/runner.rb:245 + # pkg:gem/rubocop#lib/rubocop/runner.rb:247 def file_offense_cache(file); end - # pkg:gem/rubocop#lib/rubocop/runner.rb:233 + # pkg:gem/rubocop#lib/rubocop/runner.rb:235 def file_offenses(file); end - # pkg:gem/rubocop#lib/rubocop/runner.rb:311 + # pkg:gem/rubocop#lib/rubocop/runner.rb:313 def file_started(file); end - # pkg:gem/rubocop#lib/rubocop/runner.rb:481 + # pkg:gem/rubocop#lib/rubocop/runner.rb:483 def filter_cop_classes(cop_classes, config); end # pkg:gem/rubocop#lib/rubocop/runner.rb:96 def find_target_files(paths); end - # pkg:gem/rubocop#lib/rubocop/runner.rb:158 + # pkg:gem/rubocop#lib/rubocop/runner.rb:157 def finished_report(file, index, offenses); end - # pkg:gem/rubocop#lib/rubocop/runner.rb:492 + # pkg:gem/rubocop#lib/rubocop/runner.rb:494 def formatter_set; end - # pkg:gem/rubocop#lib/rubocop/runner.rb:553 + # pkg:gem/rubocop#lib/rubocop/runner.rb:555 def get_processed_source(file, prism_result); end - # pkg:gem/rubocop#lib/rubocop/runner.rb:412 + # pkg:gem/rubocop#lib/rubocop/runner.rb:414 def inspect_file(processed_source, team = T.unsafe(nil)); end # pkg:gem/rubocop#lib/rubocop/runner.rb:118 def inspect_files(files); end - # pkg:gem/rubocop#lib/rubocop/runner.rb:373 + # pkg:gem/rubocop#lib/rubocop/runner.rb:375 def iterate_until_no_changes(source, offenses_by_iteration); end - # pkg:gem/rubocop#lib/rubocop/runner.rb:219 + # pkg:gem/rubocop#lib/rubocop/runner.rb:221 def list_files(paths); end - # pkg:gem/rubocop#lib/rubocop/runner.rb:534 + # pkg:gem/rubocop#lib/rubocop/runner.rb:536 def mark_as_safe_by_config?(config); end - # pkg:gem/rubocop#lib/rubocop/runner.rb:542 + # pkg:gem/rubocop#lib/rubocop/runner.rb:544 def minimum_severity_to_fail; end - # pkg:gem/rubocop#lib/rubocop/runner.rb:434 + # pkg:gem/rubocop#lib/rubocop/runner.rb:436 def mobilize_team(processed_source); end - # pkg:gem/rubocop#lib/rubocop/runner.rb:447 + # pkg:gem/rubocop#lib/rubocop/runner.rb:449 def mobilized_cop_classes(config); end - # pkg:gem/rubocop#lib/rubocop/runner.rb:510 + # pkg:gem/rubocop#lib/rubocop/runner.rb:512 def offense_displayed?(offense); end - # pkg:gem/rubocop#lib/rubocop/runner.rb:522 + # pkg:gem/rubocop#lib/rubocop/runner.rb:524 def offenses_to_report(offenses); end - # pkg:gem/rubocop#lib/rubocop/runner.rb:205 + # pkg:gem/rubocop#lib/rubocop/runner.rb:204 def parallel_file_iterator(files, on_start, on_finish, &block); end - # pkg:gem/rubocop#lib/rubocop/runner.rb:223 + # pkg:gem/rubocop#lib/rubocop/runner.rb:225 def process_file(file); end - # pkg:gem/rubocop#lib/rubocop/runner.rb:172 + # pkg:gem/rubocop#lib/rubocop/runner.rb:171 def process_remaining_report_queue; end - # pkg:gem/rubocop#lib/rubocop/runner.rb:167 + # pkg:gem/rubocop#lib/rubocop/runner.rb:166 def process_report_queue_entry(index); end - # pkg:gem/rubocop#lib/rubocop/runner.rb:194 + # pkg:gem/rubocop#lib/rubocop/runner.rb:193 def project_index_disables_parallel?; end # pkg:gem/rubocop#lib/rubocop/runner.rb:107 def project_index_enabled?; end - # pkg:gem/rubocop#lib/rubocop/runner.rb:471 + # pkg:gem/rubocop#lib/rubocop/runner.rb:473 def qualify_option_cop_names; end - # pkg:gem/rubocop#lib/rubocop/runner.rb:299 + # pkg:gem/rubocop#lib/rubocop/runner.rb:301 def redundant_cop_disable_directive(file); end - # pkg:gem/rubocop#lib/rubocop/runner.rb:178 + # pkg:gem/rubocop#lib/rubocop/runner.rb:177 def run_in_parallel?(files); end - # pkg:gem/rubocop#lib/rubocop/runner.rb:330 + # pkg:gem/rubocop#lib/rubocop/runner.rb:332 def save_in_cache(cache, offenses); end - # pkg:gem/rubocop#lib/rubocop/runner.rb:209 + # pkg:gem/rubocop#lib/rubocop/runner.rb:208 def serial_file_iterator(files, on_start, on_finish, &block); end # A Cop::Team instance is stateful and may change when inspecting. @@ -62062,16 +62560,16 @@ class RuboCop::Runner # otherwise dormant team that can be used for config- and option- # level caching in ResultCache. # - # pkg:gem/rubocop#lib/rubocop/runner.rb:585 + # pkg:gem/rubocop#lib/rubocop/runner.rb:587 def standby_team(config); end - # pkg:gem/rubocop#lib/rubocop/runner.rb:488 + # pkg:gem/rubocop#lib/rubocop/runner.rb:490 def style_guide_cops_only?(config); end - # pkg:gem/rubocop#lib/rubocop/runner.rb:526 + # pkg:gem/rubocop#lib/rubocop/runner.rb:528 def supports_safe_autocorrect?(offense); end - # pkg:gem/rubocop#lib/rubocop/runner.rb:282 + # pkg:gem/rubocop#lib/rubocop/runner.rb:284 def team_for_redundant_disables(file, offenses, source); end class << self diff --git a/sorbet/rbi/gems/rubydex@0.2.5.rbi b/sorbet/rbi/gems/rubydex@0.2.7.rbi similarity index 91% rename from sorbet/rbi/gems/rubydex@0.2.5.rbi rename to sorbet/rbi/gems/rubydex@0.2.7.rbi index e4e8b4b..52919b0 100644 --- a/sorbet/rbi/gems/rubydex@0.2.5.rbi +++ b/sorbet/rbi/gems/rubydex@0.2.7.rbi @@ -11,6 +11,11 @@ # pkg:gem/rubydex#lib/rubydex/version.rb:3 module Rubydex; end +# Raised when `MethodAliasDefinition#target` walks an alias chain that loops back on itself. +# +# pkg:gem/rubydex#lib/rubydex/errors.rb:7 +class Rubydex::AliasCycleError < ::Rubydex::Error; end + # pkg:gem/rubydex#lib/rubydex.rb:11 class Rubydex::AttrAccessorDefinition < ::Rubydex::Definition; end @@ -64,6 +69,11 @@ class Rubydex::Comment def string; end end +# Raised by `Graph#load_config` when the requested config file does not exist, cannot be read, or is malformed +# +# pkg:gem/rubydex#lib/rubydex/errors.rb:10 +class Rubydex::ConfigError < ::Rubydex::Error; end + # pkg:gem/rubydex#lib/rubydex.rb:11 class Rubydex::Constant < ::Rubydex::Declaration include ::Rubydex::Visibility @@ -223,23 +233,29 @@ end # A one based location intended for display purposes. This is what should be used when displaying a location to users, # like in CLIs # -# pkg:gem/rubydex#lib/rubydex/location.rb:70 +# pkg:gem/rubydex#lib/rubydex/location.rb:83 class Rubydex::DisplayLocation < ::Rubydex::Location # Normalize to zero-based for comparison with Location # - # pkg:gem/rubydex#lib/rubydex/location.rb:81 + # pkg:gem/rubydex#lib/rubydex/location.rb:105 sig { returns([String, Integer, Integer, Integer, Integer]) } def comparable_values; end # Returns itself # - # pkg:gem/rubydex#lib/rubydex/location.rb:74 + # pkg:gem/rubydex#lib/rubydex/location.rb:98 sig { returns(Rubydex::DisplayLocation) } def to_display; end - # pkg:gem/rubydex#lib/rubydex/location.rb:86 + # pkg:gem/rubydex#lib/rubydex/location.rb:110 sig { returns(String) } def to_s; end + + class << self + # pkg:gem/rubydex#lib/rubydex/location.rb:86 + sig { params(prism_location: Prism::Location, uri: String).returns(T.noreturn) } + def from_prism(prism_location, uri:); end + end end # pkg:gem/rubydex#lib/rubydex.rb:11 @@ -251,6 +267,10 @@ class Rubydex::Document sig { returns(T::Enumerable[Rubydex::Definition]) } def definitions; end + # pkg:gem/rubydex#lib/rubydex.rb:11 + sig { returns(T::Enumerable[Rubydex::MethodReference]) } + def method_references; end + # pkg:gem/rubydex#lib/rubydex.rb:11 sig { returns(String) } def uri; end @@ -263,7 +283,8 @@ class Rubydex::Document end end -class Rubydex::Error < StandardError; end +# pkg:gem/rubydex#lib/rubydex/errors.rb:4 +class Rubydex::Error < ::StandardError; end # Represents `extend SomeModule` # @@ -300,7 +321,7 @@ class Rubydex::GlobalVariableDefinition < ::Rubydex::Definition; end # # pkg:gem/rubydex#lib/rubydex.rb:11 class Rubydex::Graph - # pkg:gem/rubydex#lib/rubydex/graph.rb:26 + # pkg:gem/rubydex#lib/rubydex/graph.rb:11 sig { params(workspace_path: T.nilable(String)).void } def initialize(workspace_path: nil); end @@ -372,15 +393,18 @@ class Rubydex::Graph sig { params(uri: String, source: String, language_id: String).void } def index_source(uri, source, language_id); end - # Index all files and dependencies of the workspace that exists in `@workspace_path` + # Index all files and dependencies of the workspace that exists in `workspace_path` # - # pkg:gem/rubydex#lib/rubydex/graph.rb:34 + # pkg:gem/rubydex#lib/rubydex/graph.rb:17 sig { returns(T::Array[String]) } def index_workspace; end # pkg:gem/rubydex#lib/rubydex.rb:11 def keyword(_arg0); end + # pkg:gem/rubydex#lib/rubydex.rb:11 + def load_config(*_arg0); end + # pkg:gem/rubydex#lib/rubydex.rb:11 sig { returns(T::Enumerable[Rubydex::MethodReference]) } def method_references; end @@ -405,18 +429,17 @@ class Rubydex::Graph sig { params(query: String).returns(T::Enumerable[Rubydex::Declaration]) } def search(query); end - # pkg:gem/rubydex#lib/rubydex/graph.rb:23 + # pkg:gem/rubydex#lib/rubydex.rb:11 sig { returns(String) } def workspace_path; end - # pkg:gem/rubydex#lib/rubydex/graph.rb:23 + # pkg:gem/rubydex#lib/rubydex.rb:11 sig { params(workspace_path: String).returns(String) } def workspace_path=(workspace_path); end - # Returns all workspace paths that should be indexed, excluding directories that we don't need to descend into such - # as `.git`, `node_modules`. Also includes any top level Ruby files + # Returns all workspace paths that should be indexed # - # pkg:gem/rubydex#lib/rubydex/graph.rb:42 + # pkg:gem/rubydex#lib/rubydex/graph.rb:24 sig { returns(T::Array[String]) } def workspace_paths; end @@ -426,21 +449,18 @@ class Rubydex::Graph # to the list of paths. This method does not require `rbs` to be a part of the bundle. It searches for whatever # latest installation of `rbs` exists in the system and fails silently if we can't find one # - # pkg:gem/rubydex#lib/rubydex/graph.rb:89 + # pkg:gem/rubydex#lib/rubydex/graph.rb:70 sig { params(paths: T::Array[String]).void } def add_core_rbs_definition_paths(paths); end # Gathers the paths we have to index for all workspace dependencies # - # pkg:gem/rubydex#lib/rubydex/graph.rb:65 + # pkg:gem/rubydex#lib/rubydex/graph.rb:46 sig { params(paths: T::Array[String]).void } def add_workspace_dependency_paths(paths); end end # pkg:gem/rubydex#lib/rubydex/graph.rb:8 -Rubydex::Graph::IGNORED_DIRECTORIES = T.let(T.unsafe(nil), Array) - -# pkg:gem/rubydex#lib/rubydex/graph.rb:20 Rubydex::Graph::INDEXABLE_EXTENSIONS = T.let(T.unsafe(nil), Array) # Represents `include SomeModule` @@ -494,15 +514,15 @@ end class Rubydex::Location include ::Comparable - # pkg:gem/rubydex#lib/rubydex/location.rb:18 + # pkg:gem/rubydex#lib/rubydex/location.rb:31 sig { params(uri: String, start_line: Integer, end_line: Integer, start_column: Integer, end_column: Integer).void } def initialize(uri:, start_line:, end_line:, start_column:, end_column:); end - # pkg:gem/rubydex#lib/rubydex/location.rb:38 + # pkg:gem/rubydex#lib/rubydex/location.rb:51 sig { params(other: T.untyped).returns(T.nilable(Integer)) } def <=>(other); end - # pkg:gem/rubydex#lib/rubydex/location.rb:45 + # pkg:gem/rubydex#lib/rubydex/location.rb:58 sig { returns([String, Integer, Integer, Integer, Integer]) } def comparable_values; end @@ -524,21 +544,27 @@ class Rubydex::Location # Turns this zero based location into a one based location for display purposes. # - # pkg:gem/rubydex#lib/rubydex/location.rb:52 + # pkg:gem/rubydex#lib/rubydex/location.rb:65 sig { returns(Rubydex::DisplayLocation) } def to_display; end - # pkg:gem/rubydex#lib/rubydex/location.rb:27 + # pkg:gem/rubydex#lib/rubydex/location.rb:40 sig { returns(String) } def to_file_path; end - # pkg:gem/rubydex#lib/rubydex/location.rb:63 + # pkg:gem/rubydex#lib/rubydex/location.rb:76 sig { returns(String) } def to_s; end # pkg:gem/rubydex#lib/rubydex/location.rb:12 sig { returns(String) } def uri; end + + class << self + # pkg:gem/rubydex#lib/rubydex/location.rb:19 + sig { params(prism_location: Prism::Location, uri: String).returns(Rubydex::Location) } + def from_prism(prism_location, uri:); end + end end # pkg:gem/rubydex#lib/rubydex/location.rb:7 @@ -560,6 +586,10 @@ end class Rubydex::MethodAliasDefinition < ::Rubydex::Definition # pkg:gem/rubydex#lib/rubydex.rb:11 def signatures; end + + # pkg:gem/rubydex#lib/rubydex.rb:11 + sig { returns(T.nilable(Rubydex::Method)) } + def target; end end # pkg:gem/rubydex#lib/rubydex.rb:11 diff --git a/sorbet/rbi/gems/smart_todo@1.11.0.rbi b/sorbet/rbi/gems/smart_todo@1.11.0.rbi new file mode 100644 index 0000000..61e97b6 --- /dev/null +++ b/sorbet/rbi/gems/smart_todo@1.11.0.rbi @@ -0,0 +1,645 @@ +# typed: true + +# DO NOT EDIT MANUALLY +# This is an autogenerated file for types exported from the `smart_todo` gem. +# Please instead update this file by running `bin/tapioca gem smart_todo`. + + +# pkg:gem/smart_todo#lib/smart_todo_cop.rb:6 +module RuboCop; end + +# pkg:gem/smart_todo#lib/smart_todo_cop.rb:7 +module RuboCop::Cop; end + +# pkg:gem/smart_todo#lib/smart_todo_cop.rb:8 +module RuboCop::Cop::SmartTodo; end + +# A RuboCop used to restrict the usage of regular TODO comments in code. +# This Cop does not run by default. It should be added to the RuboCop host's configuration file. +# +# @see https://rubocop.readthedocs.io/en/latest/extensions/#loading-extensions +# +# pkg:gem/smart_todo#lib/smart_todo_cop.rb:13 +class RuboCop::Cop::SmartTodo::SmartTodoCop < ::RuboCop::Cop::Base + # @param processed_source [RuboCop::ProcessedSource] + # @return [void] + # + # pkg:gem/smart_todo#lib/smart_todo_cop.rb:22 + def on_new_investigation; end + + private + + # @param assignees [Array] + # @return [Array] + # + # pkg:gem/smart_todo#lib/smart_todo_cop.rb:63 + def invalid_assignees(assignees); end + + # @param comment [String] + # @return [SmartTodo::Parser::Visitor] + # + # pkg:gem/smart_todo#lib/smart_todo_cop.rb:49 + def metadata(comment); end + + # @param metadata [SmartTodo::Parser::Visitor] + # @return [true, false] + # + # pkg:gem/smart_todo#lib/smart_todo_cop.rb:55 + def smart_todo?(metadata); end + + # @param args [Array] + # @return [String, nil] Returns error message if date is invalid, nil if valid + # + # pkg:gem/smart_todo#lib/smart_todo_cop.rb:86 + def validate_date_args(args); end + + # @param events [Array] + # @return [Array] + # + # pkg:gem/smart_todo#lib/smart_todo_cop.rb:69 + def validate_events(events); end + + # Helper method for validating fixed arity events + # + # pkg:gem/smart_todo#lib/smart_todo_cop.rb:129 + def validate_fixed_arity_args(args, expected_count, event_name, arg_names); end + + # Helper method for validating gem-related events + # + # pkg:gem/smart_todo#lib/smart_todo_cop.rb:140 + def validate_gem_args(args, event_name); end + + # @param args [Array] + # @return [String, nil] Returns error message if arguments are invalid, nil if valid + # + # pkg:gem/smart_todo#lib/smart_todo_cop.rb:114 + def validate_gem_bump_args(args); end + + # @param args [Array] + # @return [String, nil] Returns error message if arguments are invalid, nil if valid + # + # pkg:gem/smart_todo#lib/smart_todo_cop.rb:108 + def validate_gem_release_args(args); end + + # @param args [Array] + # @return [String, nil] Returns error message if arguments are invalid, nil if valid + # + # pkg:gem/smart_todo#lib/smart_todo_cop.rb:96 + def validate_issue_close_args(args); end + + # @param event_type [Symbol] + # @return [String] + # + # pkg:gem/smart_todo#lib/smart_todo_cop.rb:80 + def validate_method(event_type); end + + # @param args [Array] + # @return [String, nil] Returns error message if arguments are invalid, nil if valid + # + # pkg:gem/smart_todo#lib/smart_todo_cop.rb:102 + def validate_pull_request_close_args(args); end + + # @param args [Array] + # @return [String, nil] Returns error message if arguments are invalid, nil if valid + # + # pkg:gem/smart_todo#lib/smart_todo_cop.rb:120 + def validate_ruby_version_args(args); end +end + +# pkg:gem/smart_todo#lib/smart_todo_cop.rb:14 +RuboCop::Cop::SmartTodo::SmartTodoCop::HELP = T.let(T.unsafe(nil), String) + +# pkg:gem/smart_todo#lib/smart_todo_cop.rb:16 +RuboCop::Cop::SmartTodo::SmartTodoCop::INVESTIGATED_TAGS = T.let(T.unsafe(nil), Array) + +# pkg:gem/smart_todo#lib/smart_todo_cop.rb:15 +RuboCop::Cop::SmartTodo::SmartTodoCop::MSG = T.let(T.unsafe(nil), String) + +# pkg:gem/smart_todo#lib/smart_todo_cop.rb:18 +RuboCop::Cop::SmartTodo::SmartTodoCop::TODO_PATTERN = T.let(T.unsafe(nil), Regexp) + +# pkg:gem/smart_todo#lib/smart_todo/version.rb:3 +module SmartTodo; end + +# This class is the entrypoint of the SmartTodo library and is responsible +# to retrieve the command line options as well as iterating over each files/directories +# to run the +CommentParser+ on. +# +# pkg:gem/smart_todo#lib/smart_todo/cli.rb:10 +class SmartTodo::CLI + # pkg:gem/smart_todo#lib/smart_todo/cli.rb:11 + def initialize(dispatcher = T.unsafe(nil)); end + + # @return [OptionParser] an instance of OptionParser + # + # pkg:gem/smart_todo#lib/smart_todo/cli.rb:57 + def define_options; end + + # @return [Class] a Dispatchers::Base subclass + # + # pkg:gem/smart_todo#lib/smart_todo/cli.rb:76 + def dispatcher; end + + # @param path [String] a path to a file or directory + # @return [Array] all the directories the parser should run on + # + # pkg:gem/smart_todo#lib/smart_todo/cli.rb:82 + def normalize_path(path); end + + # pkg:gem/smart_todo#lib/smart_todo/cli.rb:90 + def process_todos(todos); end + + # @param args [Array] + # + # pkg:gem/smart_todo#lib/smart_todo/cli.rb:18 + def run(args = T.unsafe(nil)); end + + # @raise [ArgumentError] In case an option needed by a dispatcher wasn't provided. + # + # @return [void] + # + # pkg:gem/smart_todo#lib/smart_todo/cli.rb:52 + def validate_options!; end + + private + + # @param event_message [String] the original event message + # @param todo [Todo] the todo object that may contain context + # @param event [Event] the event that was met + # @param events [Events] the events instance for fetching issue context + # @return [String] the event message, potentially with context appended + # + # pkg:gem/smart_todo#lib/smart_todo/cli.rb:127 + def append_context_if_applicable(event_message, todo, event, events); end + + # pkg:gem/smart_todo#lib/smart_todo/cli.rb:143 + def process_dispatches(dispatches); end + + # @param todo [Todo] the todo object to check for context + # @param event [Event] the event to check + # @return [Boolean] true if context should be applied, false otherwise + # + # pkg:gem/smart_todo#lib/smart_todo/cli.rb:139 + def should_apply_context?(todo, event); end +end + +# pkg:gem/smart_todo#lib/smart_todo/comment_parser.rb:4 +class SmartTodo::CommentParser + # pkg:gem/smart_todo#lib/smart_todo/comment_parser.rb:10 + def initialize; end + + # pkg:gem/smart_todo#lib/smart_todo/comment_parser.rb:15 + def parse(source, filepath = T.unsafe(nil)); end + + # pkg:gem/smart_todo#lib/smart_todo/comment_parser.rb:19 + def parse_file(filepath); end + + # pkg:gem/smart_todo#lib/smart_todo/comment_parser.rb:8 + def todos; end + + private + + # pkg:gem/smart_todo#lib/smart_todo/comment_parser.rb:43 + def inline?(comment); end + + # pkg:gem/smart_todo#lib/smart_todo/comment_parser.rb:52 + def parse_comments(comments, filepath); end + + class << self + # pkg:gem/smart_todo#lib/smart_todo/comment_parser.rb:33 + def parse(source); end + end +end + +# pkg:gem/smart_todo#lib/smart_todo/comment_parser.rb:5 +SmartTodo::CommentParser::SUPPORTED_TAGS = T.let(T.unsafe(nil), Array) + +# pkg:gem/smart_todo#lib/smart_todo/comment_parser.rb:6 +SmartTodo::CommentParser::TAG_PATTERN = T.let(T.unsafe(nil), Regexp) + +# pkg:gem/smart_todo#lib/smart_todo.rb:14 +module SmartTodo::Dispatchers; end + +# pkg:gem/smart_todo#lib/smart_todo/dispatchers/base.rb:5 +class SmartTodo::Dispatchers::Base + # @param event_message [String] the success message associated + # a specific event + # @param todo_node [SmartTodo::Parser::TodoNode] + # @param file [String] the file containing the TODO + # @param options [Hash] + # + # pkg:gem/smart_todo#lib/smart_todo/dispatchers/base.rb:38 + def initialize(event_message, todo_node, file, options); end + + # This method gets called when a TODO reminder is expired and needs to be delivered. + # Dispatchers should implement this method to deliver the message where they need. + # + # @return void + # + # pkg:gem/smart_todo#lib/smart_todo/dispatchers/base.rb:50 + def dispatch; end + + private + + # Hello message for user actually existing in the organization + # + # pkg:gem/smart_todo#lib/smart_todo/dispatchers/base.rb:91 + def existing_user; end + + # pkg:gem/smart_todo#lib/smart_todo/dispatchers/base.rb:95 + def repo; end + + # Prepare the content of the message to send to the TODO assignee + # + # @param user [Hash] contain information about a user + # @param assignee [String] original string handle the slack message should be sent + # @return [String] + # + # pkg:gem/smart_todo#lib/smart_todo/dispatchers/base.rb:61 + def slack_message(user, assignee); end + + # Message in case a TODO's assignee doesn't exist in the Slack organization + # + # @param user [Hash] + # @return [String] + # + # pkg:gem/smart_todo#lib/smart_todo/dispatchers/base.rb:86 + def unexisting_user(assignee); end + + class << self + # Factory pattern to retrieve the right dispatcher class. + # + # @param dispatcher [String] + # + # @return [Class] + # + # pkg:gem/smart_todo#lib/smart_todo/dispatchers/base.rb:12 + def class_for(dispatcher); end + + # Subclasses should define what options from the CLI they need in order + # to properly deliver the message. For instance the Slack dispatcher + # requires an API key. + # + # @param _options [Hash] + # + # @return void + # + # pkg:gem/smart_todo#lib/smart_todo/dispatchers/base.rb:28 + def validate_options!(_options); end + end +end + +# A simple dispatcher that will output the reminder. +# +# pkg:gem/smart_todo#lib/smart_todo/dispatchers/output.rb:6 +class SmartTodo::Dispatchers::Output < ::SmartTodo::Dispatchers::Base + # @return void + # + # pkg:gem/smart_todo#lib/smart_todo/dispatchers/output.rb:12 + def dispatch; end + + class << self + # pkg:gem/smart_todo#lib/smart_todo/dispatchers/output.rb:8 + def validate_options!(_); end + end +end + +# Dispatcher that sends TODO reminders on Slack. Assignees can be either individual +# (using the associated slack email address) or a channel. +# +# pkg:gem/smart_todo#lib/smart_todo/dispatchers/slack.rb:7 +class SmartTodo::Dispatchers::Slack < ::SmartTodo::Dispatchers::Base + # Make a Slack API call to dispatch the message to each assignee + # + # @raise [SlackClient::Error] in case the Slack API returns an error + # other than `users_not_found` + # + # @return [Array] Slack response for each assignee a message was sent to + # + # pkg:gem/smart_todo#lib/smart_todo/dispatchers/slack.rb:23 + def dispatch; end + + # Make a Slack API call to dispatch the message to the user or channel + # + # @raise [SlackClient::Error] in case the Slack API returns an error + # other than `users_not_found` + # + # @param [String] the assignee handle string + # @return [Hash] the Slack response + # + # pkg:gem/smart_todo#lib/smart_todo/dispatchers/slack.rb:36 + def dispatch_one(assignee); end + + private + + # @return [SlackClient] an instance of SlackClient + # + # pkg:gem/smart_todo#lib/smart_todo/dispatchers/slack.rb:72 + def client; end + + # pkg:gem/smart_todo#lib/smart_todo/dispatchers/slack.rb:76 + def handle_slack_error(error, message); end + + # Returns a formatted hash containing either the user id of a slack user or + # the channel the message should be sent to. + # + # @return [Hash] a suited hash containing the user ID for a given individual or a slack channel + # + # pkg:gem/smart_todo#lib/smart_todo/dispatchers/slack.rb:58 + def slack_user_or_channel(assignee); end + + class << self + # pkg:gem/smart_todo#lib/smart_todo/dispatchers/slack.rb:9 + def validate_options!(options); end + end +end + +# This module contains all the methods accessible for SmartTodo comments. +# It is meant to be reopened by the host application in order to define +# its own events. +# +# An event needs to return a +String+ containing the message that will be +# sent to the TODO assignee or +false+ in case the event hasn't been met. +# +# @example Adding a custom event +# module SmartTodo +# class Events +# def trello_card_close(card) +# ... +# end +# end +# end +# +# TODO(on: trello_card_close(381), to: 'john@example.com') +# +# pkg:gem/smart_todo#lib/smart_todo/events.rb:28 +class SmartTodo::Events + # pkg:gem/smart_todo#lib/smart_todo/events.rb:29 + def initialize(now: T.unsafe(nil), spec_set: T.unsafe(nil), current_ruby_version: T.unsafe(nil)); end + + # Check if the +date+ is in the past + # + # @param on_date [String] a string parsable by Time.parse + # @return [false, String] + # + # pkg:gem/smart_todo#lib/smart_todo/events.rb:41 + def date(on_date); end + + # Check if +gem_name+ was bumped to the +requirements+ expected + # + # @example Expecting a specific version + # gem_bump('rails', '6.0') + # + # @example Expecting a version in the 5.x.x series + # gem_bump('rails', '> 5.2', '< 6') + # + # @param gem_name [String] + # @param requirements [Array] a list of version specifiers + # @return [false, String] + # + # pkg:gem/smart_todo#lib/smart_todo/events.rb:93 + def gem_bump(gem_name, *requirements); end + + # Check if a new version of +gem_name+ was released with the +requirements+ expected + # + # @example Expecting a specific version + # gem_release('rails', '6.0') + # + # @example Expecting a version in the 5.x.x series + # gem_release('rails', '> 5.2', '< 6') + # + # @param gem_name [String] + # @param requirements [Array] a list of version specifiers + # @return [false, String] + # + # pkg:gem/smart_todo#lib/smart_todo/events.rb:61 + def gem_release(gem_name, *requirements); end + + # Check if the issue +issue_number+ is closed + # + # @param organization [String] the GitHub organization name + # @param repo [String] the GitHub repo name + # @param issue_number [String, Integer] + # @return [false, String] + # + # pkg:gem/smart_todo#lib/smart_todo/events.rb:118 + def issue_close(organization, repo, issue_number); end + + # Retrieve context information for an issue + # This is used when a TODO has a context: issue() attribute + # + # @param organization [String] the GitHub organization name + # @param repo [String] the GitHub repo name + # @param issue_number [String, Integer] + # @return [String, nil] + # + # pkg:gem/smart_todo#lib/smart_todo/events.rb:173 + def issue_context(organization, repo, issue_number); end + + # Check if the pull request +pr_number+ is closed + # + # @param organization [String] the GitHub organization name + # @param repo [String] the GitHub repo name + # @param pr_number [String, Integer] + # @return [false, String] + # + # pkg:gem/smart_todo#lib/smart_todo/events.rb:145 + def pull_request_close(organization, repo, pr_number); end + + # Check if the installed ruby version meets requirements. + # + # @param requirements [Array] a list of version specifiers + # @return [false, String] + # + # pkg:gem/smart_todo#lib/smart_todo/events.rb:196 + def ruby_version(*requirements); end + + private + + # pkg:gem/smart_todo#lib/smart_todo/events.rb:250 + def current_ruby_version; end + + # @return [String, nil] + # + # pkg:gem/smart_todo#lib/smart_todo/events.rb:236 + def github_authorization_token(organization, repo); end + + # pkg:gem/smart_todo#lib/smart_todo/events.rb:220 + def github_client; end + + # pkg:gem/smart_todo#lib/smart_todo/events.rb:224 + def github_headers(organization, repo); end + + # pkg:gem/smart_todo#lib/smart_todo/events.rb:208 + def now; end + + # pkg:gem/smart_todo#lib/smart_todo/events.rb:216 + def rubygems_client; end + + # pkg:gem/smart_todo#lib/smart_todo/events.rb:212 + def spec_set; end +end + +# pkg:gem/smart_todo#lib/smart_todo/events.rb:233 +SmartTodo::Events::GITHUB_TOKEN = T.let(T.unsafe(nil), String) + +# @api private +# +# pkg:gem/smart_todo#lib/smart_todo/http_client_builder.rb:7 +class SmartTodo::HttpClientBuilder + class << self + # pkg:gem/smart_todo#lib/smart_todo/http_client_builder.rb:9 + def build(endpoint); end + end +end + +# A simple client around the Slack API. +# +# @example Sending a message to a user. +# SmartTodo::SlackClient.new.post_message('#general', 'Hello!') +# +# pkg:gem/smart_todo#lib/smart_todo/slack_client.rb:12 +class SmartTodo::SlackClient + # @param slack_token [String] + # + # pkg:gem/smart_todo#lib/smart_todo/slack_client.rb:27 + def initialize(slack_token); end + + # Retrieve the Slack ID of a user from his email + # + # @param email [String] + # @param min_sleep [Integer] - the minimum sleep time in seconds in case of rate limiting + # @return [Hash] + # + # @raise [Net::HTTPError] in case the request to Slack failed + # @raise [SlackClient::Error] in case Slack returns a { ok: false } in the body + # + # @see https://api.slack.com/methods/users.lookupByEmail + # + # pkg:gem/smart_todo#lib/smart_todo/slack_client.rb:42 + def lookup_user_by_email(email, min_sleep = T.unsafe(nil)); end + + # Send a message to a Slack channel or to a user + # + # @param channel [String] The Slack channel or the user ID + # @param text [String] The message to send + # @return [Hash] + # + # @raise [Net::HTTPError] in case the request to Slack failed + # @raise [SlackClient::Error] in case Slack returns a { ok: false } in the body + # + # @see https://api.slack.com/methods/chat.postMessage + # + # pkg:gem/smart_todo#lib/smart_todo/slack_client.rb:58 + def post_message(channel, text); end + + private + + # The default headers required by Slack + # + # @return [Hash] + # + # pkg:gem/smart_todo#lib/smart_todo/slack_client.rb:102 + def default_headers; end + + # @param request [Net::HTTPRequest] + # @param max_attempts [Integer] - the maximum number of attempts to make + # @param min_sleep [Integer] - the minimum sleep time in seconds in case of rate limiting + # + # @raise [Net::HTTPError] in case the request to Slack failed + # @raise [SlackClient::Error] in case Slack returns a { ok: false } in the body + # + # pkg:gem/smart_todo#lib/smart_todo/slack_client.rb:73 + def dispatch(request, max_attempts = T.unsafe(nil), min_sleep = T.unsafe(nil)); end +end + +# A generic error class raised when the Slack API returns back a 200 +# but there was a problem (permission issues ...) +# +# pkg:gem/smart_todo#lib/smart_todo/slack_client.rb:15 +class SmartTodo::SlackClient::Error < ::StandardError + # @param response_body [Hash] the parsed response body from Slack + # + # pkg:gem/smart_todo#lib/smart_todo/slack_client.rb:19 + def initialize(response_body); end + + # pkg:gem/smart_todo#lib/smart_todo/slack_client.rb:16 + def error_code; end +end + +# pkg:gem/smart_todo#lib/smart_todo/todo.rb:4 +class SmartTodo::Todo + # pkg:gem/smart_todo#lib/smart_todo/todo.rb:9 + def initialize(source, filepath = T.unsafe(nil)); end + + # pkg:gem/smart_todo#lib/smart_todo/todo.rb:22 + def <<(source); end + + # pkg:gem/smart_todo#lib/smart_todo/todo.rb:6 + def assignees; end + + # pkg:gem/smart_todo#lib/smart_todo/todo.rb:5 + def comment; end + + # pkg:gem/smart_todo#lib/smart_todo/todo.rb:7 + def context; end + + # pkg:gem/smart_todo#lib/smart_todo/todo.rb:7 + def context=(_arg0); end + + # pkg:gem/smart_todo#lib/smart_todo/todo.rb:6 + def errors; end + + # pkg:gem/smart_todo#lib/smart_todo/todo.rb:6 + def events; end + + # pkg:gem/smart_todo#lib/smart_todo/todo.rb:5 + def filepath; end + + # pkg:gem/smart_todo#lib/smart_todo/todo.rb:5 + def indent; end + + private + + # pkg:gem/smart_todo#lib/smart_todo/todo.rb:104 + def parse(source); end +end + +# pkg:gem/smart_todo#lib/smart_todo/todo.rb:26 +class SmartTodo::Todo::CallNode + # pkg:gem/smart_todo#lib/smart_todo/todo.rb:29 + def initialize(method_name, arguments, location); end + + # pkg:gem/smart_todo#lib/smart_todo/todo.rb:27 + def arguments; end + + # pkg:gem/smart_todo#lib/smart_todo/todo.rb:27 + def location; end + + # pkg:gem/smart_todo#lib/smart_todo/todo.rb:27 + def method_name; end +end + +# pkg:gem/smart_todo#lib/smart_todo/todo.rb:36 +class SmartTodo::Todo::Compiler < ::Prism::Compiler + # pkg:gem/smart_todo#lib/smart_todo/todo.rb:39 + def initialize(metadata); end + + # pkg:gem/smart_todo#lib/smart_todo/todo.rb:37 + def metadata; end + + # pkg:gem/smart_todo#lib/smart_todo/todo.rb:44 + def visit_call_node(node); end + + # pkg:gem/smart_todo#lib/smart_todo/todo.rb:48 + def visit_integer_node(node); end + + # pkg:gem/smart_todo#lib/smart_todo/todo.rb:52 + def visit_keyword_hash_node(node); end + + # pkg:gem/smart_todo#lib/smart_todo/todo.rb:97 + def visit_string_node(node); end +end + +# pkg:gem/smart_todo#lib/smart_todo/version.rb:4 +SmartTodo::VERSION = T.let(T.unsafe(nil), String) diff --git a/sorbet/rbi/gems/spoom@1.7.16.rbi b/sorbet/rbi/gems/spoom@1.8.2.rbi similarity index 88% rename from sorbet/rbi/gems/spoom@1.7.16.rbi rename to sorbet/rbi/gems/spoom@1.8.2.rbi index 459f92c..809a266 100644 --- a/sorbet/rbi/gems/spoom@1.7.16.rbi +++ b/sorbet/rbi/gems/spoom@1.8.2.rbi @@ -1878,8 +1878,17 @@ class Spoom::Deadcode::Plugins::ActiveModel < ::Spoom::Deadcode::Plugins::Base # pkg:gem/spoom#lib/spoom/deadcode/plugins/active_model.rb:13 sig { override.params(send: ::Spoom::Deadcode::Send).void } def on_send(send); end + + private + + # pkg:gem/spoom#lib/spoom/deadcode/plugins/active_model.rb:68 + sig { params(hash_node: ::Prism::HashNode, location: ::Spoom::Location).void } + def reference_nested_symbol_options(hash_node, location); end end +# pkg:gem/spoom#lib/spoom/deadcode/plugins/active_model.rb:51 +Spoom::Deadcode::Plugins::ActiveModel::NESTED_METHOD_REFERENCE_KEYS = T.let(T.unsafe(nil), Array) + # pkg:gem/spoom#lib/spoom/deadcode/plugins/active_record.rb:7 class Spoom::Deadcode::Plugins::ActiveRecord < ::Spoom::Deadcode::Plugins::Base # @override @@ -2053,57 +2062,58 @@ class Spoom::Deadcode::Plugins::Base # class MyPlugin < Spoom::Deadcode::Plugins::Base # def on_send(send) # return unless send.name == "dsl_method" - # return if send.args.empty? # - # method_name = send.args.first.slice.delete_prefix(":") - # @index.reference_method(method_name, send.node, send.loc) + # arg = send.args.first + # return unless arg.is_a?(Prism::SymbolNode) + # + # @index.reference_method(arg.unescaped, send.node, send.loc) # end # end # ~~~ # - # pkg:gem/spoom#lib/spoom/deadcode/plugins/base.rb:278 + # pkg:gem/spoom#lib/spoom/deadcode/plugins/base.rb:279 sig { params(send: ::Spoom::Deadcode::Send).void } def on_send(send); end private - # pkg:gem/spoom#lib/spoom/deadcode/plugins/base.rb:346 + # pkg:gem/spoom#lib/spoom/deadcode/plugins/base.rb:347 sig { params(name: ::String).returns(::String) } def camelize(name); end - # pkg:gem/spoom#lib/spoom/deadcode/plugins/base.rb:295 + # pkg:gem/spoom#lib/spoom/deadcode/plugins/base.rb:296 sig { params(name: T.nilable(::String)).returns(T::Boolean) } def ignored_class_name?(name); end - # pkg:gem/spoom#lib/spoom/deadcode/plugins/base.rb:314 + # pkg:gem/spoom#lib/spoom/deadcode/plugins/base.rb:315 sig { params(name: ::String).returns(T::Boolean) } def ignored_constant_name?(name); end - # pkg:gem/spoom#lib/spoom/deadcode/plugins/base.rb:319 + # pkg:gem/spoom#lib/spoom/deadcode/plugins/base.rb:320 sig { params(name: ::String).returns(T::Boolean) } def ignored_method_name?(name); end - # pkg:gem/spoom#lib/spoom/deadcode/plugins/base.rb:324 + # pkg:gem/spoom#lib/spoom/deadcode/plugins/base.rb:325 sig { params(name: ::String).returns(T::Boolean) } def ignored_module_name?(name); end - # pkg:gem/spoom#lib/spoom/deadcode/plugins/base.rb:329 + # pkg:gem/spoom#lib/spoom/deadcode/plugins/base.rb:330 sig { params(name: ::String, names_variable: ::Symbol, patterns_variable: ::Symbol).returns(T::Boolean) } def ignored_name?(name, names_variable, patterns_variable); end - # pkg:gem/spoom#lib/spoom/deadcode/plugins/base.rb:302 + # pkg:gem/spoom#lib/spoom/deadcode/plugins/base.rb:303 sig { params(definition: ::Spoom::Model::Class).returns(T::Boolean) } def ignored_subclass?(definition); end - # pkg:gem/spoom#lib/spoom/deadcode/plugins/base.rb:334 + # pkg:gem/spoom#lib/spoom/deadcode/plugins/base.rb:335 sig { params(const: ::Symbol).returns(T::Set[::String]) } def names(const); end - # pkg:gem/spoom#lib/spoom/deadcode/plugins/base.rb:339 + # pkg:gem/spoom#lib/spoom/deadcode/plugins/base.rb:340 sig { params(const: ::Symbol).returns(T::Array[::Regexp]) } def patterns(const); end - # pkg:gem/spoom#lib/spoom/deadcode/plugins/base.rb:287 + # pkg:gem/spoom#lib/spoom/deadcode/plugins/base.rb:288 sig { params(definition: ::Spoom::Model::Namespace, superclass_name: ::String).returns(T::Boolean) } def subclass_of?(definition, superclass_name); end @@ -2216,11 +2226,31 @@ end class Spoom::Deadcode::Plugins::GraphQL < ::Spoom::Deadcode::Plugins::Base # @override # - # pkg:gem/spoom#lib/spoom/deadcode/plugins/graphql.rb:27 + # pkg:gem/spoom#lib/spoom/deadcode/plugins/graphql.rb:30 sig { override.params(send: ::Spoom::Deadcode::Send).void } def on_send(send); end + + private + + # pkg:gem/spoom#lib/spoom/deadcode/plugins/graphql.rb:62 + sig { params(send: ::Spoom::Deadcode::Send).void } + def on_argument(send); end + + # pkg:gem/spoom#lib/spoom/deadcode/plugins/graphql.rb:73 + sig { params(send: ::Spoom::Deadcode::Send).void } + def on_builds(send); end + + # pkg:gem/spoom#lib/spoom/deadcode/plugins/graphql.rb:46 + sig { params(send: ::Spoom::Deadcode::Send).void } + def on_field(send); end end +# pkg:gem/spoom#lib/spoom/deadcode/plugins/graphql.rb:26 +Spoom::Deadcode::Plugins::GraphQL::ARGUMENT_SYMBOL_OPTION_KEYS = T.let(T.unsafe(nil), Array) + +# pkg:gem/spoom#lib/spoom/deadcode/plugins/graphql.rb:25 +Spoom::Deadcode::Plugins::GraphQL::FIELD_SYMBOL_OPTION_KEYS = T.let(T.unsafe(nil), Array) + # pkg:gem/spoom#lib/spoom/deadcode/plugins/minitest.rb:7 class Spoom::Deadcode::Plugins::Minitest < ::Spoom::Deadcode::Plugins::Base # @override @@ -2365,9 +2395,9 @@ end # pkg:gem/spoom#lib/spoom/deadcode/remover.rb:7 class Spoom::Deadcode::Remover::Error < ::Spoom::Error; end -# pkg:gem/spoom#lib/spoom/deadcode/remover.rb:366 +# pkg:gem/spoom#lib/spoom/deadcode/remover.rb:409 class Spoom::Deadcode::Remover::NodeContext - # pkg:gem/spoom#lib/spoom/deadcode/remover.rb:377 + # pkg:gem/spoom#lib/spoom/deadcode/remover.rb:420 sig do params( source: ::String, @@ -2378,96 +2408,96 @@ class Spoom::Deadcode::Remover::NodeContext end def initialize(source, comments, node, nesting); end - # pkg:gem/spoom#lib/spoom/deadcode/remover.rb:491 + # pkg:gem/spoom#lib/spoom/deadcode/remover.rb:534 sig { params(node: ::Prism::Node).returns(T::Array[::Prism::Comment]) } def attached_comments(node); end - # pkg:gem/spoom#lib/spoom/deadcode/remover.rb:519 + # pkg:gem/spoom#lib/spoom/deadcode/remover.rb:562 sig { returns(T.nilable(::Prism::CallNode)) } def attached_sig; end - # pkg:gem/spoom#lib/spoom/deadcode/remover.rb:506 + # pkg:gem/spoom#lib/spoom/deadcode/remover.rb:549 sig { returns(T::Array[::Prism::Node]) } def attached_sigs; end - # pkg:gem/spoom#lib/spoom/deadcode/remover.rb:368 + # pkg:gem/spoom#lib/spoom/deadcode/remover.rb:411 sig { returns(T::Hash[::Integer, ::Prism::Comment]) } def comments; end - # pkg:gem/spoom#lib/spoom/deadcode/remover.rb:479 + # pkg:gem/spoom#lib/spoom/deadcode/remover.rb:522 sig { params(start_line: ::Integer, end_line: ::Integer).returns(T::Array[::Prism::Comment]) } def comments_between_lines(start_line, end_line); end - # pkg:gem/spoom#lib/spoom/deadcode/remover.rb:374 + # pkg:gem/spoom#lib/spoom/deadcode/remover.rb:417 sig { returns(T::Array[::Prism::Node]) } def nesting; end - # pkg:gem/spoom#lib/spoom/deadcode/remover.rb:374 + # pkg:gem/spoom#lib/spoom/deadcode/remover.rb:417 def nesting=(_arg0); end - # pkg:gem/spoom#lib/spoom/deadcode/remover.rb:429 + # pkg:gem/spoom#lib/spoom/deadcode/remover.rb:472 sig { returns(T.nilable(::Prism::Node)) } def next_node; end - # pkg:gem/spoom#lib/spoom/deadcode/remover.rb:418 + # pkg:gem/spoom#lib/spoom/deadcode/remover.rb:461 sig { returns(T::Array[::Prism::Node]) } def next_nodes; end - # pkg:gem/spoom#lib/spoom/deadcode/remover.rb:371 + # pkg:gem/spoom#lib/spoom/deadcode/remover.rb:414 sig { returns(::Prism::Node) } def node; end - # pkg:gem/spoom#lib/spoom/deadcode/remover.rb:393 + # pkg:gem/spoom#lib/spoom/deadcode/remover.rb:436 sig { returns(::Spoom::Deadcode::Remover::NodeContext) } def parent_context; end - # pkg:gem/spoom#lib/spoom/deadcode/remover.rb:385 + # pkg:gem/spoom#lib/spoom/deadcode/remover.rb:428 sig { returns(::Prism::Node) } def parent_node; end - # pkg:gem/spoom#lib/spoom/deadcode/remover.rb:413 + # pkg:gem/spoom#lib/spoom/deadcode/remover.rb:456 sig { returns(T.nilable(::Prism::Node)) } def previous_node; end - # pkg:gem/spoom#lib/spoom/deadcode/remover.rb:402 + # pkg:gem/spoom#lib/spoom/deadcode/remover.rb:445 sig { returns(T::Array[::Prism::Node]) } def previous_nodes; end - # pkg:gem/spoom#lib/spoom/deadcode/remover.rb:434 + # pkg:gem/spoom#lib/spoom/deadcode/remover.rb:477 sig { returns(T.nilable(::Spoom::Deadcode::Remover::NodeContext)) } def sclass_context; end - # pkg:gem/spoom#lib/spoom/deadcode/remover.rb:467 + # pkg:gem/spoom#lib/spoom/deadcode/remover.rb:510 sig { params(node: T.nilable(::Prism::Node)).returns(T::Boolean) } def sorbet_extend_sig?(node); end - # pkg:gem/spoom#lib/spoom/deadcode/remover.rb:462 + # pkg:gem/spoom#lib/spoom/deadcode/remover.rb:505 sig { params(node: T.nilable(::Prism::Node)).returns(T::Boolean) } def sorbet_signature?(node); end end -# pkg:gem/spoom#lib/spoom/deadcode/remover.rb:534 +# pkg:gem/spoom#lib/spoom/deadcode/remover.rb:577 class Spoom::Deadcode::Remover::NodeFinder < ::Spoom::Visitor - # pkg:gem/spoom#lib/spoom/deadcode/remover.rb:599 + # pkg:gem/spoom#lib/spoom/deadcode/remover.rb:642 sig { params(location: ::Spoom::Location, kind: T.nilable(::Spoom::Deadcode::Definition::Kind)).void } def initialize(location, kind); end - # pkg:gem/spoom#lib/spoom/deadcode/remover.rb:593 + # pkg:gem/spoom#lib/spoom/deadcode/remover.rb:636 sig { returns(T.nilable(::Prism::Node)) } def node; end - # pkg:gem/spoom#lib/spoom/deadcode/remover.rb:596 + # pkg:gem/spoom#lib/spoom/deadcode/remover.rb:639 sig { returns(T::Array[::Prism::Node]) } def nodes_nesting; end # @override # - # pkg:gem/spoom#lib/spoom/deadcode/remover.rb:609 + # pkg:gem/spoom#lib/spoom/deadcode/remover.rb:652 sig { override.params(node: T.nilable(::Prism::Node)).void } def visit(node); end class << self - # pkg:gem/spoom#lib/spoom/deadcode/remover.rb:537 + # pkg:gem/spoom#lib/spoom/deadcode/remover.rb:580 sig do params( source: ::String, @@ -2477,7 +2507,7 @@ class Spoom::Deadcode::Remover::NodeFinder < ::Spoom::Visitor end def find(source, location, kind); end - # pkg:gem/spoom#lib/spoom/deadcode/remover.rb:568 + # pkg:gem/spoom#lib/spoom/deadcode/remover.rb:611 sig { params(node: ::Prism::Node, kind: ::Spoom::Deadcode::Definition::Kind).returns(T::Boolean) } def node_match_kind?(node, kind); end end @@ -2505,27 +2535,27 @@ class Spoom::Deadcode::Remover::NodeRemover private - # pkg:gem/spoom#lib/spoom/deadcode/remover.rb:151 + # pkg:gem/spoom#lib/spoom/deadcode/remover.rb:194 sig { params(context: ::Spoom::Deadcode::Remover::NodeContext).void } def delete_attr_accessor(context); end - # pkg:gem/spoom#lib/spoom/deadcode/remover.rb:325 + # pkg:gem/spoom#lib/spoom/deadcode/remover.rb:368 sig { params(start_char: ::Integer, end_char: ::Integer).void } def delete_chars(start_char, end_char); end - # pkg:gem/spoom#lib/spoom/deadcode/remover.rb:69 + # pkg:gem/spoom#lib/spoom/deadcode/remover.rb:112 sig { params(context: ::Spoom::Deadcode::Remover::NodeContext).void } def delete_constant_assignment(context); end - # pkg:gem/spoom#lib/spoom/deadcode/remover.rb:318 + # pkg:gem/spoom#lib/spoom/deadcode/remover.rb:361 sig { params(start_line: ::Integer, end_line: ::Integer).void } def delete_lines(start_line, end_line); end - # pkg:gem/spoom#lib/spoom/deadcode/remover.rb:255 + # pkg:gem/spoom#lib/spoom/deadcode/remover.rb:298 sig { params(context: ::Spoom::Deadcode::Remover::NodeContext).void } def delete_node_and_comments_and_sigs(context); end - # pkg:gem/spoom#lib/spoom/deadcode/remover.rb:212 + # pkg:gem/spoom#lib/spoom/deadcode/remover.rb:255 sig do params( node: ::Prism::Node, @@ -2535,11 +2565,25 @@ class Spoom::Deadcode::Remover::NodeRemover end def insert_accessor(node, send_context, was_removed:); end - # pkg:gem/spoom#lib/spoom/deadcode/remover.rb:330 + # When a method is defined as the argument of a modifier call (e.g. `private def foo; end` or + # `private_class_method def self.foo; end`), the `def` node's parent is the call rather than the + # enclosing class or module body, so its sigs and comments are siblings of the call. Return a + # context targeting the outermost such call so they are removed together with the method. + # + # Modifiers are matched structurally rather than from a fixed list, so user-defined ones are + # handled too. A call only counts as a modifier when the `def` is its sole argument and it takes + # no block and is a standalone statement, so we never remove a call that does more than wrap + # the method (e.g. `register(:thing, def foo; end)` or `FOO = register(def foo; end)`). + # + # pkg:gem/spoom#lib/spoom/deadcode/remover.rb:80 + sig { params(def_node: ::Prism::DefNode).returns(T.nilable(::Spoom::Deadcode::Remover::NodeContext)) } + def modifier_call_context(def_node); end + + # pkg:gem/spoom#lib/spoom/deadcode/remover.rb:373 sig { params(start_char: ::Integer, end_char: ::Integer, replacement: ::String).void } def replace_chars(start_char, end_char, replacement); end - # pkg:gem/spoom#lib/spoom/deadcode/remover.rb:335 + # pkg:gem/spoom#lib/spoom/deadcode/remover.rb:378 sig do params( node: ::Prism::CallNode, @@ -4182,11 +4226,20 @@ class Spoom::Printer def printt; end end +# pkg:gem/spoom#lib/spoom/ext/prism_types.rb:5 +module Spoom::PrismTypes; end + +Spoom::PrismTypes::AnyScopeNode = T.type_alias { T.any(::Prism::ClassNode, ::Prism::ModuleNode, ::Prism::SingletonClassNode) } + # pkg:gem/spoom#lib/spoom/rbs.rb:5 module Spoom::RBS; end # pkg:gem/spoom#lib/spoom/rbs.rb:71 -class Spoom::RBS::Annotation < ::Spoom::RBS::Comment; end +class Spoom::RBS::Annotation < ::Spoom::RBS::Comment + # pkg:gem/spoom#lib/spoom/rbs.rb:73 + sig { returns(T::Boolean) } + def abstract?; end +end # pkg:gem/spoom#lib/spoom/rbs.rb:57 class Spoom::RBS::Comment @@ -4230,17 +4283,34 @@ class Spoom::RBS::Comments def signatures; end end -# pkg:gem/spoom#lib/spoom/rbs.rb:75 +# pkg:gem/spoom#lib/spoom/rbs.rb:93 module Spoom::RBS::ExtractRBSComments - # pkg:gem/spoom#lib/spoom/rbs.rb:77 + # pkg:gem/spoom#lib/spoom/rbs.rb:95 sig { params(node: ::Prism::Node).returns(::Spoom::RBS::Comments) } def node_rbs_comments(node); end end -# pkg:gem/spoom#lib/spoom/rbs.rb:72 -class Spoom::RBS::Signature < ::Spoom::RBS::Comment; end +# pkg:gem/spoom#lib/spoom/rbs.rb:78 +class Spoom::RBS::Signature < ::Spoom::RBS::Comment + # pkg:gem/spoom#lib/spoom/rbs.rb:85 + sig do + params( + string: ::String, + location: ::Prism::Location, + continuation_locations: T::Array[::Prism::Location] + ).void + end + def initialize(string, location, continuation_locations: T.unsafe(nil)); end + + # Locations of the `#|` continuation comment lines that make up a multiline signature, + # in addition to the `#:` line tracked by `location`. + # + # pkg:gem/spoom#lib/spoom/rbs.rb:82 + sig { returns(T::Array[::Prism::Location]) } + def continuation_locations; end +end -# pkg:gem/spoom#lib/spoom/rbs.rb:73 +# pkg:gem/spoom#lib/spoom/rbs.rb:91 class Spoom::RBS::TypeAlias < ::Spoom::RBS::Comment; end # pkg:gem/spoom#lib/spoom.rb:8 @@ -4703,7 +4773,7 @@ module Spoom::Sorbet::Translate # Converts all the RBS comments in the given Ruby code to `sig` nodes. # It also handles type members and class annotations. # - # pkg:gem/spoom#lib/spoom/sorbet/translate.rb:57 + # pkg:gem/spoom#lib/spoom/sorbet/translate.rb:58 sig do params( ruby_contents: ::String, @@ -4717,7 +4787,7 @@ module Spoom::Sorbet::Translate # Converts all `T.let` and `T.cast` nodes to RBS comments in the given Ruby code. # It also handles type members and class annotations. # - # pkg:gem/spoom#lib/spoom/sorbet/translate.rb:77 + # pkg:gem/spoom#lib/spoom/sorbet/translate.rb:78 sig do params( ruby_contents: ::String, @@ -4734,7 +4804,7 @@ module Spoom::Sorbet::Translate # Converts all `sig` nodes to RBS comments in the given Ruby code. # It also handles type members and class annotations. # - # pkg:gem/spoom#lib/spoom/sorbet/translate.rb:37 + # pkg:gem/spoom#lib/spoom/sorbet/translate.rb:38 sig do params( ruby_contents: ::String, @@ -4751,69 +4821,155 @@ module Spoom::Sorbet::Translate # Deletes all `sig` nodes from the given Ruby code. # It doesn't handle type members and class annotations. # - # pkg:gem/spoom#lib/spoom/sorbet/translate.rb:22 + # pkg:gem/spoom#lib/spoom/sorbet/translate.rb:23 sig { params(ruby_contents: ::String, file: ::String).returns(::String) } def strip_sorbet_sigs(ruby_contents, file:); end end end -# pkg:gem/spoom#lib/spoom/sorbet/translate.rb:16 +# pkg:gem/spoom#lib/spoom/sorbet/translate.rb:17 class Spoom::Sorbet::Translate::Error < ::Spoom::Error; end +# Walks a Prism AST and records the locations of various bits of code +# whose locations we want to remain constant after a rewriter. +# +# pkg:gem/spoom#lib/spoom/sorbet/translate/validator.rb:144 +class Spoom::Sorbet::Translate::LandmarkFinder < ::Prism::Visitor + # pkg:gem/spoom#lib/spoom/sorbet/translate/validator.rb:158 + sig { void } + def initialize; end + + # pkg:gem/spoom#lib/spoom/sorbet/translate/validator.rb:146 + sig { returns(T::Hash[::String, T::Array[::Integer]]) } + def landmarks; end + + # @override + # + # pkg:gem/spoom#lib/spoom/sorbet/translate/validator.rb:165 + sig { override.params(node: ::Prism::ClassNode).void } + def visit_class_node(node); end + + # @override + # + # pkg:gem/spoom#lib/spoom/sorbet/translate/validator.rb:187 + sig { override.params(node: ::Prism::DefNode).void } + def visit_def_node(node); end + + # @override + # + # pkg:gem/spoom#lib/spoom/sorbet/translate/validator.rb:172 + sig { override.params(node: ::Prism::ModuleNode).void } + def visit_module_node(node); end + + # @override + # + # pkg:gem/spoom#lib/spoom/sorbet/translate/validator.rb:179 + sig { override.params(node: ::Prism::SingletonClassNode).void } + def visit_singleton_class_node(node); end + + # @override + # + # pkg:gem/spoom#lib/spoom/sorbet/translate/validator.rb:199 + sig { override.params(node: ::Prism::SourceLineNode).void } + def visit_source_line_node(node); end + + private + + # pkg:gem/spoom#lib/spoom/sorbet/translate/validator.rb:207 + sig { params(landmark_id: ::String, node: ::Prism::Node).void } + def record(landmark_id, node); end + + class << self + # pkg:gem/spoom#lib/spoom/sorbet/translate/validator.rb:150 + sig { params(source: ::String).returns(T::Hash[::String, T::Array[::Integer]]) } + def find_landmarks_in(source); end + end +end + # pkg:gem/spoom#lib/spoom/sorbet/translate/rbs_comments_to_sorbet_sigs.rb:7 -class Spoom::Sorbet::Translate::RBSCommentsToSorbetSigs < ::Spoom::Sorbet::Translate::Translator +module Spoom::Sorbet::Translate::RBSCommentsToSorbetSigs + class << self + # pkg:gem/spoom#lib/spoom/sorbet/translate/rbs_comments_to_sorbet_sigs.rb:23 + sig { params(source: ::String).returns(T::Boolean) } + def contains_rbs_syntax?(source); end + + # pkg:gem/spoom#lib/spoom/sorbet/translate/rbs_comments_to_sorbet_sigs.rb:32 + sig do + params( + ruby_contents: ::String, + file: ::String, + max_line_length: T.nilable(::Integer), + overloads_strategy: ::Symbol + ).returns(::String) + end + def rewrite_if_needed(ruby_contents, file:, max_line_length: T.unsafe(nil), overloads_strategy: T.unsafe(nil)); end + end +end + +# @abstract +# +# pkg:gem/spoom#lib/spoom/sorbet/translate/rbs_comments_to_sorbet_sigs/options.rb:9 +class Spoom::Sorbet::Translate::RBSCommentsToSorbetSigs::BaseRBIFormat + abstract! +end + +# @abstract +# +# pkg:gem/spoom#lib/spoom/sorbet/translate/rbs_comments_to_sorbet_sigs/base_translator.rb:9 +class Spoom::Sorbet::Translate::RBSCommentsToSorbetSigs::BaseTranslator < ::Spoom::Sorbet::Translate::Translator include ::Spoom::RBS::ExtractRBSComments - # pkg:gem/spoom#lib/spoom/sorbet/translate/rbs_comments_to_sorbet_sigs.rb:40 + abstract! + + # pkg:gem/spoom#lib/spoom/sorbet/translate/rbs_comments_to_sorbet_sigs/base_translator.rb:13 sig do params( ruby_contents: ::String, file: ::String, - max_line_length: T.nilable(::Integer), - overloads_strategy: ::Symbol + options: ::Spoom::Sorbet::Translate::RBSCommentsToSorbetSigs::Options ).void end - def initialize(ruby_contents, file:, max_line_length: T.unsafe(nil), overloads_strategy: T.unsafe(nil)); end + def initialize(ruby_contents, file:, options: T.unsafe(nil)); end # @override # - # pkg:gem/spoom#lib/spoom/sorbet/translate/rbs_comments_to_sorbet_sigs.rb:94 + # pkg:gem/spoom#lib/spoom/sorbet/translate/rbs_comments_to_sorbet_sigs/base_translator.rb:74 sig { override.params(node: ::Prism::CallNode).void } def visit_call_node(node); end # @override # - # pkg:gem/spoom#lib/spoom/sorbet/translate/rbs_comments_to_sorbet_sigs.rb:64 + # pkg:gem/spoom#lib/spoom/sorbet/translate/rbs_comments_to_sorbet_sigs/base_translator.rb:44 sig { override.params(node: ::Prism::ClassNode).void } def visit_class_node(node); end # @override # - # pkg:gem/spoom#lib/spoom/sorbet/translate/rbs_comments_to_sorbet_sigs.rb:88 + # pkg:gem/spoom#lib/spoom/sorbet/translate/rbs_comments_to_sorbet_sigs/base_translator.rb:68 sig { override.params(node: ::Prism::DefNode).void } def visit_def_node(node); end # @override # - # pkg:gem/spoom#lib/spoom/sorbet/translate/rbs_comments_to_sorbet_sigs.rb:72 + # pkg:gem/spoom#lib/spoom/sorbet/translate/rbs_comments_to_sorbet_sigs/base_translator.rb:52 sig { override.params(node: ::Prism::ModuleNode).void } def visit_module_node(node); end # @override # - # pkg:gem/spoom#lib/spoom/sorbet/translate/rbs_comments_to_sorbet_sigs.rb:54 + # pkg:gem/spoom#lib/spoom/sorbet/translate/rbs_comments_to_sorbet_sigs/base_translator.rb:34 sig { override.params(node: ::Prism::ProgramNode).void } def visit_program_node(node); end # @override # - # pkg:gem/spoom#lib/spoom/sorbet/translate/rbs_comments_to_sorbet_sigs.rb:80 + # pkg:gem/spoom#lib/spoom/sorbet/translate/rbs_comments_to_sorbet_sigs/base_translator.rb:60 sig { override.params(node: ::Prism::SingletonClassNode).void } def visit_singleton_class_node(node); end private - # pkg:gem/spoom#lib/spoom/sorbet/translate/rbs_comments_to_sorbet_sigs.rb:352 + # pkg:gem/spoom#lib/spoom/sorbet/translate/rbs_comments_to_sorbet_sigs/base_translator.rb:386 sig do params( node: T.any(::Prism::ClassNode, ::Prism::ModuleNode, ::Prism::SingletonClassNode), @@ -4822,15 +4978,36 @@ class Spoom::Sorbet::Translate::RBSCommentsToSorbetSigs < ::Spoom::Sorbet::Trans end def already_extends?(node, constant_regex); end - # pkg:gem/spoom#lib/spoom/sorbet/translate/rbs_comments_to_sorbet_sigs.rb:227 + # @param is_known: true if this is an RBS annotation that we recognize + # false for some other `@`-prefixed thing, like a documentation `@param` tag. + # @abstract + # + # pkg:gem/spoom#lib/spoom/sorbet/translate/rbs_comments_to_sorbet_sigs/base_translator.rb:320 + sig do + abstract + .params( + annotation: ::Spoom::RBS::Annotation, + parent_node: T.any(::Prism::ClassNode, ::Prism::ModuleNode, ::Prism::SingletonClassNode), + insert_pos: ::Integer, + sorbet_replacement: T.nilable(::String) + ).void + end + def apply_class_annotation(annotation, parent_node:, insert_pos:, sorbet_replacement:); end + + # pkg:gem/spoom#lib/spoom/sorbet/translate/rbs_comments_to_sorbet_sigs/base_translator.rb:220 sig { params(node: T.any(::Prism::ClassNode, ::Prism::ModuleNode, ::Prism::SingletonClassNode)).void } def apply_class_annotations(node); end - # pkg:gem/spoom#lib/spoom/sorbet/translate/rbs_comments_to_sorbet_sigs.rb:328 - sig { params(annotations: T::Array[::Spoom::RBS::Annotation], sig: ::RBI::Sig).void } + # pkg:gem/spoom#lib/spoom/sorbet/translate/rbs_comments_to_sorbet_sigs/base_translator.rb:333 + sig do + params( + annotations: T::Array[::Spoom::RBS::Annotation], + sig: ::RBI::Sig + ).returns(T::Array[::Spoom::RBS::Annotation]) + end def apply_member_annotations(annotations, sig); end - # pkg:gem/spoom#lib/spoom/sorbet/translate/rbs_comments_to_sorbet_sigs.rb:204 + # pkg:gem/spoom#lib/spoom/sorbet/translate/rbs_comments_to_sorbet_sigs/base_translator.rb:197 sig do params( signatures: T::Array[::Spoom::RBS::Signature], @@ -4840,48 +5017,259 @@ class Spoom::Sorbet::Translate::RBSCommentsToSorbetSigs < ::Spoom::Sorbet::Trans end def apply_overloads_strategy(signatures, method_name:, location:); end - # pkg:gem/spoom#lib/spoom/sorbet/translate/rbs_comments_to_sorbet_sigs.rb:404 + # pkg:gem/spoom#lib/spoom/sorbet/translate/rbs_comments_to_sorbet_sigs/base_translator.rb:438 sig { params(comments: T::Array[::Prism::Comment]).void } def apply_type_aliases(comments); end - # pkg:gem/spoom#lib/spoom/sorbet/translate/rbs_comments_to_sorbet_sigs.rb:368 + # pkg:gem/spoom#lib/spoom/sorbet/translate/rbs_comments_to_sorbet_sigs/base_translator.rb:402 sig { params(comments: T::Array[::Prism::Comment]).returns(T::Array[::Spoom::RBS::TypeAlias]) } def collect_type_aliases(comments); end - # pkg:gem/spoom#lib/spoom/sorbet/translate/rbs_comments_to_sorbet_sigs.rb:156 + # @abstract + # + # pkg:gem/spoom#lib/spoom/sorbet/translate/rbs_comments_to_sorbet_sigs/base_translator.rb:383 + sig do + abstract + .params( + mixin_name: ::String, + into: T.any(::Prism::ClassNode, ::Prism::ModuleNode, ::Prism::SingletonClassNode), + at: ::Integer + ).void + end + def extend_with(mixin_name, into:, at:); end + + # Inserts a single `type_member` declaration into the class/module body. + # @abstract + # + # pkg:gem/spoom#lib/spoom/sorbet/translate/rbs_comments_to_sorbet_sigs/base_translator.rb:330 + sig do + abstract + .params( + type_member: ::String, + parent_node: T.any(::Prism::ClassNode, ::Prism::ModuleNode, ::Prism::SingletonClassNode), + insert_pos: ::Integer + ).void + end + def insert_type_member(type_member, parent_node:, insert_pos:); end + + # @overridable + # + # pkg:gem/spoom#lib/spoom/sorbet/translate/rbs_comments_to_sorbet_sigs/base_translator.rb:476 + sig { overridable.params(of: ::String, to_height_of: ::Spoom::RBS::Comment).returns(::String) } + def pad_out_line_count(of:, to_height_of:); end + + # @param is_known: true if this is an RBS annotation that we recognize + # false for some other `@`-prefixed thing, like a documentation `@param` tag. + # @overridable + # + # pkg:gem/spoom#lib/spoom/sorbet/translate/rbs_comments_to_sorbet_sigs/base_translator.rb:379 + sig { overridable.params(annotation: ::Spoom::RBS::Annotation, is_known: T::Boolean).void } + def rewrite_annotation(annotation, is_known:); end + + # pkg:gem/spoom#lib/spoom/sorbet/translate/rbs_comments_to_sorbet_sigs/base_translator.rb:142 sig { params(def_node: ::Prism::DefNode, comments: ::Spoom::RBS::Comments).void } def rewrite_def(def_node, comments); end - # pkg:gem/spoom#lib/spoom/sorbet/translate/rbs_comments_to_sorbet_sigs.rb:112 + # Called for every overloaded method sig that we discard because it wasn't the last one. + # @abstract + # + # pkg:gem/spoom#lib/spoom/sorbet/translate/rbs_comments_to_sorbet_sigs/base_translator.rb:217 + sig { abstract.params(signature: ::Spoom::RBS::Signature).void } + def rewrite_discarded_overload(signature); end + + # Rewrites the member annotation comments in the source. Called once per method, + # regardless of how many overloaded signatures share the annotations, to avoid + # emitting duplicate markers. + # + # pkg:gem/spoom#lib/spoom/sorbet/translate/rbs_comments_to_sorbet_sigs/base_translator.rb:369 + sig { params(annotations: T::Array[::Spoom::RBS::Annotation], known: T::Array[::Spoom::RBS::Annotation]).void } + def rewrite_member_annotations(annotations, known:); end + + # Rewrites the `#: [...]` type params comment (e.g. delete it, or mark it as translated). + # @abstract + # + # pkg:gem/spoom#lib/spoom/sorbet/translate/rbs_comments_to_sorbet_sigs/base_translator.rb:325 + sig { abstract.params(signature: ::Spoom::RBS::Signature, type_params: T::Array[::RBS::AST::TypeParam]).void } + def rewrite_type_params_signature(signature, type_params:); end + + # pkg:gem/spoom#lib/spoom/sorbet/translate/rbs_comments_to_sorbet_sigs/base_translator.rb:92 sig { params(node: ::Prism::CallNode).void } def visit_attr(node); end +end + +# pkg:gem/spoom#lib/spoom/sorbet/translate/rbs_comments_to_sorbet_sigs/options.rb:12 +class Spoom::Sorbet::Translate::RBSCommentsToSorbetSigs::HumanReadableRBIFormat < ::Spoom::Sorbet::Translate::RBSCommentsToSorbetSigs::BaseRBIFormat + # pkg:gem/spoom#lib/spoom/sorbet/translate/rbs_comments_to_sorbet_sigs/options.rb:19 + sig { params(max_line_length: T.nilable(::Integer)).void } + def initialize(max_line_length: T.unsafe(nil)); end + + # pkg:gem/spoom#lib/spoom/sorbet/translate/rbs_comments_to_sorbet_sigs/options.rb:14 + sig { returns(T.nilable(::Integer)) } + def max_line_length; end class << self - # pkg:gem/spoom#lib/spoom/sorbet/translate/rbs_comments_to_sorbet_sigs.rb:27 - sig { params(source: ::String).returns(T::Boolean) } - def contains_rbs_syntax?(source); end + # pkg:gem/spoom#lib/spoom/sorbet/translate/rbs_comments_to_sorbet_sigs/options.rb:29 + sig { returns(::Spoom::Sorbet::Translate::RBSCommentsToSorbetSigs::HumanReadableRBIFormat) } + def default; end + end +end - # pkg:gem/spoom#lib/spoom/sorbet/translate/rbs_comments_to_sorbet_sigs.rb:32 - sig do - params( - ruby_contents: ::String, - file: ::String, - max_line_length: T.nilable(::Integer), - overloads_strategy: ::Symbol - ).returns(::String) - end - def rewrite_if_needed(ruby_contents, file:, max_line_length: T.unsafe(nil), overloads_strategy: T.unsafe(nil)); end +# pkg:gem/spoom#lib/spoom/sorbet/translate/rbs_comments_to_sorbet_sigs/human_readable_translator.rb:11 +class Spoom::Sorbet::Translate::RBSCommentsToSorbetSigs::HumanReadableTranslator < ::Spoom::Sorbet::Translate::RBSCommentsToSorbetSigs::BaseTranslator + private + + # @override + # + # pkg:gem/spoom#lib/spoom/sorbet/translate/rbs_comments_to_sorbet_sigs/human_readable_translator.rb:30 + sig do + override + .params( + annotation: ::Spoom::RBS::Annotation, + parent_node: T.any(::Prism::ClassNode, ::Prism::ModuleNode, ::Prism::SingletonClassNode), + insert_pos: ::Integer, + sorbet_replacement: T.nilable(::String) + ).void + end + def apply_class_annotation(annotation, parent_node:, insert_pos:, sorbet_replacement:); end + + # @override + # + # pkg:gem/spoom#lib/spoom/sorbet/translate/rbs_comments_to_sorbet_sigs/human_readable_translator.rb:61 + sig { override.params(mixin_name: ::String, into: ::Prism::Node, at: ::Integer).void } + def extend_with(mixin_name, into:, at:); end + + # @override + # + # pkg:gem/spoom#lib/spoom/sorbet/translate/rbs_comments_to_sorbet_sigs/human_readable_translator.rb:53 + sig do + override + .params( + type_member: ::String, + parent_node: T.any(::Prism::ClassNode, ::Prism::ModuleNode, ::Prism::SingletonClassNode), + insert_pos: ::Integer + ).void + end + def insert_type_member(type_member, parent_node:, insert_pos:); end + + # Deletes the discarded overload from the source codes + # @override + # + # pkg:gem/spoom#lib/spoom/sorbet/translate/rbs_comments_to_sorbet_sigs/human_readable_translator.rb:17 + sig { override.params(signature: ::Spoom::RBS::Signature).void } + def rewrite_discarded_overload(signature); end + + # @override + # + # pkg:gem/spoom#lib/spoom/sorbet/translate/rbs_comments_to_sorbet_sigs/human_readable_translator.rb:45 + sig { override.params(signature: ::Spoom::RBS::Signature, type_params: T::Array[::RBS::AST::TypeParam]).void } + def rewrite_type_params_signature(signature, type_params:); end +end + +# pkg:gem/spoom#lib/spoom/sorbet/translate/rbs_comments_to_sorbet_sigs/options.rb:33 +class Spoom::Sorbet::Translate::RBSCommentsToSorbetSigs::LineMatchedRBIFormat < ::Spoom::Sorbet::Translate::RBSCommentsToSorbetSigs::BaseRBIFormat + class << self + # pkg:gem/spoom#lib/spoom/sorbet/translate/rbs_comments_to_sorbet_sigs/options.rb:37 + sig { returns(::Spoom::Sorbet::Translate::RBSCommentsToSorbetSigs::LineMatchedRBIFormat) } + def default; end + end +end + +# pkg:gem/spoom#lib/spoom/sorbet/translate/rbs_comments_to_sorbet_sigs/line_matching_translator.rb:11 +class Spoom::Sorbet::Translate::RBSCommentsToSorbetSigs::LineMatchingTranslator < ::Spoom::Sorbet::Translate::RBSCommentsToSorbetSigs::BaseTranslator + private + + # @override + # + # pkg:gem/spoom#lib/spoom/sorbet/translate/rbs_comments_to_sorbet_sigs/line_matching_translator.rb:32 + sig do + override + .params( + annotation: ::Spoom::RBS::Annotation, + parent_node: T.any(::Prism::ClassNode, ::Prism::ModuleNode, ::Prism::SingletonClassNode), + insert_pos: ::Integer, + sorbet_replacement: T.nilable(::String) + ).void + end + def apply_class_annotation(annotation, parent_node:, insert_pos:, sorbet_replacement:); end + + # @override + # + # pkg:gem/spoom#lib/spoom/sorbet/translate/rbs_comments_to_sorbet_sigs/line_matching_translator.rb:85 + sig { override.params(mixin_name: ::String, into: ::Prism::Node, at: ::Integer).void } + def extend_with(mixin_name, into:, at:); end + + # @override + # + # pkg:gem/spoom#lib/spoom/sorbet/translate/rbs_comments_to_sorbet_sigs/line_matching_translator.rb:71 + sig do + override + .params( + type_member: ::String, + parent_node: T.any(::Prism::ClassNode, ::Prism::ModuleNode, ::Prism::SingletonClassNode), + insert_pos: ::Integer + ).void end + def insert_type_member(type_member, parent_node:, insert_pos:); end + + # @override + # + # pkg:gem/spoom#lib/spoom/sorbet/translate/rbs_comments_to_sorbet_sigs/line_matching_translator.rb:93 + sig { override.params(of: ::String, to_height_of: ::Spoom::RBS::Comment).returns(::String) } + def pad_out_line_count(of:, to_height_of:); end + + # @override + # + # pkg:gem/spoom#lib/spoom/sorbet/translate/rbs_comments_to_sorbet_sigs/line_matching_translator.rb:77 + sig { override.params(annotation: ::Spoom::RBS::Annotation, is_known: T::Boolean).void } + def rewrite_annotation(annotation, is_known:); end + + # Comments out the discarded overload + # @override + # + # pkg:gem/spoom#lib/spoom/sorbet/translate/rbs_comments_to_sorbet_sigs/line_matching_translator.rb:17 + sig { override.params(signature: ::Spoom::RBS::Signature).void } + def rewrite_discarded_overload(signature); end + + # @override + # + # pkg:gem/spoom#lib/spoom/sorbet/translate/rbs_comments_to_sorbet_sigs/line_matching_translator.rb:51 + sig { override.params(signature: ::Spoom::RBS::Signature, type_params: T::Array[::RBS::AST::TypeParam]).void } + def rewrite_type_params_signature(signature, type_params:); end end -# pkg:gem/spoom#lib/spoom/sorbet/translate/rbs_comments_to_sorbet_sigs.rb:23 -Spoom::Sorbet::Translate::RBSCommentsToSorbetSigs::ALLOWED_OVERLOAD_STRATEGIES = T.let(T.unsafe(nil), Array) +# pkg:gem/spoom#lib/spoom/sorbet/translate/rbs_comments_to_sorbet_sigs/options.rb:41 +class Spoom::Sorbet::Translate::RBSCommentsToSorbetSigs::Options + # pkg:gem/spoom#lib/spoom/sorbet/translate/rbs_comments_to_sorbet_sigs/options.rb:58 + sig do + params( + overloads_strategy: ::Symbol, + output_format: ::Spoom::Sorbet::Translate::RBSCommentsToSorbetSigs::BaseRBIFormat, + translate_abstract_methods: T::Boolean + ).void + end + def initialize(overloads_strategy: T.unsafe(nil), output_format: T.unsafe(nil), translate_abstract_methods: T.unsafe(nil)); end + + # pkg:gem/spoom#lib/spoom/sorbet/translate/rbs_comments_to_sorbet_sigs/options.rb:48 + sig { returns(::Spoom::Sorbet::Translate::RBSCommentsToSorbetSigs::BaseRBIFormat) } + def output_format; end + + # pkg:gem/spoom#lib/spoom/sorbet/translate/rbs_comments_to_sorbet_sigs/options.rb:43 + sig { returns(::Symbol) } + def overloads_strategy; end -# pkg:gem/spoom#lib/spoom/sorbet/translate/rbs_comments_to_sorbet_sigs.rb:10 -Spoom::Sorbet::Translate::RBSCommentsToSorbetSigs::RBS_ANNOTATION_MARKERS = T.let(T.unsafe(nil), Array) + # pkg:gem/spoom#lib/spoom/sorbet/translate/rbs_comments_to_sorbet_sigs/options.rb:51 + sig { returns(T::Boolean) } + def translate_abstract_methods; end + + class << self + # pkg:gem/spoom#lib/spoom/sorbet/translate/rbs_comments_to_sorbet_sigs/options.rb:78 + sig { returns(::Spoom::Sorbet::Translate::RBSCommentsToSorbetSigs::Options) } + def default; end + end +end -# pkg:gem/spoom#lib/spoom/sorbet/translate/rbs_comments_to_sorbet_sigs.rb:20 -Spoom::Sorbet::Translate::RBSCommentsToSorbetSigs::RBS_REWRITE_PATTERN = T.let(T.unsafe(nil), Regexp) +# pkg:gem/spoom#lib/spoom/sorbet/translate/rbs_comments_to_sorbet_sigs/options.rb:45 +Spoom::Sorbet::Translate::RBSCommentsToSorbetSigs::Options::ALLOWED_OVERLOAD_STRATEGIES = T.let(T.unsafe(nil), Array) # Translates Sorbet assertions to RBS comments. # @@ -4915,44 +5303,56 @@ class Spoom::Sorbet::Translate::SorbetAssertionsToRBSComments < ::Spoom::Sorbet: private - # pkg:gem/spoom#lib/spoom/sorbet/translate/sorbet_assertions_to_rbs_comments.rb:176 + # pkg:gem/spoom#lib/spoom/sorbet/translate/sorbet_assertions_to_rbs_comments.rb:178 sig { params(node: ::Prism::Node).returns(T::Boolean) } def at_end_of_line?(node); end - # pkg:gem/spoom#lib/spoom/sorbet/translate/sorbet_assertions_to_rbs_comments.rb:118 + # pkg:gem/spoom#lib/spoom/sorbet/translate/sorbet_assertions_to_rbs_comments.rb:120 sig { params(call: ::Prism::CallNode).returns(::String) } def build_rbs_annotation(call); end - # pkg:gem/spoom#lib/spoom/sorbet/translate/sorbet_assertions_to_rbs_comments.rb:216 + # pkg:gem/spoom#lib/spoom/sorbet/translate/sorbet_assertions_to_rbs_comments.rb:265 sig { params(assign: ::Prism::Node, value: ::Prism::Node).returns(::String) } def dedent_value(assign, value); end # Extract any trailing comment after the node # Returns [comment_text, comment_end_offset] or [nil, nil] if no comment or RBS annotation # - # pkg:gem/spoom#lib/spoom/sorbet/translate/sorbet_assertions_to_rbs_comments.rb:196 + # pkg:gem/spoom#lib/spoom/sorbet/translate/sorbet_assertions_to_rbs_comments.rb:198 sig { params(node: ::Prism::Node).returns([T.nilable(::String), T.nilable(::Integer)]) } def extract_trailing_comment(node); end # Check if the node has an RBS annotation comment (#:) after it # - # pkg:gem/spoom#lib/spoom/sorbet/translate/sorbet_assertions_to_rbs_comments.rb:185 + # pkg:gem/spoom#lib/spoom/sorbet/translate/sorbet_assertions_to_rbs_comments.rb:187 sig { params(node: ::Prism::Node).returns(T::Boolean) } def has_rbs_annotation?(node); end + # pkg:gem/spoom#lib/spoom/sorbet/translate/sorbet_assertions_to_rbs_comments.rb:218 + sig { params(node: ::Prism::Node, replace_end_offset: ::Integer).returns(T.nilable(::String)) } + def heredoc_body_within_range(node, replace_end_offset); end + + # pkg:gem/spoom#lib/spoom/sorbet/translate/sorbet_assertions_to_rbs_comments.rb:232 + sig { params(node: ::Prism::Node).returns(T::Array[::Integer]) } + def heredoc_end_offsets(node); end + # pkg:gem/spoom#lib/spoom/sorbet/translate/sorbet_assertions_to_rbs_comments.rb:71 sig { params(node: ::Prism::Node).returns(T::Boolean) } def maybe_translate_assertion(node); end + # pkg:gem/spoom#lib/spoom/sorbet/translate/sorbet_assertions_to_rbs_comments.rb:254 + sig { params(node: ::Prism::Node).returns(T::Boolean) } + def string_literal?(node); end + # Is this node a `T` or `::T` constant? # - # pkg:gem/spoom#lib/spoom/sorbet/translate/sorbet_assertions_to_rbs_comments.rb:143 + # pkg:gem/spoom#lib/spoom/sorbet/translate/sorbet_assertions_to_rbs_comments.rb:145 sig { params(node: T.nilable(::Prism::Node)).returns(T::Boolean) } def t?(node); end # Is this node a `T.let` or `T.cast`? # - # pkg:gem/spoom#lib/spoom/sorbet/translate/sorbet_assertions_to_rbs_comments.rb:156 + # pkg:gem/spoom#lib/spoom/sorbet/translate/sorbet_assertions_to_rbs_comments.rb:158 sig { params(node: ::Prism::CallNode).returns(T::Boolean) } def translatable_annotation?(node); end end @@ -5121,6 +5521,88 @@ class Spoom::Sorbet::Translate::Translator < ::Spoom::Visitor def sorbet_sig?(node); end end +# The outcome of comparing an original source with its rewritten form. +# +# pkg:gem/spoom#lib/spoom/sorbet/translate/validator.rb:63 +class Spoom::Sorbet::Translate::ValidationResult + # pkg:gem/spoom#lib/spoom/sorbet/translate/validator.rb:87 + sig do + params( + missing_from_rewritten_output: T::Array[{landmark_id: ::String, line: ::Integer}], + excess_in_rewritten_output: T::Array[{landmark_id: ::String, line: ::Integer}], + on_wrong_line: T::Array[{landmark_id: ::String, expected: T::Array[::Integer], actual: T::Array[::Integer]}] + ).void + end + def initialize(missing_from_rewritten_output:, excess_in_rewritten_output:, on_wrong_line:); end + + # Human-readable, one-per-line descriptions of every difference. Empty when + # the result is valid. + # + # pkg:gem/spoom#lib/spoom/sorbet/translate/validator.rb:104 + sig { returns(T::Array[::String]) } + def errors; end + + # Landmarks present in the rewrite with no match in the original. + # + # pkg:gem/spoom#lib/spoom/sorbet/translate/validator.rb:76 + sig { returns(T::Array[{landmark_id: ::String, line: ::Integer}]) } + def excess_in_rewritten_output; end + + # Landmarks present in the original but missing from the rewrite. + # + # pkg:gem/spoom#lib/spoom/sorbet/translate/validator.rb:72 + sig { returns(T::Array[{landmark_id: ::String, line: ::Integer}]) } + def missing_from_rewritten_output; end + + # Landmarks present in both sources, but that moved to a different line. + # + # pkg:gem/spoom#lib/spoom/sorbet/translate/validator.rb:80 + sig { returns(T::Array[{landmark_id: ::String, expected: T::Array[::Integer], actual: T::Array[::Integer]}]) } + def on_wrong_line; end + + # pkg:gem/spoom#lib/spoom/sorbet/translate/validator.rb:119 + sig { params(printer: T.untyped).void } + def pretty_print(printer); end + + # True when every landmark survived the rewrite on its original line. + # + # pkg:gem/spoom#lib/spoom/sorbet/translate/validator.rb:95 + sig { returns(T::Boolean) } + def valid?; end + + private + + # pkg:gem/spoom#lib/spoom/sorbet/translate/validator.rb:137 + sig { params(lines: T::Array[::Integer]).returns(::String) } + def format_lines(lines); end +end + +Spoom::Sorbet::Translate::ValidationResult::LandmarkLocation = T.type_alias { {landmark_id: ::String, line: ::Integer} } +Spoom::Sorbet::Translate::ValidationResult::MovedLandmark = T.type_alias { {landmark_id: ::String, expected: T::Array[::Integer], actual: T::Array[::Integer]} } + +# Checks that a translation preserved the lines of every "landmark" (e.g. classes, method defs, and so on) +# so line numbers in the rewritten output still line up with the original source. +# +# pkg:gem/spoom#lib/spoom/sorbet/translate/validator.rb:9 +module Spoom::Sorbet::Translate::Validator + class << self + # Compares the landmarks in both sources and returns a result describing + # what changed: + # missing_from_rewritten_output - dropped: an occurrence in the original + # that is gone from the rewrite + # excess_in_rewritten_output - added: an occurrence in the rewrite with + # no match in the original + # on_wrong_line - survived but moved to a different line + # + # pkg:gem/spoom#lib/spoom/sorbet/translate/validator.rb:25 + sig { params(original: ::String, rewritten: ::String).returns(::Spoom::Sorbet::Translate::ValidationResult) } + def validate(original, rewritten); end + end +end + +Spoom::Sorbet::Translate::Validator::LandmarkID = T.type_alias { ::String } +Spoom::Sorbet::Translate::Validator::Landmarks = T.type_alias { T::Hash[::String, T::Array[::Integer]] } + # This module provides a simple API to rewrite source code. # # Using a `Rewriter`, you can build a list of changes to apply to a source file diff --git a/sorbet/rbi/gems/tapioca@0.19.1.rbi b/sorbet/rbi/gems/tapioca@0.19.2.rbi similarity index 96% rename from sorbet/rbi/gems/tapioca@0.19.1.rbi rename to sorbet/rbi/gems/tapioca@0.19.2.rbi index 762b6c2..550396a 100644 --- a/sorbet/rbi/gems/tapioca@0.19.1.rbi +++ b/sorbet/rbi/gems/tapioca@0.19.2.rbi @@ -181,6 +181,25 @@ module T::Helpers def requires_ancestor(&block); end end +# pkg:gem/tapioca#lib/tapioca/sorbet_ext/generic_type_patch.rb:28 +module T::Private::Casts + class << self + # pkg:gem/tapioca#lib/tapioca/sorbet_ext/generic_type_patch.rb:34 + def cast(value, type, cast_method); end + end +end + +# pkg:gem/tapioca#lib/tapioca/sorbet_ext/generic_type_patch.rb:29 +module T::Private::Casts::TapiocaGenericTypeCastPatch + # https://github.com/sorbet/sorbet/commit/b8d64c7fd9a08e2b9159b5d592bc2de6d586b44a + # inlines the Module fast path in `T.let`, `T.cast`, `T.bind`, and + # `T.assert_type!`, so generic module clones can reach this cast path + # without going through `T::Utils::Private::TapiocaGenericTypeCoercePatch`. + # + # pkg:gem/tapioca#lib/tapioca/sorbet_ext/generic_type_patch.rb:34 + def cast(value, type, cast_method); end +end + # pkg:gem/tapioca#lib/tapioca/sorbet_ext/proc_bind_patch.rb:28 module T::Private::Methods class << self @@ -235,17 +254,20 @@ module T::Types::Simple::NamePatch def name; end end -# pkg:gem/tapioca#lib/tapioca/sorbet_ext/generic_name_patch.rb:87 +# pkg:gem/tapioca#lib/tapioca/sorbet_ext/generic_type_patch.rb:6 module T::Utils::Private class << self - # pkg:gem/tapioca#lib/tapioca/sorbet_ext/generic_name_patch.rb:89 + # pkg:gem/tapioca#lib/tapioca/sorbet_ext/generic_type_patch.rb:10 def coerce_and_check_module_types(val, check_val, check_module_type); end end end -# pkg:gem/tapioca#lib/tapioca/sorbet_ext/generic_name_patch.rb:88 -module T::Utils::Private::PrivateCoercePatch - # pkg:gem/tapioca#lib/tapioca/sorbet_ext/generic_name_patch.rb:89 +# Preserve Tapioca's generic type variables and instantiated generic +# names when Sorbet coerces them into runtime types. +# +# pkg:gem/tapioca#lib/tapioca/sorbet_ext/generic_type_patch.rb:9 +module T::Utils::Private::TapiocaGenericTypeCoercePatch + # pkg:gem/tapioca#lib/tapioca/sorbet_ext/generic_type_patch.rb:10 def coerce_and_check_module_types(val, check_val, check_module_type); end end @@ -263,6 +285,9 @@ end # For example, # the package URL for this Ruby package at version 0.1.0 is # `pkg:ruby/mattt/packageurl-ruby@0.1.0`. +# This code rewrites RBS comments back into Sorbet's signatures as the files are being loaded. +# This will allow `sorbet-runtime` to wrap the methods as if they were originally written with the `sig{}` blocks. +# This will in turn allow Tapioca to use this signatures to generate typed RBI files. # # pkg:gem/tapioca#lib/tapioca/runtime/trackers/autoload.rb:4 module Tapioca; end @@ -320,22 +345,22 @@ class Tapioca::Cli < ::Thor include ::Tapioca::ConfigHelper include ::Tapioca::EnvHelper - # pkg:gem/tapioca#lib/tapioca/cli.rb:373 + # pkg:gem/tapioca#lib/tapioca/cli.rb:383 def __print_version; end - # pkg:gem/tapioca#lib/tapioca/cli.rb:355 + # pkg:gem/tapioca#lib/tapioca/cli.rb:365 def annotations; end - # pkg:gem/tapioca#lib/tapioca/cli.rb:327 + # pkg:gem/tapioca#lib/tapioca/cli.rb:337 def check_shims; end # pkg:gem/tapioca#lib/tapioca/cli.rb:46 def configure; end - # pkg:gem/tapioca#lib/tapioca/cli.rb:146 + # pkg:gem/tapioca#lib/tapioca/cli.rb:150 def dsl(*constant_or_paths); end - # pkg:gem/tapioca#lib/tapioca/cli.rb:269 + # pkg:gem/tapioca#lib/tapioca/cli.rb:279 def gem(*gems); end # pkg:gem/tapioca#lib/tapioca/cli.rb:27 @@ -349,20 +374,20 @@ class Tapioca::Cli < ::Thor private - # pkg:gem/tapioca#lib/tapioca/cli.rb:398 + # pkg:gem/tapioca#lib/tapioca/cli.rb:408 def print_init_next_steps; end class << self # Indicates that we are running from the LSP, set using the `addon_mode!` method # - # pkg:gem/tapioca#lib/tapioca/cli.rb:382 + # pkg:gem/tapioca#lib/tapioca/cli.rb:392 def addon_mode; end - # pkg:gem/tapioca#lib/tapioca/cli.rb:385 + # pkg:gem/tapioca#lib/tapioca/cli.rb:395 sig { void } def addon_mode!; end - # pkg:gem/tapioca#lib/tapioca/cli.rb:390 + # pkg:gem/tapioca#lib/tapioca/cli.rb:400 sig { returns(T::Boolean) } def exit_on_failure?; end end @@ -427,15 +452,15 @@ class Tapioca::Commands::AbstractDsl < ::Tapioca::Commands::CommandWithoutTracke private - # pkg:gem/tapioca#lib/tapioca/commands/abstract_dsl.rb:88 + # pkg:gem/tapioca#lib/tapioca/commands/abstract_dsl.rb:93 sig { returns(T::Array[::String]) } def all_requested_constants; end - # pkg:gem/tapioca#lib/tapioca/commands/abstract_dsl.rb:284 + # pkg:gem/tapioca#lib/tapioca/commands/abstract_dsl.rb:289 sig { params(cause: ::Symbol, files: T::Array[::String]).returns(::String) } def build_error_for_files(cause, files); end - # pkg:gem/tapioca#lib/tapioca/commands/abstract_dsl.rb:208 + # pkg:gem/tapioca#lib/tapioca/commands/abstract_dsl.rb:213 sig do params( constant_name: ::String, @@ -446,7 +471,7 @@ class Tapioca::Commands::AbstractDsl < ::Tapioca::Commands::CommandWithoutTracke end def compile_dsl_rbi(constant_name, rbi, outpath: T.unsafe(nil), quiet: T.unsafe(nil)); end - # pkg:gem/tapioca#lib/tapioca/commands/abstract_dsl.rb:150 + # pkg:gem/tapioca#lib/tapioca/commands/abstract_dsl.rb:155 sig do params( constant_names: T::Array[::String], @@ -455,27 +480,27 @@ class Tapioca::Commands::AbstractDsl < ::Tapioca::Commands::CommandWithoutTracke end def constantize(constant_names, ignore_missing: T.unsafe(nil)); end - # pkg:gem/tapioca#lib/tapioca/commands/abstract_dsl.rb:175 + # pkg:gem/tapioca#lib/tapioca/commands/abstract_dsl.rb:180 sig { params(compiler_names: T::Array[::String]).returns(T::Array[T.class_of(Tapioca::Dsl::Compiler)]) } def constantize_compilers(compiler_names); end - # pkg:gem/tapioca#lib/tapioca/commands/abstract_dsl.rb:344 + # pkg:gem/tapioca#lib/tapioca/commands/abstract_dsl.rb:349 sig { returns(T::Array[::String]) } def constants_from_requested_paths; end - # pkg:gem/tapioca#lib/tapioca/commands/abstract_dsl.rb:111 + # pkg:gem/tapioca#lib/tapioca/commands/abstract_dsl.rb:116 sig { returns(::Tapioca::Dsl::Pipeline) } def create_pipeline; end - # pkg:gem/tapioca#lib/tapioca/commands/abstract_dsl.rb:247 + # pkg:gem/tapioca#lib/tapioca/commands/abstract_dsl.rb:252 sig { params(constant_name: ::String).returns(::Pathname) } def dsl_rbi_filename(constant_name); end - # pkg:gem/tapioca#lib/tapioca/commands/abstract_dsl.rb:136 + # pkg:gem/tapioca#lib/tapioca/commands/abstract_dsl.rb:141 sig { params(requested_constants: T::Array[::String], path: ::Pathname).returns(T::Set[::Pathname]) } def existing_rbi_filenames(requested_constants, path: T.unsafe(nil)); end - # pkg:gem/tapioca#lib/tapioca/commands/abstract_dsl.rb:339 + # pkg:gem/tapioca#lib/tapioca/commands/abstract_dsl.rb:344 sig { params(constant: ::String).returns(::String) } def generate_command_for(constant); end @@ -483,43 +508,43 @@ class Tapioca::Commands::AbstractDsl < ::Tapioca::Commands::CommandWithoutTracke sig { params(outpath: ::Pathname, quiet: T::Boolean).returns(T::Set[::Pathname]) } def generate_dsl_rbi_files(outpath, quiet:); end - # pkg:gem/tapioca#lib/tapioca/commands/abstract_dsl.rb:98 + # pkg:gem/tapioca#lib/tapioca/commands/abstract_dsl.rb:103 sig { void } def load_application; end - # pkg:gem/tapioca#lib/tapioca/commands/abstract_dsl.rb:226 + # pkg:gem/tapioca#lib/tapioca/commands/abstract_dsl.rb:231 sig { params(dir: ::Pathname).void } def perform_dsl_verification(dir); end - # pkg:gem/tapioca#lib/tapioca/commands/abstract_dsl.rb:93 + # pkg:gem/tapioca#lib/tapioca/commands/abstract_dsl.rb:98 sig { returns(::Tapioca::Dsl::Pipeline) } def pipeline; end - # pkg:gem/tapioca#lib/tapioca/commands/abstract_dsl.rb:235 + # pkg:gem/tapioca#lib/tapioca/commands/abstract_dsl.rb:240 sig { params(files: T::Set[::Pathname]).void } def purge_stale_dsl_rbi_files(files); end - # pkg:gem/tapioca#lib/tapioca/commands/abstract_dsl.rb:334 + # pkg:gem/tapioca#lib/tapioca/commands/abstract_dsl.rb:339 sig { params(constant: ::String).returns(::String) } def rbi_filename_for(constant); end - # pkg:gem/tapioca#lib/tapioca/commands/abstract_dsl.rb:315 + # pkg:gem/tapioca#lib/tapioca/commands/abstract_dsl.rb:320 sig { params(path: ::Pathname).returns(T::Array[::Pathname]) } def rbi_files_in(path); end - # pkg:gem/tapioca#lib/tapioca/commands/abstract_dsl.rb:293 + # pkg:gem/tapioca#lib/tapioca/commands/abstract_dsl.rb:298 sig { params(diff: T::Hash[::String, ::Symbol], command: ::Symbol).void } def report_diff_and_exit_if_out_of_date(diff, command); end - # pkg:gem/tapioca#lib/tapioca/commands/abstract_dsl.rb:195 + # pkg:gem/tapioca#lib/tapioca/commands/abstract_dsl.rb:200 sig { params(name: ::String).returns(T.nilable(T.class_of(Tapioca::Dsl::Compiler))) } def resolve(name); end - # pkg:gem/tapioca#lib/tapioca/commands/abstract_dsl.rb:322 + # pkg:gem/tapioca#lib/tapioca/commands/abstract_dsl.rb:327 sig { params(class_name: ::String).returns(::String) } def underscore(class_name); end - # pkg:gem/tapioca#lib/tapioca/commands/abstract_dsl.rb:252 + # pkg:gem/tapioca#lib/tapioca/commands/abstract_dsl.rb:257 sig { params(tmp_dir: ::Pathname).returns(T::Hash[::String, ::Symbol]) } def verify_dsl_rbi(tmp_dir:); end end @@ -861,11 +886,15 @@ end # pkg:gem/tapioca#lib/tapioca/commands/dsl_generate.rb:6 class Tapioca::Commands::DslGenerate < ::Tapioca::Commands::AbstractDsl + # pkg:gem/tapioca#lib/tapioca/commands/dsl_generate.rb:8 + sig { params(only_bootsnap_rbs_cache: T::Boolean, kwargs: T.untyped).void } + def initialize(only_bootsnap_rbs_cache: T.unsafe(nil), **kwargs); end + private # @override # - # pkg:gem/tapioca#lib/tapioca/commands/dsl_generate.rb:11 + # pkg:gem/tapioca#lib/tapioca/commands/dsl_generate.rb:17 sig { override.void } def execute; end end @@ -1285,13 +1314,13 @@ class Tapioca::Dsl::Pipeline private - # pkg:gem/tapioca#lib/tapioca/dsl/pipeline.rb:197 + # pkg:gem/tapioca#lib/tapioca/dsl/pipeline.rb:173 sig { void } def abort_if_pending_migrations!; end # pkg:gem/tapioca#lib/tapioca/dsl/pipeline.rb:143 sig { params(constants: T::Set[T::Module[T.anything]]).returns(T::Set[T::Module[T.anything]]) } - def filter_anonymous_and_reloaded_constants(constants); end + def filter_anonymous_constants(constants); end # pkg:gem/tapioca#lib/tapioca/dsl/pipeline.rb:113 sig do @@ -1312,11 +1341,11 @@ class Tapioca::Dsl::Pipeline end def gather_constants(requested_constants, requested_paths, skipped_constants); end - # pkg:gem/tapioca#lib/tapioca/dsl/pipeline.rb:172 + # pkg:gem/tapioca#lib/tapioca/dsl/pipeline.rb:148 sig { params(constant: T::Module[T.anything]).returns(T.nilable(::RBI::File)) } def rbi_for_constant(constant); end - # pkg:gem/tapioca#lib/tapioca/dsl/pipeline.rb:191 + # pkg:gem/tapioca#lib/tapioca/dsl/pipeline.rb:167 sig { params(error: ::String).void } def report_error(error); end end @@ -2838,6 +2867,23 @@ end # pkg:gem/tapioca#lib/tapioca/helpers/rbi_helper.rb:97 Tapioca::RBIHelper::TYPE_PARAMETER_MATCHER = T.let(T.unsafe(nil), Regexp) +# pkg:gem/tapioca#lib/tapioca/rbs/rewriter.rb:9 +module Tapioca::RBS; end + +# Raises when the host calls `Bootsnap.setup` after tapioca's setup. Host's call +# would overwrite tapioca's cache directory, so rewritten iseqs would end up in +# the host's regular cache. +# +# pkg:gem/tapioca#lib/tapioca/rbs/rewriter.rb:15 +module Tapioca::RBS::BootsnapGuard + # pkg:gem/tapioca#lib/tapioca/rbs/rewriter.rb:19 + sig { params(_kwargs: T.untyped).void } + def setup(**_kwargs); end +end + +# pkg:gem/tapioca#lib/tapioca/rbs/rewriter.rb:10 +class Tapioca::RBS::HostBootsnapSetupError < ::StandardError; end + # pkg:gem/tapioca#lib/tapioca/repo_index.rb:5 class Tapioca::RepoIndex # pkg:gem/tapioca#lib/tapioca/repo_index.rb:21 @@ -2928,7 +2974,7 @@ end # This class is responsible for storing and looking up information related to generic types. # # The class stores 2 different kinds of data, in two separate lookup tables: -# 1. a lookup of generic type instances by name: `@generic_instances` +# 1. a lookup of generic type instances by constant and name: `@generic_instances` # 2. a lookup of type variable serializer by constant and type variable # instance: `@type_variables` # @@ -2946,25 +2992,26 @@ end # pkg:gem/tapioca#lib/tapioca/runtime/generic_type_registry.rb:23 module Tapioca::Runtime::GenericTypeRegistry class << self - # pkg:gem/tapioca#lib/tapioca/runtime/generic_type_registry.rb:71 + # pkg:gem/tapioca#lib/tapioca/runtime/generic_type_registry.rb:73 def generic_type_instance?(instance); end - # pkg:gem/tapioca#lib/tapioca/runtime/generic_type_registry.rb:76 + # pkg:gem/tapioca#lib/tapioca/runtime/generic_type_registry.rb:80 def lookup_type_variables(constant); end # This method is responsible for building the name of the instantiated concrete type # and cloning the given constant so that we can return a type that is the same # as the current type but is a different instance and has a different name method. # - # We cache those cloned instances by their name in `@generic_instances`, so that - # we don't keep instantiating a new type every single time it is referenced. + # We cache those cloned instances by their original constant and their name in + # `@generic_instances`, so that we don't keep instantiating a new type every single + # time it is referenced. # For example, `[Foo[Integer], Foo[Integer], Foo[Integer], Foo[String]]` will only # result in 2 clones (1 for `Foo[Integer]` and another for `Foo[String]`) and # 2 hash lookups (for the other two `Foo[Integer]`s). # # This method returns the created or cached clone of the constant. # - # pkg:gem/tapioca#lib/tapioca/runtime/generic_type_registry.rb:56 + # pkg:gem/tapioca#lib/tapioca/runtime/generic_type_registry.rb:57 def register_type(constant, types); end # This method is called from intercepted calls to `type_member` and `type_template`. @@ -2977,19 +3024,16 @@ module Tapioca::Runtime::GenericTypeRegistry # Finally, the original `type_variable` is returned from this method, so that the caller # can return it from the original methods as well. # - # pkg:gem/tapioca#lib/tapioca/runtime/generic_type_registry.rb:90 + # pkg:gem/tapioca#lib/tapioca/runtime/generic_type_registry.rb:94 def register_type_variable(constant, type_variable); end private - # pkg:gem/tapioca#lib/tapioca/runtime/generic_type_registry.rb:99 + # pkg:gem/tapioca#lib/tapioca/runtime/generic_type_registry.rb:103 def create_generic_type(constant, name); end - # pkg:gem/tapioca#lib/tapioca/runtime/generic_type_registry.rb:141 + # pkg:gem/tapioca#lib/tapioca/runtime/generic_type_registry.rb:145 def create_safe_subclass(constant); end - - # pkg:gem/tapioca#lib/tapioca/runtime/generic_type_registry.rb:168 - def lookup_or_initialize_type_variables(constant); end end end @@ -3496,12 +3540,12 @@ Tapioca::TAPIOCA_CONFIG_FILE = T.let(T.unsafe(nil), String) # pkg:gem/tapioca#lib/tapioca.rb:15 Tapioca::TAPIOCA_DIR = T.let(T.unsafe(nil), String) -# pkg:gem/tapioca#lib/tapioca/sorbet_ext/generic_name_patch.rb:108 +# pkg:gem/tapioca#lib/tapioca/sorbet_ext/generic_name_patch.rb:88 class Tapioca::TypeVariable < ::T::Types::TypeVariable - # pkg:gem/tapioca#lib/tapioca/sorbet_ext/generic_name_patch.rb:109 + # pkg:gem/tapioca#lib/tapioca/sorbet_ext/generic_name_patch.rb:89 def initialize(name, variance); end - # pkg:gem/tapioca#lib/tapioca/sorbet_ext/generic_name_patch.rb:114 + # pkg:gem/tapioca#lib/tapioca/sorbet_ext/generic_name_patch.rb:94 def name; end end @@ -3511,36 +3555,36 @@ end # need to do any matching of constants to type variables to bind their names, Ruby will # do that automatically for us and we get the `name` method for free from `Module`. # -# pkg:gem/tapioca#lib/tapioca/sorbet_ext/generic_name_patch.rb:122 +# pkg:gem/tapioca#lib/tapioca/sorbet_ext/generic_name_patch.rb:102 class Tapioca::TypeVariableModule < ::Module - # pkg:gem/tapioca#lib/tapioca/sorbet_ext/generic_name_patch.rb:137 + # pkg:gem/tapioca#lib/tapioca/sorbet_ext/generic_name_patch.rb:117 def initialize(context, type, variance, bounds_proc); end - # pkg:gem/tapioca#lib/tapioca/sorbet_ext/generic_name_patch.rb:173 + # pkg:gem/tapioca#lib/tapioca/sorbet_ext/generic_name_patch.rb:153 def coerce_to_type_variable; end - # pkg:gem/tapioca#lib/tapioca/sorbet_ext/generic_name_patch.rb:153 + # pkg:gem/tapioca#lib/tapioca/sorbet_ext/generic_name_patch.rb:133 def fixed?; end - # pkg:gem/tapioca#lib/tapioca/sorbet_ext/generic_name_patch.rb:147 + # pkg:gem/tapioca#lib/tapioca/sorbet_ext/generic_name_patch.rb:127 def name; end - # pkg:gem/tapioca#lib/tapioca/sorbet_ext/generic_name_patch.rb:158 + # pkg:gem/tapioca#lib/tapioca/sorbet_ext/generic_name_patch.rb:138 def serialize; end - # pkg:gem/tapioca#lib/tapioca/sorbet_ext/generic_name_patch.rb:134 + # pkg:gem/tapioca#lib/tapioca/sorbet_ext/generic_name_patch.rb:114 def type; end private - # pkg:gem/tapioca#lib/tapioca/sorbet_ext/generic_name_patch.rb:180 + # pkg:gem/tapioca#lib/tapioca/sorbet_ext/generic_name_patch.rb:160 def bounds; end end -# pkg:gem/tapioca#lib/tapioca/sorbet_ext/generic_name_patch.rb:131 +# pkg:gem/tapioca#lib/tapioca/sorbet_ext/generic_name_patch.rb:111 Tapioca::TypeVariableModule::DEFAULT_BOUNDS_PROC = T.let(T.unsafe(nil), Proc) -# pkg:gem/tapioca#lib/tapioca/sorbet_ext/generic_name_patch.rb:123 +# pkg:gem/tapioca#lib/tapioca/sorbet_ext/generic_name_patch.rb:103 class Tapioca::TypeVariableModule::Type < ::T::Enum enums do HasAttachedClass = new