HewlettPackard/oneview-sdk-ruby

View on GitHub

Showing 116 of 225 total issues

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

      def utilization(queryParameters = {})
        ensure_client && ensure_uri
        uri = "#{@data['uri']}/utilization?"

        queryParameters[:endDate]   = convert_time(queryParameters[:endDate])
Severity: Minor
Found in lib/oneview-sdk/resource/api200/enclosure.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 add has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

        def self.add(client, file_path, data_options, timeout = OneviewSDK::Rest::READ_TIMEOUT)
          data_options = Hash[data_options.map { |k, v| [k.to_s, v] }] # Convert symbols hash keys to string
          raise InvalidFormat, 'ERROR: File with extension not supported!' unless ACCEPTED_FORMATS.include? File.extname(file_path)
          raise IncompleteResource, 'Please set the name of the golden image!' unless data_options['name']
          raise IncompleteResource, 'Please set the description of the golden image!' unless data_options['description']
Severity: Minor
Found in lib/oneview-sdk/image-streamer/resource/api300/golden_image.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 add_uplink has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def add_uplink(bay, port, type = nil, enclosure_index = 1)
        enclosure_index = type && type.include?('Virtual Connect SE 16Gb FC Module for Synergy') ? -1 : enclosure_index
        port = if type
                 fetch_relative_value_of(port, type)
               else
Severity: Minor
Found in lib/oneview-sdk/resource/api200/lig_uplink_set.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 resource_named has a Cognitive Complexity of 6 (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)
Severity: Minor
Found in lib/oneview-sdk/resource/api200.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 initialize has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def initialize(client, params = {}, api_ver = nil)
        super
        # Default values:
        @data['enclosureType'] ||= 'C7000'
        @data['state'] ||= 'Active'
Severity: Minor
Found in lib/oneview-sdk/resource/api200/logical_interconnect_group.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 appliance_api_version has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def appliance_api_version
      options = { 'Content-Type' => :none, 'X-API-Version' => :none, 'auth' => :none }
      response = rest_api(:get, '/rest/version', options)
      version = response_handler(response)['currentVersion']
      raise ConnectionError, "Couldn't get API version" unless version
Severity: Minor
Found in lib/oneview-sdk/client.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 add_interconnect has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

        def add_interconnect(bay, type, enclosure_index = 1)
          parse_interconnect_map_template(bay, enclosure_index)
          @data['interconnectMapTemplate']['interconnectMapEntryTemplates'].each do |entry|
            entry['logicalLocation']['locationEntries'].each do |location|
              if location['type'] == 'Bay' && location['relativeValue'] == bay

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

      def utilization(queryParameters = {})
        ensure_client && ensure_uri
        uri = "#{@data['uri']}/utilization?"

        queryParameters[:endDate]   = convert_time(queryParameters[:endDate])
Severity: Minor
Found in lib/oneview-sdk/resource/api200/server_hardware.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 utilization has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def utilization(queryParameters = {})
        ensure_client && ensure_uri
        uri = "#{@data['uri']}/utilization?"

        queryParameters[:endDate]   = convert_time(queryParameters[:endDate])
Severity: Minor
Found in lib/oneview-sdk/resource/api200/power_device.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 initialize has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def initialize(client, params = {}, api_ver = nil)
        super
        # Default values:
        @data['logicalPortConfigInfos'] ||= []
        @data['lacpTimer'] ||= 'Short' unless @data['networkType'] == 'FibreChannel' # FibreChannel does not need set up lacpTimer
Severity: Minor
Found in lib/oneview-sdk/resource/api200/lig_uplink_set.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 add_volume_attachment has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def add_volume_attachment(volume, attachment_options = {})
        raise IncompleteResource, 'Volume not found!' unless volume.retrieve!
        # Convert symbols keys to string
        attachment_options = Hash[attachment_options.map { |k, v| [k.to_s, v] }]
        self['sanStorage'] ||= {}
Severity: Minor
Found in lib/oneview-sdk/resource/api200/server_profile.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 get_available_storage_system has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def self.get_available_storage_system(client, query = nil)
        # For storage_system the query requires the ID instead the URI
        if query && query['storage_system']
          query['storage_system'].retrieve! unless query['storage_system']['uri']
          query['storage_system_id'] = query['storage_system']['uri'].split('/').last
Severity: Minor
Found in lib/oneview-sdk/resource/api200/server_profile.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 appliance_i3s_api_version has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def appliance_i3s_api_version
        options = { 'Content-Type' => :none, 'X-API-Version' => :none, 'auth' => :none }
        response = rest_api(:get, '/rest/version', options)
        version = response_handler(response)['currentVersion']
        raise ConnectionError, "Couldn't get API version" unless version
Severity: Minor
Found in lib/oneview-sdk/image-streamer/client.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 initialize has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def initialize(client, params = {}, api_ver = nil)
      raise InvalidClient, 'Must specify a valid client'\
        unless client.is_a?(OneviewSDK::Client) || client.is_a?(OneviewSDK::ImageStreamer::Client)
      @client = client
      @logger = @client.logger
Severity: Minor
Found in lib/oneview-sdk/resource.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 search has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def search(type)
      resource_class = parse_type(type)
      client_setup
      filter = parse_hash(options['filter'])
      matches = resource_class.find_by(@client, filter)
Severity: Minor
Found in lib/oneview-sdk/cli.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 remove_volume_attachment has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def remove_volume_attachment(id)
        self['sanStorage'] ||= {}
        self['sanStorage']['volumeAttachments'] ||= []
        return if self['sanStorage'].empty? || self['sanStorage']['volumeAttachments'].empty?

Severity: Minor
Found in lib/oneview-sdk/resource/api200/server_profile_template.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