HewlettPackard/oneview-puppet

View on GitHub

Showing 92 of 92 total issues

Method prepare_environment has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

def prepare_environment
  data = resource['data'] || {}
  data.each do |key, value|
    data[key] = nil if value == 'nil'
    data[key] = false if value == 'false'
Severity: Minor
Found in lib/puppet/provider/common.rb - About 55 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 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 and 1 other location - About 50 mins to fix
lib/puppet/provider/oneview_switch/synergy.rb on lines 40..50

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

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 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 and 1 other location - About 50 mins to fix
lib/puppet/provider/oneview_switch/c7000.rb on lines 42..52

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

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

  desc "Oneview's Unmanaged Device"

  # :nocov:
  ensurable do
    defaultvalues
Severity: Major
Found in lib/puppet/type/oneview_unmanaged_device.rb and 3 other locations - About 45 mins to fix
lib/puppet/type/oneview_drive_enclosure.rb on lines 18..43
lib/puppet/type/oneview_logical_downlink.rb on lines 18..42
lib/puppet/type/oneview_network_set.rb on lines 18..42

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

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

  desc "OneView's Drive Enclosure"

  ensurable do
    defaultvalues

Severity: Major
Found in lib/puppet/type/oneview_drive_enclosure.rb and 3 other locations - About 45 mins to fix
lib/puppet/type/oneview_logical_downlink.rb on lines 18..42
lib/puppet/type/oneview_network_set.rb on lines 18..42
lib/puppet/type/oneview_unmanaged_device.rb on lines 18..40

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

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

  desc "Oneview's Network Set"

  # :nocov:
  ensurable do
    defaultvalues
Severity: Major
Found in lib/puppet/type/oneview_network_set.rb and 3 other locations - About 45 mins to fix
lib/puppet/type/oneview_drive_enclosure.rb on lines 18..43
lib/puppet/type/oneview_logical_downlink.rb on lines 18..42
lib/puppet/type/oneview_unmanaged_device.rb on lines 18..40

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

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

  desc "Oneview's Logical Downlink"

  # :nocov:
  ensurable do
    defaultvalues
Severity: Major
Found in lib/puppet/type/oneview_logical_downlink.rb and 3 other locations - About 45 mins to fix
lib/puppet/type/oneview_drive_enclosure.rb on lines 18..43
lib/puppet/type/oneview_network_set.rb on lines 18..42
lib/puppet/type/oneview_unmanaged_device.rb on lines 18..40

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

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

  def artifacts_uri_parse(artifacts_key)
    artifacts_list ||= resource['data'][artifacts_key]
    return unless artifacts_list
    resource_name = artifacts_key[0].capitalize + artifacts_key[1..-2]
    artifacts_list.each do |artifact|
Severity: Minor
Found in lib/puppet/provider/image_streamer_artifact_bundle/image_streamer.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 network_parse has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

def network_parse(connections)
  connections.each do |network|
    next if network['networkUri'].to_s[0..6].include?('/rest/')
    type = case network['functionType']
           when 'Ethernet' then 'EthernetNetwork'
Severity: Minor
Found in lib/puppet/provider/common.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 get_snapshot has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

  def get_snapshot
    snapshot_parameters ||= @data.delete('snapshotParameters')
    if snapshot_parameters
      raise 'A snapshot Parameter "name" is required when the snapshotParameters is used for this operation' unless
        snapshot_parameters['name']
Severity: Minor
Found in lib/puppet/provider/oneview_volume/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 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 find_for_server_profile has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

  def find_for_server_profile
    unless @data['name']
      raise "A 'name' tag must be specified within data, containing the server profile name and/or server profile name/volume name "\
        'to find a specific storage volume attachment'
    end
Severity: Minor
Found in lib/puppet/provider/oneview_volume_attachment/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 create has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

  def create
    raise 'A "poolName" or "name" tag is required within data for this operation' unless @data['name']
    return unless setup_for_recreation
    # Changes name into poolName which is required only for creation
    @data['poolName'] = @data.delete('name') if @data['name']
Severity: Minor
Found in lib/puppet/provider/oneview_storage_pool/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 variable_assignments has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

  def variable_assignments
    @refresh_options = @data.delete('refreshOptions') if @data['refreshOptions']
    @power_state = @data.delete('powerState') if @data['powerState']
    @uid_state = @data.delete('uidState') if @data['uidState']
    @query_parameters = @data.delete('queryParameters') if @data['queryParameters']
Severity: Minor
Found in lib/puppet/provider/oneview_power_device/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 create has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

  def create
    raise 'A "publicAttributes" or "sanPolicy" attribute is required to be set within data for this operation' unless
       @data['publicAttributes'] || @data['sanPolicy']
    public_attributes = @data.delete('publicAttributes')
    san_policy = @data.delete('sanPolicy')
Severity: Minor
Found in lib/puppet/provider/oneview_managed_san/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 data_parse_for_general has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

  def data_parse_for_general
    %w(from op path value).each { |key| @patch_tags[key] = @data.delete(key) if @data[key] }
    @data['name'] = @data.delete('hostname') if @data['hostname']
    @data.each_key do |key|
      case key
Severity: Minor
Found in lib/puppet/provider/oneview_server_hardware/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

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

  desc "Oneview's Server Hardware Type"

  ensurable do
    defaultvalues
    # :nocov:
Severity: Minor
Found in lib/puppet/type/oneview_server_hardware_type.rb and 1 other location - About 40 mins to fix
lib/puppet/type/oneview_san_manager.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 38.

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 SAN Manager"

  ensurable do
    defaultvalues
    # :nocov:
Severity: Minor
Found in lib/puppet/type/oneview_san_manager.rb and 1 other location - About 40 mins to fix
lib/puppet/type/oneview_server_hardware_type.rb on lines 18..39

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

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 OS Deployment plan"

  ensurable do
    defaultvalues

Severity: Major
Found in lib/puppet/type/oneview_os_deployment_plan.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_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 SAS Logical Interconnect Group"

  #:nocov:
  ensurable do
    defaultvalues
Severity: Major
Found in lib/puppet/type/oneview_sas_logical_interconnect_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_logical_switch_group.rb on lines 18..37
lib/puppet/type/oneview_os_deployment_plan.rb on lines 18..38
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

Severity
Category
Status
Source
Language