AndyObtiva/glimmer-dsl-swt

View on GitHub
lib/glimmer/data_binding/table_items_binding.rb

Summary

Maintainability
D
2 days
Test Coverage
A
97%

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

      def call(*args)
        options = args.last.is_a?(Hash) ? args.pop : {}
        internal_sort = options[:internal_sort] || false
        new_model_collection = args.first
        Glimmer::SWT::DisplayProxy.instance.auto_exec(override_sync_exec: @model_binding.binding_options[:sync_exec], override_async_exec: @model_binding.binding_options[:async_exec]) do
Severity: Minor
Found in lib/glimmer/data_binding/table_items_binding.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

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

      def update_table_item_properties_from_model(table_item, row_index, column_index, model, model_attribute)
        Glimmer::SWT::DisplayProxy.instance.sync_exec do
          old_table_item_values = @last_model_collection_attribute_values &&
            @last_model_collection_attribute_values[row_index] &&
            model_attribute_values_for_index(@last_model_collection_attribute_values[row_index], column_index)
Severity: Minor
Found in lib/glimmer/data_binding/table_items_binding.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

Method same_table_data? has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
Open

      def same_table_data?(new_model_collection)
        (["text"] + TABLE_ITEM_PROPERTIES).all? do |table_item_property|
          table_cells = @table.swt_widget.items.map do |item|
            model = item.get_data
            @table.column_properties.each_with_index.map do |column_property, i|
Severity: Minor
Found in lib/glimmer/data_binding/table_items_binding.rb - About 2 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

Method call has 59 lines of code (exceeds 25 allowed). Consider refactoring.
Open

      def call(*args)
        options = args.last.is_a?(Hash) ? args.pop : {}
        internal_sort = options[:internal_sort] || false
        new_model_collection = args.first
        Glimmer::SWT::DisplayProxy.instance.auto_exec(override_sync_exec: @model_binding.binding_options[:sync_exec], override_async_exec: @model_binding.binding_options[:async_exec]) do
Severity: Major
Found in lib/glimmer/data_binding/table_items_binding.rb - About 2 hrs to fix

    Method same_table_data? has 29 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

          def same_table_data?(new_model_collection)
            (["text"] + TABLE_ITEM_PROPERTIES).all? do |table_item_property|
              table_cells = @table.swt_widget.items.map do |item|
                model = item.get_data
                @table.column_properties.each_with_index.map do |column_property, i|
    Severity: Minor
    Found in lib/glimmer/data_binding/table_items_binding.rb - About 1 hr to fix

      Method populate_table has 27 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

            def populate_table(model_collection, parent, column_properties, internal_sort: false)
              selected_table_item_models = parent.swt_widget.getSelection.map(&:get_data)
              parent.finish_edit!
              dispose_start_index = @last_model_collection_attribute_values &&
                                    (model_collection.count < @last_model_collection_attribute_values.count) &&
      Severity: Minor
      Found in lib/glimmer/data_binding/table_items_binding.rb - About 1 hr to fix

        Method update_table_item_properties_from_model has 5 arguments (exceeds 4 allowed). Consider refactoring.
        Open

              def update_table_item_properties_from_model(table_item, row_index, column_index, model, model_attribute)
        Severity: Minor
        Found in lib/glimmer/data_binding/table_items_binding.rb - About 35 mins to fix

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

                def populate_table(model_collection, parent, column_properties, internal_sort: false)
                  selected_table_item_models = parent.swt_widget.getSelection.map(&:get_data)
                  parent.finish_edit!
                  dispose_start_index = @last_model_collection_attribute_values &&
                                        (model_collection.count < @last_model_collection_attribute_values.count) &&
          Severity: Minor
          Found in lib/glimmer/data_binding/table_items_binding.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

          There are no issues that match your filters.

          Category
          Status