Sha256: 32250c4e7e6db5f2c410fb7643bbe71a880b2eb7d1d4e9e3dea93a205e75cfb8

Contents?: true

Size: 566 Bytes

Versions: 3

Compression:

Stored size: 566 Bytes

Contents

# frozen_string_literal: true

require_relative '../../gitlab/styles/rubocop/model_helpers'

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

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

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

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

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
gitlab-styles-9.2.0 lib/rubocop/cop/active_record_serialize.rb
gitlab-styles-9.1.0 lib/rubocop/cop/active_record_serialize.rb
gitlab-styles-9.0.0 lib/rubocop/cop/active_record_serialize.rb