HewlettPackard/oneview-puppet

View on GitHub
lib/puppet/provider/oneview_logical_interconnect_group/c7000.rb

Summary

Maintainability
A
3 hrs
Test Coverage

Method set_network has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

  def set_network(uplink_set, network_type, network_uris)
    net_type = network_type == 'Ethernet' ? :EthernetNetwork : :FCNetwork
    net_class = OneviewSDK.resource_named(net_type, login[:api_version], login[:hardware_variant])
    network_uris.each do |network_uri|
      # Added a block to handle network uris in an uplinkset
Severity: Minor
Found in lib/puppet/provider/oneview_logical_interconnect_group/c7000.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 parse_internal_networks has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

  def parse_internal_networks
    list = []
    @internal_network_uris.each do |item|
      next if item.to_s[0..6].include?('/rest/')
      net = OneviewSDK.resource_named(:EthernetNetwork, login[:api_version], login[:hardware_variant]).find_by(@client, name: item)
Severity: Minor
Found in lib/puppet/provider/oneview_logical_interconnect_group/c7000.rb - About 45 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 exists? has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def exists?
    super
    # Assignments and helpers
    @interconnects = @data.delete('interconnects')
    @uplink_sets = @data.delete('uplinkSets')
Severity: Minor
Found in lib/puppet/provider/oneview_logical_interconnect_group/c7000.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 parse_uplink_sets has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def parse_uplink_sets
    api_version = login[:api_version]
    hardware_variant = login[:hardware_variant]
    lig = OneviewSDK.resource_named(:LogicalInterconnectGroup, api_version, hardware_variant).new(@client, {})
    @uplink_sets.each do |uplink_set_params|
Severity: Minor
Found in lib/puppet/provider/oneview_logical_interconnect_group/c7000.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

There are no issues that match your filters.

Category
Status