summaryrefslogtreecommitdiff
path: root/rubocop/cop/ignored_columns.rb
blob: 14bcfa04ae136fda84af4ab52e717529a15b471d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# frozen_string_literal: true

module RuboCop
  module Cop
    # Cop that blacklists the usage of Group.public_or_visible_to_user
    class IgnoredColumns < RuboCop::Cop::Cop
      MSG = 'Use `IgnoredColumns` concern instead of adding to `self.ignored_columns`.'

      def_node_matcher :ignored_columns?, <<~PATTERN
        (send (self) :ignored_columns)
      PATTERN

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

        add_offense(node, location: :expression)
      end
    end
  end
end