Updated

app/lib / deprecated_attributes.rb

C
29 lines of codes
1 methods
72.3 complexity/method
1 churn
72.28 complexity
54 duplications
require 'active_support/deprecation' module DeprecatedAttributes
  1. DeprecatedAttributes has no descriptive comment
extend ActiveSupport::Concern class_methods do def deprecate_attribute(*names)
  1. DeprecatedAttributes#deprecate_attribute has a flog score of 72
  2. DeprecatedAttributes#deprecate_attribute has approx 16 statements
names.each do |name| define_method(:"#{name}") do callstack = caller_locations(0).map(&:to_s).reject{ |path| path =~ /deprecated_attributes\.rb/ }
  1. Similar code found in 2 nodes Locations: 0 1
  2. DeprecatedAttributes#deprecate_attribute calls 'caller_locations(0)' 3 times Locations: 0 1 2
  3. DeprecatedAttributes#deprecate_attribute calls 'caller_locations(0).map(&:to_s)' 3 times Locations: 0 1 2
  4. DeprecatedAttributes#deprecate_attribute calls 'caller_locations(0).map(&:to_s).reject' 3 times Locations: 0 1 2
  5. DeprecatedAttributes#deprecate_attribute calls 'caller_locations(0).map(&:to_s).reject{ |path| path =~ /deprecated_attributes\.rb/ }' 3 times Locations: 0 1 2
  6. DeprecatedAttributes#deprecate_attribute calls 'path =~ /deprecated_attributes\.rb/' 3 times Locations: 0 1 2
  7. DeprecatedAttributes#deprecate_attribute contains iterators nested 2 deep Locations: 0 1
ActiveSupport::Deprecation.warn("#{self.class.name}##{name} is deprecated and will be removed", callstack)
  1. DeprecatedAttributes#deprecate_attribute calls 'self.class' 3 times Locations: 0 1 2
  2. DeprecatedAttributes#deprecate_attribute calls 'self.class.name' 3 times Locations: 0 1 2
super() end define_method(:"#{name}=") do |value| callstack = caller_locations(0).map(&:to_s).reject{ |path| path =~ /deprecated_attributes\.rb/ }
  1. DeprecatedAttributes#deprecate_attribute calls 'caller_locations(0)' 3 times Locations: 0 1 2
  2. DeprecatedAttributes#deprecate_attribute calls 'caller_locations(0).map(&:to_s)' 3 times Locations: 0 1 2
  3. DeprecatedAttributes#deprecate_attribute calls 'caller_locations(0).map(&:to_s).reject' 3 times Locations: 0 1 2
  4. DeprecatedAttributes#deprecate_attribute calls 'caller_locations(0).map(&:to_s).reject{ |path| path =~ /deprecated_attributes\.rb/ }' 3 times Locations: 0 1 2
  5. DeprecatedAttributes#deprecate_attribute calls 'path =~ /deprecated_attributes\.rb/' 3 times Locations: 0 1 2
  6. DeprecatedAttributes#deprecate_attribute contains iterators nested 3 deep
ActiveSupport::Deprecation.warn("#{self.class.name}##{name}= is deprecated and will be removed", callstack)
  1. DeprecatedAttributes#deprecate_attribute calls 'self.class' 3 times Locations: 0 1 2
  2. DeprecatedAttributes#deprecate_attribute calls 'self.class.name' 3 times Locations: 0 1 2
super(value) end define_method(:"#{name}?") do callstack = caller_locations(0).map(&:to_s).reject{ |path| path =~ /deprecated_attributes\.rb/ }
  1. Similar code found in 2 nodes Locations: 0 1
  2. DeprecatedAttributes#deprecate_attribute calls 'caller_locations(0)' 3 times Locations: 0 1 2
  3. DeprecatedAttributes#deprecate_attribute calls 'caller_locations(0).map(&:to_s)' 3 times Locations: 0 1 2
  4. DeprecatedAttributes#deprecate_attribute calls 'caller_locations(0).map(&:to_s).reject' 3 times Locations: 0 1 2
  5. DeprecatedAttributes#deprecate_attribute calls 'caller_locations(0).map(&:to_s).reject{ |path| path =~ /deprecated_attributes\.rb/ }' 3 times Locations: 0 1 2
  6. DeprecatedAttributes#deprecate_attribute calls 'path =~ /deprecated_attributes\.rb/' 3 times Locations: 0 1 2
  7. DeprecatedAttributes#deprecate_attribute contains iterators nested 2 deep Locations: 0 1
ActiveSupport::Deprecation.warn("#{self.class.name}##{name}? is deprecated and will be removed", callstack)
  1. DeprecatedAttributes#deprecate_attribute calls 'self.class' 3 times Locations: 0 1 2
  2. DeprecatedAttributes#deprecate_attribute calls 'self.class.name' 3 times Locations: 0 1 2
super() end end end end end