ManageIQ/inventory_refresh

View on GitHub
lib/inventory_refresh/inventory_collection.rb

Summary

Maintainability
C
1 day
Test Coverage
A
95%

Class InventoryCollection has 46 methods (exceeds 20 allowed). Consider refactoring.
Open

  class InventoryCollection
    # @return [Boolean] A true value marks that we collected all the data of the InventoryCollection,
    #         meaning we also collected all the references.
    attr_accessor :data_collection_finalized

Severity: Minor
Found in lib/inventory_refresh/inventory_collection.rb - About 6 hrs to fix

File inventory_collection.rb has 344 lines of code (exceeds 250 allowed). Consider refactoring.
Open

require "inventory_refresh/inventory_collection/builder"
require "inventory_refresh/inventory_collection/data_storage"
require "inventory_refresh/inventory_collection/index/proxy"
require "inventory_refresh/inventory_collection/reference"
require "inventory_refresh/inventory_collection/references_storage"
Severity: Minor
Found in lib/inventory_refresh/inventory_collection.rb - About 4 hrs to fix

Method initialize has 35 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def initialize(properties = {})
      init_basic_properties(properties[:association],
                            properties[:model_class],
                            properties[:name],
                            properties[:parent])
Severity: Minor
Found in lib/inventory_refresh/inventory_collection.rb - About 1 hr to fix

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

    def db_collection_for_comparison
      if targeted?
        if targeted_arel.respond_to?(:call)
          targeted_arel.call(self)
        elsif parent_inventory_collections.present?
Severity: Minor
Found in lib/inventory_refresh/inventory_collection.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

Use filter_map instead.
Open

                            :resource_counter].collect do |col|
        col if supports_column?(col)
      end.compact

Use filter_map instead.
Open

      @internal_timestamp_columns = %i[created_at created_on updated_at updated_on].collect do |timestamp_col|
        timestamp_col if supports_column?(timestamp_col)
      end.compact

There are no issues that match your filters.

Category
Status