Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Suppress deprecation warning for some cops #1936

Merged
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 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