diff options
Diffstat (limited to 'rubocop')
-rw-r--r-- | rubocop/cop/gitlab/strong_memoize_attr.rb | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/rubocop/cop/gitlab/strong_memoize_attr.rb b/rubocop/cop/gitlab/strong_memoize_attr.rb index 8ef0f95e75b..0b3de9d7863 100644 --- a/rubocop/cop/gitlab/strong_memoize_attr.rb +++ b/rubocop/cop/gitlab/strong_memoize_attr.rb @@ -53,6 +53,9 @@ module RuboCop # Don't flag methods with parameters. return if send_node.each_ancestor(:def).first&.arguments&.any? + # Don't flag singleton methods. + return if send_node.each_ancestor(:defs).any? + corrector = autocorrect_pure_definitions(node.parent, body) if node.parent.def_type? add_offense(send_node, &corrector) |