agensdev/wardrobe

View on GitHub

Showing 559 of 559 total issues

Class has too many lines. [133/100]
Open

  class Config
    def self.registered_stores
      @registered_stores ||= {}.freeze
    end

Severity: Minor
Found in lib/wardrobe/config.rb by rubocop

This cop checks if the length a class exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

Class has too many lines. [125/100]
Open

      class Validator
        using Refinements
        attr_reader :value, :atr, :error_store, :validation, :log

        def initialize(value, atr, error_store = ErrorStore.new, validation = nil)

This cop checks if the length a class exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

Module has too many lines. [124/100]
Open

  module ClassMethods
    extend Forwardable
    def_delegators :@wardrobe_config, :attribute_store, :plugin_store, :option_store

    def self.extended(base)
Severity: Minor
Found in lib/wardrobe/class_methods.rb by rubocop

This cop checks if the length a module exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

Class has too many lines. [123/100]
Open

  class BlockSetup
    attr_reader :calling_klass, :block_options

    def initialize(calling_klass)
      @calling_klass = calling_klass
Severity: Minor
Found in lib/wardrobe/block_setup.rb by rubocop

This cop checks if the length a class exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

Class has too many lines. [114/100]
Open

  class Attribute
    attr_reader :name, :klass, :options, :ivar_name, :setter_name, :store,
                :setters, :getters

    def initialize(name, klass, defining_object, config, **options)
Severity: Minor
Found in lib/wardrobe/attribute.rb by rubocop

This cop checks if the length a class exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

Module has too many lines. [102/100]
Open

    module ImmutableInstanceMethods
      IMMUTABLE_CORE_CLASSES = Set.new(
        [NilClass, TrueClass, FalseClass, Integer, Float, Symbol, Proc]
      )

Severity: Minor
Found in lib/wardrobe/plugins/immutable.rb by rubocop

This cop checks if the length a module exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

Method _present has a Cognitive Complexity of 36 (exceeds 5 allowed). Consider refactoring.
Open

        def _present(attributes: nil, **args)
          options = self.class.plugin_store[:presenter][:options].merge(args)
          result = {}
          # TODO: Optimize!
          _attribute_store.store.each do |key, atr|
Severity: Minor
Found in lib/wardrobe/plugins/presenter.rb - About 5 hrs to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Assignment Branch Condition size for create_option_methods is too high. [45/15]
Open

    def create_option_methods(config)
      config.option_store.each do |option|
        define_singleton_method(option.name) do |&blk|
          if blk
            if options[option.name].nil? && option.options[:init]
Severity: Minor
Found in lib/wardrobe/attribute.rb by rubocop

This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric

Method has too many lines. [39/10]
Open

        def _present(attributes: nil, **args)
          options = self.class.plugin_store[:presenter][:options].merge(args)
          result = {}
          # TODO: Optimize!
          _attribute_store.store.each do |key, atr|
Severity: Minor
Found in lib/wardrobe/plugins/presenter.rb by rubocop

This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

Method _create_configurable_set_method has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
Open

        def _create_configurable_set_method(name, setter_name, **opts)
          class_methods_module do
            define_method(setter_name) do |*args, **kargs, &blk|
              klass = self
              opts[:before_update].call(klass) if opts[:before_update]
Severity: Minor
Found in lib/wardrobe/plugins/configurable.rb - About 4 hrs to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Assignment Branch Condition size for _present is too high. [37.32/15]
Open

        def _present(attributes: nil, **args)
          options = self.class.plugin_store[:presenter][:options].merge(args)
          result = {}
          # TODO: Optimize!
          _attribute_store.store.each do |key, atr|
Severity: Minor
Found in lib/wardrobe/plugins/presenter.rb by rubocop

This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric

Method has too many lines. [30/10]
Open

    def create_option_methods(config)
      config.option_store.each do |option|
        define_singleton_method(option.name) do |&blk|
          if blk
            if options[option.name].nil? && option.options[:init]
Severity: Minor
Found in lib/wardrobe/attribute.rb by rubocop

This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

Assignment Branch Condition size for _value_changed? is too high. [34.54/15]
Open

        def _value_changed?(value, ref)
          if ref == :wardrobe_instance
            if value._changed?
              _dirty!
              _dirty_tracker_dirty_sub_instances << value

This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric

Method has too many lines. [27/10]
Open

    def add_to_ordered_array(new_item)
      if @order.empty?
        @order << new_item
      else
        # We have to figure out where to place the item.
Severity: Minor
Found in lib/wardrobe/middleware_registry.rb by rubocop

This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

Assignment Branch Condition size for merge is too high. [31.27/15]
Open

    def merge(other, calling_object)
      if frozen?
        dup.merge(other, calling_object)
      else
        (other.stores.keys - stores.keys).each do |name|
Severity: Minor
Found in lib/wardrobe/config.rb by rubocop

This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric

Method has too many lines. [26/10]
Open

        def _create_configurable_set_method(name, setter_name, **opts)
          class_methods_module do
            define_method(setter_name) do |*args, **kargs, &blk|
              klass = self
              opts[:before_update].call(klass) if opts[:before_update]

This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

Assignment Branch Condition size for add_to_ordered_array is too high. [31.69/15]
Open

    def add_to_ordered_array(new_item)
      if @order.empty?
        @order << new_item
      else
        # We have to figure out where to place the item.
Severity: Minor
Found in lib/wardrobe/middleware_registry.rb by rubocop

This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric

Assignment Branch Condition size for _create_configurable_set_method is too high. [30.1/15]
Open

        def _create_configurable_set_method(name, setter_name, **opts)
          class_methods_module do
            define_method(setter_name) do |*args, **kargs, &blk|
              klass = self
              opts[:before_update].call(klass) if opts[:before_update]

This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric

Assignment Branch Condition size for run is too high. [30.51/15]
Open

        def run(report = true)
          if validation && validation.any?
            validate(validation, report)
          elsif value.respond_to?(:_validate!)
            if value._validation_errors.any?

This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric

Method has too many lines. [24/10]
Open

        def _value_changed?(value, ref)
          if ref == :wardrobe_instance
            if value._changed?
              _dirty!
              _dirty_tracker_dirty_sub_instances << value

This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

Severity
Category
Status
Source
Language