Welcome to mirror list, hosted at ThFree Co, Russian Federation.

active_record_association_reload.rb « cop « rubocop - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 758d5de348c2770498dc27da50bc9a5285e13f9b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# frozen_string_literal: true

module RuboCop
  module Cop
    # Cop that denylists the use of `reload`.
    class ActiveRecordAssociationReload < RuboCop::Cop::Base
      MSG = 'Use reset instead of reload. ' \
        'For more details check the https://gitlab.com/gitlab-org/gitlab-foss/issues/60218.'

      def_node_matcher :reload?, <<~PATTERN
        (send _ :reload ...)
      PATTERN

      def on_send(node)
        return unless reload?(node)

        add_offense(node.loc.selector)
      end
    end
  end
end