HewlettPackard/oneview-puppet

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

Summary

Maintainability
A
50 mins
Test Coverage

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

Method exists? has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def exists?
    prepare_environment
    empty_data_check
    %w(from op path value).each { |key| @patch_tags[key] = @data.delete(key) if @data[key] }
    %w(hostname username password).each { |key| @authentication[key] = @data.delete(key) if @data[key] }
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

There are no issues that match your filters.

Category
Status