diff --git a/CHANGELOG.md b/CHANGELOG.md index 06c575701..de82c47dc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ ## Master (Unreleased) - Add new cop `RSpec/LeakyLocalVariable`. ([@lovro-bikic]) +- Bump RuboCop requirement to +1.81. ([@ydah]) ## 3.7.0 (2025-09-01) diff --git a/lib/rubocop/cop/rspec/context_wording.rb b/lib/rubocop/cop/rspec/context_wording.rb index 96c40a76e..5c21c508e 100644 --- a/lib/rubocop/cop/rspec/context_wording.rb +++ b/lib/rubocop/cop/rspec/context_wording.rb @@ -67,7 +67,7 @@ class ContextWording < Base # @!method context_wording(node) def_node_matcher :context_wording, <<~PATTERN - (block (send #rspec? { :context :shared_context } $({str dstr xstr} ...) ...) ...) + (block (send #rspec? { :context :shared_context } $(any_str ...) ...) ...) PATTERN def on_block(node) # rubocop:disable InternalAffairs/NumblockHandler diff --git a/lib/rubocop/cop/rspec/mixin/final_end_location.rb b/lib/rubocop/cop/rspec/mixin/final_end_location.rb index 526049f5d..8190cc5eb 100644 --- a/lib/rubocop/cop/rspec/mixin/final_end_location.rb +++ b/lib/rubocop/cop/rspec/mixin/final_end_location.rb @@ -7,7 +7,7 @@ module RSpec module FinalEndLocation def final_end_location(start_node) heredoc_endings = - start_node.each_node(:str, :dstr, :xstr) + start_node.each_node(:any_str) .select(&:heredoc?) .map { |node| node.loc.heredoc_end } diff --git a/lib/rubocop/cop/rspec/mixin/variable.rb b/lib/rubocop/cop/rspec/mixin/variable.rb index e469cd335..533993738 100644 --- a/lib/rubocop/cop/rspec/mixin/variable.rb +++ b/lib/rubocop/cop/rspec/mixin/variable.rb @@ -13,7 +13,7 @@ module Variable # @!method variable_definition?(node) def_node_matcher :variable_definition?, <<~PATTERN (send nil? {#Subjects.all #Helpers.all} - $({sym str dsym dstr} ...) ...) + $({any_sym str dstr} ...) ...) PATTERN end end diff --git a/lib/rubocop/cop/rspec/predicate_matcher.rb b/lib/rubocop/cop/rspec/predicate_matcher.rb index fd7830ec4..4ee60d68d 100644 --- a/lib/rubocop/cop/rspec/predicate_matcher.rb +++ b/lib/rubocop/cop/rspec/predicate_matcher.rb @@ -181,9 +181,7 @@ def uncorrectable_matcher?(node, matcher) end def heredoc_argument?(matcher) - matcher.arguments.select do |arg| - arg.type?(:str, :dstr, :xstr) - end.any?(&:heredoc?) + matcher.arguments.select(&:any_str_type?).any?(&:heredoc?) end # @!method predicate_matcher?(node) diff --git a/lib/rubocop/cop/rspec/sort_metadata.rb b/lib/rubocop/cop/rspec/sort_metadata.rb index 2e9411a44..707dadc09 100644 --- a/lib/rubocop/cop/rspec/sort_metadata.rb +++ b/lib/rubocop/cop/rspec/sort_metadata.rb @@ -30,7 +30,7 @@ class SortMetadata < Base # @!method match_ambiguous_trailing_metadata?(node) def_node_matcher :match_ambiguous_trailing_metadata?, <<~PATTERN - (send _ _ _ ... !{hash sym str dstr xstr}) + (send _ _ _ ... !{hash sym any_str}) PATTERN def on_metadata(args, hash) diff --git a/lib/rubocop/cop/rspec/variable_definition.rb b/lib/rubocop/cop/rspec/variable_definition.rb index b438e8609..4bfe1509b 100644 --- a/lib/rubocop/cop/rspec/variable_definition.rb +++ b/lib/rubocop/cop/rspec/variable_definition.rb @@ -69,7 +69,7 @@ def string?(node) end def symbol?(node) - node.type?(:sym, :dsym) + node.any_sym_type? end end end diff --git a/rubocop-rspec.gemspec b/rubocop-rspec.gemspec index 5296dd3e2..94f5c971a 100644 --- a/rubocop-rspec.gemspec +++ b/rubocop-rspec.gemspec @@ -39,5 +39,5 @@ Gem::Specification.new do |spec| } spec.add_dependency 'lint_roller', '~> 1.1' - spec.add_dependency 'rubocop', '~> 1.72', '>= 1.72.1' + spec.add_dependency 'rubocop', '~> 1.81' end