Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
## Master (Unreleased)

- Add new cop `RSpec/LeakyLocalVariable`. ([@lovro-bikic])
- Bump RuboCop requirement to +1.81. ([@ydah])
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

memo) added change log


## 3.7.0 (2025-09-01)

Expand Down
2 changes: 1 addition & 1 deletion lib/rubocop/cop/rspec/context_wording.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion lib/rubocop/cop/rspec/mixin/final_end_location.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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 }

Expand Down
2 changes: 1 addition & 1 deletion lib/rubocop/cop/rspec/mixin/variable.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 1 addition & 3 deletions lib/rubocop/cop/rspec/predicate_matcher.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion lib/rubocop/cop/rspec/sort_metadata.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion lib/rubocop/cop/rspec/variable_definition.rb
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ def string?(node)
end

def symbol?(node)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we should inline #string? and #symbol? now? They are only used once each.

node.type?(:sym, :dsym)
node.any_sym_type?
end
end
end
Expand Down
2 changes: 1 addition & 1 deletion rubocop-rspec.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -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