HewlettPackard/oneview-puppet

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

Summary

Maintainability
A
1 hr
Test Coverage

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

There are no issues that match your filters.

Category
Status