diff options
Diffstat (limited to 'rubocop')
-rw-r--r-- | rubocop/cop/gitlab/strong_memoize_attr.rb | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/rubocop/cop/gitlab/strong_memoize_attr.rb b/rubocop/cop/gitlab/strong_memoize_attr.rb index 6bae3960854..8ef0f95e75b 100644 --- a/rubocop/cop/gitlab/strong_memoize_attr.rb +++ b/rubocop/cop/gitlab/strong_memoize_attr.rb @@ -34,7 +34,7 @@ module RuboCop class StrongMemoizeAttr < RuboCop::Cop::Base extend RuboCop::Cop::AutoCorrector - MSG = 'Use `strong_memoize_attr`, instead of using `strong_memoize` directly' + MSG = 'Use `strong_memoize_attr`, instead of using `strong_memoize` directly.' def_node_matcher :strong_memoize?, <<~PATTERN (block @@ -50,6 +50,9 @@ module RuboCop send_node, body = strong_memoize?(node) return unless send_node + # Don't flag methods with parameters. + return if send_node.each_ancestor(:def).first&.arguments&.any? + corrector = autocorrect_pure_definitions(node.parent, body) if node.parent.def_type? add_offense(send_node, &corrector) |