File tree Expand file tree Collapse file tree 2 files changed +4
-2
lines changed Expand file tree Collapse file tree 2 files changed +4
-2
lines changed Original file line number Diff line number Diff line change 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
Original file line number Diff line number Diff 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
You can’t perform that action at this time.
0 commit comments