ManageIQ/manageiq-providers-azure

View on GitHub

Showing 6 of 66 total issues

Method perf_collect_metrics has a Cognitive Complexity of 44 (exceeds 11 allowed). Consider refactoring.
Open

  def perf_collect_metrics(interval_name, start_time = nil, end_time = nil)
    counters_by_mor = {}
    counter_values_by_mor = {}
    raise 'No EMS defined' unless ems

Severity: Minor
Found in app/models/manageiq/providers/azure/cloud_manager/metrics_capture.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 stacks_advanced_caching has a Cognitive Complexity of 23 (exceeds 11 allowed). Consider refactoring.
Open

  def stacks_advanced_caching(stacks, refs = nil)
    if enabled_deployments_caching
      db_stacks_timestamps              = {}
      db_stacks_primary_keys            = {}
      db_stacks_primary_keys_to_ems_ref = {}
Severity: Minor
Found in app/models/manageiq/providers/azure/inventory/collector.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 infer_related_stacks_ems_refs_api! has a Cognitive Complexity of 17 (exceeds 11 allowed). Consider refactoring.
Open

  def infer_related_stacks_ems_refs_api!
    # Get resource groups out of Stack references, we need them to fetch stacks
    references(:orchestration_stacks).each do |stack_ems_ref|
      resource_group_ems_ref = stack_ems_ref.split("/")[0..4].join("/")
      add_target!(:resource_groups, resource_group_ems_ref.downcase)

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_snapshot_delete has a Cognitive Complexity of 17 (exceeds 11 allowed). Consider refactoring.
Open

  def call_snapshot_delete
    _log.info("Enter")

    # TODO: remove snapshot here if Vm was running
    if context[:snapshot_mor]
Severity: Minor
Found in app/models/manageiq/providers/azure/cloud_manager/scanning/job.rb - About 1 hr 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 hardware_networks has a Cognitive Complexity of 13 (exceeds 11 allowed). Consider refactoring.
Open

  def hardware_networks(persister_hardware, instance)
    collector.instance_network_ports(instance).each do |nic_profile|
      nic_profile.properties.ip_configurations.each do |ipconfig|
        hostname        = ipconfig.name
        private_ip_addr = ipconfig.properties.try(:private_ip_address)
Severity: Minor
Found in app/models/manageiq/providers/azure/inventory/parser/cloud_manager.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 add_instance_disk has a Cognitive Complexity of 12 (exceeds 11 allowed). Consider refactoring.
Open

  def add_instance_disk(persister_hardware, instance, disk)
    if instance.managed_disk?
      disk_type     = 'managed'
      disk_location = disk.managed_disk.id
      managed_disk  = collector.instance_managed_disk(disk_location)
Severity: Minor
Found in app/models/manageiq/providers/azure/inventory/parser/cloud_manager.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