Skip to content

Commit

Permalink
Merge pull request #1936 from koic/suppress_deprecation_warning_when_…
Browse files Browse the repository at this point in the history
…some_cops

Suppress deprecation warning for some cops
  • Loading branch information
ydah committed Jul 10, 2024
2 parents aa734b0 + 7e1d68e commit 03034e7
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 4 deletions.
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 support for Unicode RIGHT SINGLE QUOTATION MARK in `RSpec/ExampleWording`. ([@jdufresne])
- Suppress deprecation warning for `RSpec/MultipleExpectations`, `RSpec/MultipleMemoizedHelpers`, and `RSpec/NestedGroups` cops. ([@koic])

## 3.0.2 (2024-07-02)

Expand Down
4 changes: 2 additions & 2 deletions lib/rubocop/cop/rspec/multiple_expectations.rb
Original file line number Diff line number Diff line change
Expand Up @@ -67,13 +67,13 @@ module RSpec
# end
#
class MultipleExpectations < Base
include ConfigurableMax

MSG = 'Example has too many expectations [%<total>d/%<max>d].'

ANYTHING = ->(_node) { true }
TRUE_NODE = lambda(&:true_type?)

exclude_limit 'Max'

# @!method aggregate_failures?(node)
def_node_matcher :aggregate_failures?, <<~PATTERN
(block {
Expand Down
3 changes: 2 additions & 1 deletion lib/rubocop/cop/rspec/multiple_memoized_helpers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -82,11 +82,12 @@ module RSpec
# end
#
class MultipleMemoizedHelpers < Base
include ConfigurableMax
include Variable

MSG = 'Example group has too many memoized helpers [%<count>d/%<max>d]'

exclude_limit 'Max'

def on_block(node) # rubocop:disable InternalAffairs/NumblockHandler
return unless spec_group?(node)

Expand Down
3 changes: 2 additions & 1 deletion lib/rubocop/cop/rspec/nested_groups.rb
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,6 @@ module RSpec
# end
#
class NestedGroups < Base
include ConfigurableMax
include TopLevelGroup

MSG = 'Maximum example group nesting exceeded [%<total>d/%<max>d].'
Expand All @@ -103,6 +102,8 @@ class NestedGroups < Base
"Configuration key `#{DEPRECATED_MAX_KEY}` for #{cop_name} is " \
'deprecated in favor of `Max`. Please use that instead.'

exclude_limit 'Max'

def on_top_level_group(node)
find_nested_example_groups(node) do |example_group, nesting|
self.max = nesting
Expand Down

0 comments on commit 03034e7

Please sign in to comment.