sferik/rails_admin

View on GitHub
lib/rails_admin/config/fields/base.rb

Summary

Maintainability
B
6 hrs
Test Coverage

File base.rb has 288 lines of code (exceeds 250 allowed). Consider refactoring.
Open

require 'rails_admin/config/proxyable'
require 'rails_admin/config/configurable'
require 'rails_admin/config/hideable'
require 'rails_admin/config/groupable'
require 'rails_admin/config/inspectable'
Severity: Minor
Found in lib/rails_admin/config/fields/base.rb - About 2 hrs to fix

    Class Base has 22 methods (exceeds 20 allowed). Consider refactoring.
    Open

          class Base # rubocop:disable Metrics/ClassLength
            include RailsAdmin::Config::Proxyable
            include RailsAdmin::Config::Configurable
            include RailsAdmin::Config::Hideable
            include RailsAdmin::Config::Groupable
    Severity: Minor
    Found in lib/rails_admin/config/fields/base.rb - About 2 hrs to fix

      Method sort_column has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

              def sort_column
                if sortable == true
                  "#{abstract_model.quoted_table_name}.#{abstract_model.quote_column_name(name)}"
                elsif (sortable.is_a?(String) || sortable.is_a?(Symbol)) && sortable.to_s.include?('.') # just provide sortable, don't do anything smart
                  sortable
      Severity: Minor
      Found in lib/rails_admin/config/fields/base.rb - About 35 mins 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

      Method optional has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

              def optional(state = nil, &block)
                if !state.nil? || block
                  required state.nil? ? proc { instance_eval(&block) == false } : state == false
                else
                  optional?
      Severity: Minor
      Found in lib/rails_admin/config/fields/base.rb - About 25 mins 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

      There are no issues that match your filters.

      Category
      Status