mtortonesi/sisfc

View on GitHub
lib/sisfc/simulation.rb

Summary

Maintainability
D
2 days
Test Coverage

Method evaluate_allocation has a Cognitive Complexity of 81 (exceeds 5 allowed). Consider refactoring.
Open

    def evaluate_allocation(vm_allocation)
      # TODO: allow to define which feasibility controls to run in simulation
      # configuration. Here we hardcode a simple feasibility check: fail unless
      # there is at least one vm for each software component.
      @configuration.service_component_types.each do |sc_id,_|
Severity: Minor
Found in lib/sisfc/simulation.rb - About 1 day 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 evaluate_allocation has 193 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def evaluate_allocation(vm_allocation)
      # TODO: allow to define which feasibility controls to run in simulation
      # configuration. Here we hardcode a simple feasibility check: fail unless
      # there is at least one vm for each software component.
      @configuration.service_component_types.each do |sc_id,_|
Severity: Major
Found in lib/sisfc/simulation.rb - About 7 hrs to fix

    Avoid deeply nested control flow statements.
    Open

                      if new_vm
                        # need to update data_center_id of request
                        req.data_center_id = dc.dcid
    
                        # keep track of transmission time
    Severity: Major
    Found in lib/sisfc/simulation.rb - About 45 mins to fix

      There are no issues that match your filters.

      Category
      Status