HewlettPackard/oneview-puppet

View on GitHub

Showing 92 of 92 total issues

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

  desc "Oneview's Uplink Set"

  ensurable do
    defaultvalues

Severity: Major
Found in lib/puppet/type/oneview_uplink_set.rb and 8 other locations - About 35 mins to fix
lib/puppet/type/oneview_fc_network.rb on lines 18..38
lib/puppet/type/oneview_fcoe_network.rb on lines 18..37
lib/puppet/type/oneview_firmware_driver.rb on lines 18..38
lib/puppet/type/oneview_hypervisor_cluster_profile.rb on lines 18..35
lib/puppet/type/oneview_hypervisor_manager.rb on lines 18..34
lib/puppet/type/oneview_logical_switch_group.rb on lines 18..37
lib/puppet/type/oneview_os_deployment_plan.rb on lines 18..38
lib/puppet/type/oneview_sas_logical_interconnect_group.rb on lines 18..37

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 36.

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 9 locations. Consider refactoring.
Open

  desc "Oneview's FCoE network"

  # :nocov:
  ensurable do
    defaultvalues
Severity: Major
Found in lib/puppet/type/oneview_fcoe_network.rb and 8 other locations - About 35 mins to fix
lib/puppet/type/oneview_fc_network.rb on lines 18..38
lib/puppet/type/oneview_firmware_driver.rb on lines 18..38
lib/puppet/type/oneview_hypervisor_cluster_profile.rb on lines 18..35
lib/puppet/type/oneview_hypervisor_manager.rb on lines 18..34
lib/puppet/type/oneview_logical_switch_group.rb on lines 18..37
lib/puppet/type/oneview_os_deployment_plan.rb on lines 18..38
lib/puppet/type/oneview_sas_logical_interconnect_group.rb on lines 18..37
lib/puppet/type/oneview_uplink_set.rb on lines 18..38

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 36.

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 9 locations. Consider refactoring.
Open

  desc "Oneview's Hypervisor Cluster Profile"
  ensurable do
    defaultvalues
    # :nocov:
    # Get Methods
Severity: Major
Found in lib/puppet/type/oneview_hypervisor_cluster_profile.rb and 8 other locations - About 35 mins to fix
lib/puppet/type/oneview_fc_network.rb on lines 18..38
lib/puppet/type/oneview_fcoe_network.rb on lines 18..37
lib/puppet/type/oneview_firmware_driver.rb on lines 18..38
lib/puppet/type/oneview_hypervisor_manager.rb on lines 18..34
lib/puppet/type/oneview_logical_switch_group.rb on lines 18..37
lib/puppet/type/oneview_os_deployment_plan.rb on lines 18..38
lib/puppet/type/oneview_sas_logical_interconnect_group.rb on lines 18..37
lib/puppet/type/oneview_uplink_set.rb on lines 18..38

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 36.

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 9 locations. Consider refactoring.
Open

  desc "Oneview's FC network"

  # :nocov:
  # Get methods
  ensurable do
Severity: Major
Found in lib/puppet/type/oneview_fc_network.rb and 8 other locations - About 35 mins to fix
lib/puppet/type/oneview_fcoe_network.rb on lines 18..37
lib/puppet/type/oneview_firmware_driver.rb on lines 18..38
lib/puppet/type/oneview_hypervisor_cluster_profile.rb on lines 18..35
lib/puppet/type/oneview_hypervisor_manager.rb on lines 18..34
lib/puppet/type/oneview_logical_switch_group.rb on lines 18..37
lib/puppet/type/oneview_os_deployment_plan.rb on lines 18..38
lib/puppet/type/oneview_sas_logical_interconnect_group.rb on lines 18..37
lib/puppet/type/oneview_uplink_set.rb on lines 18..38

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 36.

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 9 locations. Consider refactoring.
Open

  desc "Oneview's Hypervisor Manager"
  # :nocov:
  # Get methods
  ensurable do
    defaultvalues
Severity: Major
Found in lib/puppet/type/oneview_hypervisor_manager.rb and 8 other locations - About 35 mins to fix
lib/puppet/type/oneview_fc_network.rb on lines 18..38
lib/puppet/type/oneview_fcoe_network.rb on lines 18..37
lib/puppet/type/oneview_firmware_driver.rb on lines 18..38
lib/puppet/type/oneview_hypervisor_cluster_profile.rb on lines 18..35
lib/puppet/type/oneview_logical_switch_group.rb on lines 18..37
lib/puppet/type/oneview_os_deployment_plan.rb on lines 18..38
lib/puppet/type/oneview_sas_logical_interconnect_group.rb on lines 18..37
lib/puppet/type/oneview_uplink_set.rb on lines 18..38

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 36.

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 9 locations. Consider refactoring.
Open

  desc "Oneview's Logical Switch Group"

  # :nocov:
  ensurable do
    defaultvalues
Severity: Major
Found in lib/puppet/type/oneview_logical_switch_group.rb and 8 other locations - About 35 mins to fix
lib/puppet/type/oneview_fc_network.rb on lines 18..38
lib/puppet/type/oneview_fcoe_network.rb on lines 18..37
lib/puppet/type/oneview_firmware_driver.rb on lines 18..38
lib/puppet/type/oneview_hypervisor_cluster_profile.rb on lines 18..35
lib/puppet/type/oneview_hypervisor_manager.rb on lines 18..34
lib/puppet/type/oneview_os_deployment_plan.rb on lines 18..38
lib/puppet/type/oneview_sas_logical_interconnect_group.rb on lines 18..37
lib/puppet/type/oneview_uplink_set.rb on lines 18..38

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 36.

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 9 locations. Consider refactoring.
Open

  desc "Oneview's Firmware Driver"

  ensurable do
    defaultvalues
    # :nocov:
Severity: Major
Found in lib/puppet/type/oneview_firmware_driver.rb and 8 other locations - About 35 mins to fix
lib/puppet/type/oneview_fc_network.rb on lines 18..38
lib/puppet/type/oneview_fcoe_network.rb on lines 18..37
lib/puppet/type/oneview_hypervisor_cluster_profile.rb on lines 18..35
lib/puppet/type/oneview_hypervisor_manager.rb on lines 18..34
lib/puppet/type/oneview_logical_switch_group.rb on lines 18..37
lib/puppet/type/oneview_os_deployment_plan.rb on lines 18..38
lib/puppet/type/oneview_sas_logical_interconnect_group.rb on lines 18..37
lib/puppet/type/oneview_uplink_set.rb on lines 18..38

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 36.

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

  def create
    return patch unless @patch_tags.empty?
    return true if resource_update
    @data = @data.merge(@authentication)
    @data['hostname'] = @data.delete('name') if @data['name']
Severity: Minor
Found in lib/puppet/provider/oneview_server_hardware/c7000.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 parameter_check has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def parameter_check(res)
    return unless res
    Puppet.debug res
    set_scope_uri if resource['data']['query_parameters'].key?('scopeUris')
    set_networks  if resource['data']['query_parameters'].key?('networks')
Severity: Minor
Found in lib/puppet/provider/oneview_volume_template/c7000.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 network_uris has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def network_uris
    return unless @data['networkUris']
    list = []
    Puppet.debug("\n\nAPI VERSION: #{api_version} and \nRESOURCE VARIANT: #{resource_variant} \n")
    @data['networkUris'].each do |item|
Severity: Minor
Found in lib/puppet/provider/oneview_network_set/c7000.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 delete_snapshot has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def delete_snapshot
    raise 'A "snapshotParameters" tag is required to be set within data for this operation.' unless @data['snapshotParameters']
    snapshot_parameters ||= @data.delete('snapshotParameters')
    raise 'A "name" tag is required to be set within snapshotParameters for this operation.' unless snapshot_parameters['name']
    get_single_resource_instance.delete_snapshot(snapshot_parameters['name'])
Severity: Minor
Found in lib/puppet/provider/oneview_volume/c7000.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 set_power_state_validation has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def set_power_state_validation
    raise 'A "power_state" specified in data is required for this action.' unless @data['power_state']
    power_state = @data.delete('power_state')
    raise 'Invalid power_state specified in data. Valid values are "On" or "Off"' unless
      power_state.casecmp('off').zero? || power_state.casecmp('on').zero?
Severity: Minor
Found in lib/puppet/provider/oneview_server_hardware/c7000.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 get_type has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def get_type
    if @data['name']
      Puppet.notice "\n\n Search for switch type #{@data['name']} started, displaying results bellow:\n"
      results = @resource_type.get_type(@client, @data['name'])
      raise "\n\n No switch types corresponding to the name #{@data['name']} were found.\n" unless results
Severity: Minor
Found in lib/puppet/provider/oneview_switch/synergy.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 get_available_storage_system has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def get_available_storage_system
    Puppet.notice("\n\nServer Profile Available Storage System\n")
    raise 'You must specify query attributes for this ensure method' unless @query
    query_ok = @query['enclosureGroupUri'] && @query['storageSystemId'] && @query['serverHardwareTypeUri']
    raise 'You must specify the following query attributes: enclosureGroupUri, serverHardwareTypeUri and storageSystemId.' unless query_ok
Severity: Minor
Found in lib/puppet/provider/oneview_server_profile/c7000.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 get_type has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def get_type
    if @data['name']
      Puppet.notice "\n\n Search for switch type #{@data['name']} started, displaying results bellow:\n"
      results = @resource_type.get_type(@client, @data['name'])
      raise "\n\n No switch types corresponding to the name #{@data['name']} were found.\n" unless results
Severity: Minor
Found in lib/puppet/provider/oneview_switch/c7000.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

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

  def set_firmware
    Puppet.notice('Updating Firmware...')
    command = @firmware_options.delete('command')
    fw_uri = @firmware_options.delete('sspUri')
    fw_object = OneviewSDK::FirmwareDriver.find_by(@client, uri: fw_uri)
Severity: Minor
Found in lib/puppet/provider/oneview_logical_interconnect/c7000.rb and 1 other location - About 30 mins to fix
lib/puppet/provider/oneview_sas_logical_interconnect/synergy.rb on lines 65..72

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 33.

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

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

  def set_firmware
    Puppet.notice('Updating Firmware...')
    command = @firmware_options.delete('command')
    fw_uri = @firmware_options.delete('sspUri')
    fw_object = OneviewSDK::FirmwareDriver.find_by(@client, uri: fw_uri)
Severity: Minor
Found in lib/puppet/provider/oneview_sas_logical_interconnect/synergy.rb and 1 other location - About 30 mins to fix
lib/puppet/provider/oneview_logical_interconnect/c7000.rb on lines 156..163

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 33.

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(:image_streamer_plan_script).provide :image_streamer, parent: Puppet::ImageStreamerResource do
  desc 'Provider for Image Streamer Plan Scripts using the Image Streamer API'

  confine feature: :oneview

lib/puppet/provider/image_streamer_deployment_plan/image_streamer.rb on lines 19..33

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 31.

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(:image_streamer_deployment_plan).provide :image_streamer, parent: Puppet::ImageStreamerResource do
  desc 'Provider for Image Streamer Deployment Plan using the Image Streamer API'

  confine feature: :oneview

lib/puppet/provider/image_streamer_plan_script/image_streamer.rb on lines 19..33

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 31.

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 patch_enclosure has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def patch_enclosure
    raise 'The "from" tag is not supported by the current version of the ruby sdk' if @patch_tags['from']
    raise 'The "op", "path" and "value" tags are required together when used for this operation.' unless
      @patch_tags['op'] && @patch_tags['path'] && @patch_tags['value']
    enclosure = get_single_resource_instance
Severity: Minor
Found in lib/puppet/provider/oneview_enclosure/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

Severity
Category
Status
Source
Language