Sha256: e4a07dae25f2d934aea350fc2515d90c5f671d8457cd07a95f873d075e663397

Contents?: true

Size: 581 Bytes

Versions: 3

Compression:

Stored size: 581 Bytes

Contents

require_relative '../model_helpers'

module Gitlab
  module Styles
    module Rubocop
      module Cop
        # Cop that prevents the use of `serialize` in ActiveRecord models.
        class ActiveRecordSerialize < RuboCop::Cop::Cop
          include ModelHelpers

          MSG = 'Do not store serialized data in the database, use separate columns and/or tables instead'.freeze

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

            add_offense(node, :selector) if node.children[1] == :serialize
          end
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
gitlab-styles-2.0.0 lib/gitlab/styles/rubocop/cop/active_record_serialize.rb
gitlab-styles-1.0.0 lib/gitlab/styles/rubocop/cop/active_record_serialize.rb
gitlab-styles-0.1.0 lib/gitlab/styles/rubocop/cop/active_record_serialize.rb