From 2242221252d13fdf322b5e59f971a689831c541b Mon Sep 17 00:00:00 2001 From: GitLab Bot Date: Wed, 4 Jan 2023 21:07:26 +0000 Subject: Add latest changes from gitlab-org/gitlab@master --- rubocop/cop/gitlab/strong_memoize_attr.rb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'rubocop') 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) -- cgit v1.2.3