HewlettPackard/oneview-puppet

View on GitHub

Showing 92 of 92 total issues

Similar blocks of code found in 2 locations. Consider refactoring.
Open

Puppet::Type.type(:oneview_fc_network).provide :c7000, parent: Puppet::OneviewResource do
  desc 'Provider for OneView Fiber Channel Networks using the C7000 variant of the OneView API'

  confine feature: :oneview
  confine true: login[:hardware_variant] == 'C7000'
Severity: Major
Found in lib/puppet/provider/oneview_fc_network/c7000.rb and 1 other location - About 3 hrs to fix
lib/puppet/provider/oneview_fcoe_network/c7000.rb on lines 19..61

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 116.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

Puppet::Type.type(:oneview_fcoe_network).provide :c7000, parent: Puppet::OneviewResource do
  desc 'Provider for OneView Fiber Channel over Ethernet Networks using the C7000 variant of the OneView API'

  confine feature: :oneview
  confine true: login[:hardware_variant] == 'C7000'
Severity: Major
Found in lib/puppet/provider/oneview_fcoe_network/c7000.rb and 1 other location - About 3 hrs to fix
lib/puppet/provider/oneview_fc_network/c7000.rb on lines 19..61

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 116.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

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

Similar blocks of code found in 3 locations. Consider refactoring.
Open

  desc "Oneview's Interconnect"

  # :nocov:
  ensurable do
    defaultvalues
Severity: Major
Found in lib/puppet/type/oneview_interconnect.rb and 2 other locations - About 1 hr to fix
lib/puppet/type/oneview_power_device.rb on lines 18..60
lib/puppet/type/oneview_volume.rb on lines 18..63

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 66.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 3 locations. Consider refactoring.
Open

  desc "Oneview's Volume"

  ensurable do
    defaultvalues

Severity: Major
Found in lib/puppet/type/oneview_volume.rb and 2 other locations - About 1 hr to fix
lib/puppet/type/oneview_interconnect.rb on lines 18..63
lib/puppet/type/oneview_power_device.rb on lines 18..60

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 66.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 3 locations. Consider refactoring.
Open

  desc "Oneview's Power Device"

  # :nocov:
  ensurable do
    defaultvalues
Severity: Major
Found in lib/puppet/type/oneview_power_device.rb and 2 other locations - About 1 hr to fix
lib/puppet/type/oneview_interconnect.rb on lines 18..63
lib/puppet/type/oneview_volume.rb on lines 18..63

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 66.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Method bulk_delete_check has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

  def bulk_delete_check
    if @data['networkUris']
      list = []
      @data['networkUris'].each do |item|
        if item.to_s[0..6].include?('/rest/')
Severity: Minor
Found in lib/puppet/provider/oneview_fc_network/c7000.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 connections_parse has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

def connections_parse
  @data.each_key do |key|
    next unless @data[key].is_a?(Hash)
    next unless @data[key].include?('manageConnections')
    @data[key].each do |conn, value|
Severity: Minor
Found in lib/puppet/provider/common.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 bulk_delete_check has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

  def bulk_delete_check
    if @data['networkUris']
      list = []
      @data['networkUris'].each do |item|
        if item.to_s[0..6].include?('/rest/')
Severity: Minor
Found in lib/puppet/provider/oneview_ethernet_network/c7000.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 bulk_delete_check has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

  def bulk_delete_check
    if @data['networkUris']
      list = []
      @data['networkUris'].each do |item|
        if item.to_s[0..6].include?('/rest/')
Severity: Minor
Found in lib/puppet/provider/oneview_fcoe_network/c7000.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

Similar blocks of code found in 2 locations. Consider refactoring.
Open

  desc "Oneview's Logical Enclosure"

  ensurable do
    defaultvalues

Severity: Major
Found in lib/puppet/type/oneview_logical_enclosure.rb and 1 other location - About 1 hr to fix
lib/puppet/type/oneview_sas_logical_interconnect.rb on lines 18..57

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 61.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

  desc "Oneview's SAS Logical Interconnect"

  #:nocov:
  ensurable do
    defaultvalues
Severity: Major
Found in lib/puppet/type/oneview_sas_logical_interconnect.rb and 1 other location - About 1 hr to fix
lib/puppet/type/oneview_logical_enclosure.rb on lines 18..60

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 61.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Method helper_retrieve_vas has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

  def helper_retrieve_vas
    server_name, volume_name = @data['name'].split(',').map(&:strip)
    raise 'A server profile name has not been provided' unless server_name
    raise 'A volume name has not been provided' unless volume_name
    server_profile = OneviewSDK::ServerProfile.find_by(@client, name: server_name)
Severity: Minor
Found in lib/puppet/provider/oneview_volume_attachment/c7000.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 pd_uri_parser has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

  def pd_uri_parser
    return unless @data['powerConnections']
    @data['powerConnections'].each do |pc|
      next if pc['connectionUri']
      type = pc.delete('type')
Severity: Minor
Found in lib/puppet/provider/oneview_power_device/c7000.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 uri_set has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

  def uri_set(tag, type)
    network_uris = @data.delete(tag)
    return unless network_uris
    network_uris.each_with_index do |network_name, index|
      next if network_name.to_s[0..6].include?('/rest/')
Severity: Minor
Found in lib/puppet/provider/oneview_uplink_set/c7000.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 set_new_profile has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

  def set_new_profile
    server_profile = OneviewSDK::ServerProfile
    # lets the SDK set a default name in case the user has not declared one
    if @data['serverProfileName']
      sp_name = @data.delete('serverProfileName')
Severity: Minor
Found in lib/puppet/provider/oneview_server_profile_template/c7000.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 data_parse has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

  def data_parse
    @data['interconnectBayMappingCount'] = @data['interconnectBayMappingCount'].to_i if @data['interconnectBayMappingCount']
    return unless @data['interconnectBayMappings']
    @data['interconnectBayMappings'].each do |mapping_attr|
      mapping_attr['interconnectBay'] = mapping_attr['interconnectBay'].to_i
Severity: Minor
Found in lib/puppet/provider/oneview_enclosure_group/c7000.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

Similar blocks of code found in 2 locations. Consider refactoring.
Open

  desc "Oneview's Rack Bundle"

  ensurable do
    defaultvalues
    # :nocov:
Severity: Major
Found in lib/puppet/type/oneview_rack.rb and 1 other location - About 1 hr to fix
lib/puppet/type/oneview_managed_san.rb on lines 18..49

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 53.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

  desc "Oneview's managed_san Bundle"

  ensurable do
    defaultvalues
    # :nocov:
Severity: Major
Found in lib/puppet/type/oneview_managed_san.rb and 1 other location - About 1 hr to fix
lib/puppet/type/oneview_rack.rb on lines 20..51

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 53.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 5 locations. Consider refactoring.
Open

  desc "Oneview's Storage System"

  ensurable do
    defaultvalues

Severity: Major
Found in lib/puppet/type/oneview_storage_system.rb and 4 other locations - About 1 hr to fix
lib/puppet/type/oneview_ethernet_network.rb on lines 18..49
lib/puppet/type/oneview_logical_switch.rb on lines 18..50
lib/puppet/type/oneview_server_profile_template.rb on lines 18..51
lib/puppet/type/oneview_volume_template.rb on lines 18..53

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 51.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Severity
Category
Status
Source
Language