Skip to content

Commit 5d8f75d

Browse files
authored
Merge pull request #928 from rubocop-hq/add-andry-to-hall-of-fame
Add Andrew to the hall of fame
2 parents 7f56f41 + 686b1a8 commit 5d8f75d

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
* Add new `SpecSuffixOnly` option to `RSpec/FilePath` cop. ([@zdennis][])
99
* Allow `RSpec/RepeatedExampleGroupBody` to differ only by described_class. ([@robotdana][])
1010
* Fix `RSpec/FilePath` detection across sibling directories. ([@rolfschmidt][])
11+
* Improve the performance of `RSpec/SubjectStub` by an order of magnitude. ([@andrykonchin][])
1112

1213
## 1.39.0 (2020-05-01)
1314

@@ -514,3 +515,4 @@ Compatibility release so users can upgrade RuboCop to 0.51.0. No new features.
514515
[@zdennis]: https://github.com/zdennis
515516
[@robotdana]: https://github.com/robotdana
516517
[@rolfschmidt]: https://github.com/rolfschmidt
518+
[@andrykonchin]: https://github.com/andrykonchin

lib/rubocop/cop/rspec/subject_stub.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ class SubjectStub < Cop
7777

7878
def on_block(node)
7979
return unless example_group?(node)
80-
return unless (processed_example_groups & node.ancestors).empty?
80+
return if (processed_example_groups & node.ancestors).any?
8181

8282
processed_example_groups << node
8383
@explicit_subjects = find_all_explicit_subjects(node)
@@ -94,7 +94,7 @@ def processed_example_groups
9494
end
9595

9696
def find_all_explicit_subjects(node)
97-
node.each_descendant(:block).each_with_object({}) do |child, h|
97+
node.each_descendant(:block).with_object({}) do |child, h|
9898
name = subject(child)
9999
next unless name
100100

0 commit comments

Comments
 (0)