HewlettPackard/oneview-sdk-ruby

View on GitHub

Showing 116 of 225 total issues

Method resource_named has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    def self.resource_named(type, variant = @variant)
      raise "API1000 variant '#{variant}' is not supported! Try one of #{SUPPORTED_VARIANTS}" unless SUPPORTED_VARIANTS.include?(variant.to_s)
      new_type = type.to_s.downcase.gsub(/[ -_]/, '')
      api_module = OneviewSDK::API1000.const_get(variant)
      api_module.constants.each do |c|
Severity: Minor
Found in lib/oneview-sdk/resource/api1000.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 resource_named has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    def self.resource_named(type, variant = @variant)
      raise "API800 variant '#{variant}' is not supported! Try one of #{SUPPORTED_VARIANTS}" unless SUPPORTED_VARIANTS.include?(variant.to_s)
      new_type = type.to_s.downcase.gsub(/[ -_]/, '')
      api_module = OneviewSDK::API800.const_get(variant)
      api_module.constants.each do |c|
Severity: Minor
Found in lib/oneview-sdk/resource/api800.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 resource_named has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    def self.resource_named(type, variant = @variant)
      raise "API500 variant '#{variant}' is not supported! Try one of #{SUPPORTED_VARIANTS}" unless SUPPORTED_VARIANTS.include?(variant.to_s)
      new_type = type.to_s.downcase.gsub(/[ -_]/, '')
      api_module = OneviewSDK::API500.const_get(variant)
      api_module.constants.each do |c|
Severity: Minor
Found in lib/oneview-sdk/resource/api500.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 resource_named has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    def self.resource_named(type, variant = @variant)
      raise "API1800 variant '#{variant}' is not supported! Try one of #{SUPPORTED_VARIANTS}" unless SUPPORTED_VARIANTS.include?(variant.to_s)
      new_type = type.to_s.downcase.gsub(/[ -_]/, '')
      api_module = OneviewSDK::API1800.const_get(variant)
      api_module.constants.each do |c|
Severity: Minor
Found in lib/oneview-sdk/resource/api1800.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 resource_named has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    def self.resource_named(type, variant = @variant)
      raise "API2000 variant '#{variant}' is not supported! Try one of #{SUPPORTED_VARIANTS}" unless SUPPORTED_VARIANTS.include?(variant.to_s)
      new_type = type.to_s.downcase.gsub(/[ -_]/, '')
      api_module = OneviewSDK::API2000.const_get(variant)
      api_module.constants.each do |c|
Severity: Minor
Found in lib/oneview-sdk/resource/api2000.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 resource_named has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    def self.resource_named(type, variant = @variant)
      raise "API2400 variant '#{variant}' is not supported! Try one of #{SUPPORTED_VARIANTS}" unless SUPPORTED_VARIANTS.include?(variant.to_s)
      new_type = type.to_s.downcase.gsub(/[ -_]/, '')
      api_module = OneviewSDK::API2400.const_get(variant)
      api_module.constants.each do |c|
Severity: Minor
Found in lib/oneview-sdk/resource/api2400.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 resource_named has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    def self.resource_named(type, variant = @variant)
      raise "API3000 variant '#{variant}' is not supported! Try one of #{SUPPORTED_VARIANTS}" unless SUPPORTED_VARIANTS.include?(variant.to_s)
      new_type = type.to_s.downcase.gsub(/[ -_]/, '')
      api_module = OneviewSDK::API3000.const_get(variant)
      api_module.constants.each do |c|
Severity: Minor
Found in lib/oneview-sdk/resource/api3000.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 resource_named has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    def self.resource_named(type, variant = @variant)
      raise "API1200 variant '#{variant}' is not supported! Try one of #{SUPPORTED_VARIANTS}" unless SUPPORTED_VARIANTS.include?(variant.to_s)
      new_type = type.to_s.downcase.gsub(/[ -_]/, '')
      api_module = OneviewSDK::API1200.const_get(variant)
      api_module.constants.each do |c|
Severity: Minor
Found in lib/oneview-sdk/resource/api1200.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 initialize has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

      def initialize(argv, stdin = STDIN, stdout = STDOUT, stderr = STDERR, kernel = Kernel)
Severity: Minor
Found in lib/oneview-sdk/cli.rb - About 35 mins to fix

    Method rest_api has 5 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        def rest_api(type, path, options = {}, api_ver = @api_version, redirect_limit = 3)
    Severity: Minor
    Found in lib/oneview-sdk/rest.rb - About 35 mins to fix

      Method add has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

              def self.add(client, storage_system, volume_name, is_shareable = false, options = {})
      Severity: Minor
      Found in lib/oneview-sdk/resource/api500/c7000/volume.rb - About 35 mins to fix

        Method create_backup_from_file! has 5 arguments (exceeds 4 allowed). Consider refactoring.
        Open

                def self.create_backup_from_file!(client, deployment_group, file_path, artifact_name = nil, timeout = OneviewSDK::Rest::READ_TIMEOUT)
        Severity: Minor
        Found in lib/oneview-sdk/image-streamer/resource/api300/artifact_bundle.rb - About 35 mins to fix

          Method create_from_snapshot has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

                  def create_from_snapshot(snapshot_name, properties, volume_template = nil, is_permanent = true)
                    snapshot = get_snapshot(snapshot_name)
                    raise IncompleteResource, 'Snapshot not found!' unless snapshot
                    storage_pool_uri = nil
                    volume_template_uri = if volume_template.nil?
          Severity: Minor
          Found in lib/oneview-sdk/resource/api500/c7000/volume.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 resource_named has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

                def self.resource_named(type, _variant = nil)
                  new_type = type.to_s.downcase.gsub(/[ -_]/, '')
                  constants.each do |c|
                    klass = const_get(c)
                    next unless klass.is_a?(Class) && klass < OneviewSDK::Resource
          Severity: Minor
          Found in lib/oneview-sdk/image-streamer/resource/api2010.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_hardware has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

                def get_available_hardware
                  ensure_client
                  raise IncompleteResource, 'Must set @data[\'serverHardwareTypeUri\']' unless @data['serverHardwareTypeUri']
                  raise IncompleteResource, 'Must set @data[\'enclosureGroupUri\']' unless @data['enclosureGroupUri']
                  params = {
          Severity: Minor
          Found in lib/oneview-sdk/resource/api200/server_profile.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 resource_named has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

                def self.resource_named(type, _variant = nil)
                  new_type = type.to_s.downcase.gsub(/[ -_]/, '')
                  constants.each do |c|
                    klass = const_get(c)
                    next unless klass.is_a?(Class) && klass < OneviewSDK::Resource
          Severity: Minor
          Found in lib/oneview-sdk/image-streamer/resource/api500.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 resource_named has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

                def self.resource_named(type, _variant = nil)
                  new_type = type.to_s.downcase.gsub(/[ -_]/, '')
                  constants.each do |c|
                    klass = const_get(c)
                    next unless klass.is_a?(Class) && klass < OneviewSDK::Resource
          Severity: Minor
          Found in lib/oneview-sdk/image-streamer/resource/api1020.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_hardware has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

                def get_available_hardware
                  ensure_client
                  raise IncompleteResource, 'Must set @data[\'serverHardwareTypeUri\']' unless @data['serverHardwareTypeUri']
                  raise IncompleteResource, 'Must set @data[\'enclosureGroupUri\']' unless @data['enclosureGroupUri']
                  params = {
          Severity: Minor
          Found in lib/oneview-sdk/resource/api200/server_profile_template.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 resource_named has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

                def self.resource_named(type, _variant = nil)
                  new_type = type.to_s.downcase.gsub(/[ -_]/, '')
                  constants.each do |c|
                    klass = const_get(c)
                    next unless klass.is_a?(Class) && klass < OneviewSDK::Resource
          Severity: Minor
          Found in lib/oneview-sdk/image-streamer/resource/api1000.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 add_connection has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

                  def add_connection(network, connection_options = {})
                    connection_options = Hash[connection_options.map { |k, v| [k.to_s, v] }]
                    self['connectionSettings'] = {} unless self['connectionSettings']
                    self['connectionSettings']['connections'] = [] unless self['connectionSettings']['connections']
                    self['connectionSettings']['manageConnections'] = true
          Severity: Minor
          Found in lib/oneview-sdk/resource/api500/c7000/server_profile_template.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

          Severity
          Category
          Status
          Source
          Language