diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-01-05 00:07:26 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-01-05 00:07:26 +0300 |
commit | 2242221252d13fdf322b5e59f971a689831c541b (patch) | |
tree | 23e30706b58811d2dd2522853cb3bbc27bab028d /rubocop/cop | |
parent | 9c66c38ab6ce56cfe06eca21f717977f1684f08c (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'rubocop/cop')
-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) |