codez/dry_crud

View on GitHub

Showing 7 of 9 total issues

Class Builder has 28 methods (exceeds 20 allowed). Consider refactoring.
Open

    class Builder < ActionView::Helpers::FormBuilder

      class_attribute :control_class
      self.control_class = Control

Severity: Minor
Found in app/helpers/dry_crud/form/builder.rb - About 3 hrs to fix

    Class CrudController has 23 methods (exceeds 20 allowed). Consider refactoring.
    Open

    class CrudController < ListController
    
      class_attribute :permitted_attrs
    
      # Defines before and after callback hooks for create, update, save and
    Severity: Minor
    Found in app/controllers/crud_controller.rb - About 2 hrs to fix

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

            def detect_field_method
              if type == :text
                :text_area
              elsif association_kind?(:belongs_to)
                :belongs_to_field
      Severity: Minor
      Found in app/helpers/dry_crud/form/control.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 select_options has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

            def select_options(attr, **options)
              prompt = options.delete(:prompt)
              blank = options.delete(:include_blank)
              if options[:multiple]
                {}
      Severity: Minor
      Found in app/helpers/dry_crud/form/builder.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 align_class has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

            def align_class(attr)
              entry = entries.present? ? entry_class.new : nil
              case column_type(entry, attr)
              when :integer, :float, :decimal
                'right' unless association(entry, attr, :belongs_to)
      Severity: Minor
      Found in app/helpers/dry_crud/table/builder.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

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

            def list_entries
              sortable = sortable?(params[:sort])
              if sortable || default_sort
                clause = [sortable ? sort_expression : nil, default_sort]
                super.reorder(Arel.sql(clause.compact.join(', ')))
      Severity: Minor
      Found in app/controllers/dry_crud/sortable.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

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

            def edit_action_col(**html_options, &block)
              action_col do |entry|
                path = action_path(entry, &block)
                if path
                  path = edit_polymorphic_path(path) unless path.is_a?(String)
      Severity: Minor
      Found in app/helpers/dry_crud/table/actions.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

      Severity
      Category
      Status
      Source
      Language