fog/fog-openstack

View on GitHub

Showing 156 of 616 total issues

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

        def get_template_contents(template_file)
          Fog::Logger.debug("get_template_contents [#{template_file}]")

          raise "template_file should be Hash or String, not #{template_file.class.name}" unless
            template_file.kind_of?(String) || template_file.kind_of?(Hash)
Severity: Minor
Found in lib/fog/openstack/orchestration/util/recursive_hot_file_loader.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 new has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

      def self.new(args = {})
        @openstack_auth_uri = URI.parse(args[:openstack_auth_url]) if args[:openstack_auth_url]
        if inspect == 'Fog::OpenStack::Image'
          service = Fog::OpenStack::Image::V2.new(args) unless args.empty?
          service ||= Fog::OpenStack::Image::V1.new(args)
Severity: Minor
Found in lib/fog/openstack/image.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 set_microversion has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def set_microversion
        @microversion_key          ||= 'Openstack-API-Version'.freeze
        @microversion_service_type ||= @openstack_service_type.first

        @microversion = Fog::OpenStack.get_supported_microversion(
Severity: Minor
Found in lib/fog/openstack/core.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 list_meters has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

        def list_meters(options = [])
          data = {
            'q' => []
          }

Severity: Minor
Found in lib/fog/openstack/metering/requests/list_meters.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 create_subnet_pool has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

        def create_subnet_pool(name, prefixes, options = {})
          response = Excon::Response.new
          response.status = 201
          data = {
            'id'                => Fog::Mock.random_numbers(6).to_s,
Severity: Minor
Found in lib/fog/openstack/network/requests/create_subnet_pool.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_samples has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

        def get_samples(meter_id, options = [], limit = 10000000)
          data = {
            'q' => []
          }

Severity: Minor
Found in lib/fog/openstack/metering/requests/get_samples.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 url_join has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

        def url_join(prefix, suffix)
          if prefix
            # URI.join replaces prefix parts before a
            #  trailing slash. See https://docs.ruby-lang.org/en/2.3.0/URI.html.
            prefix += '/' unless prefix.to_s.end_with?("/")
Severity: Minor
Found in lib/fog/openstack/orchestration/util/recursive_hot_file_loader.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 list_tenants has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

          def list_tenants(options = nil, marker = nil)
            if options.kind_of?(Hash)
              params = options
            else
              Fog::Logger.deprecation('Calling OpenStack[:identity].list_tenants(limit, marker) is deprecated, use'\
Severity: Minor
Found in lib/fog/openstack/identity/v2/requests/list_tenants.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 list_events has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

        def list_events(options = [])
          data = {
            'q' => []
          }

Severity: Minor
Found in lib/fog/openstack/metering/requests/list_events.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 create_router has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

        def create_router(name, options = {})
          data = {
            'router' => {
              'name' => name,
            }
Severity: Minor
Found in lib/fog/openstack/network/requests/create_router.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 data has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

          def self.data
            @users ||= {}
            @roles ||= {}
            @tenants ||= {}
            @ec2_credentials ||= Hash.new { |hash, key| hash[key] = {} }
Severity: Minor
Found in lib/fog/openstack/identity/v2.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 list_events has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

        def list_events(options = [])
          data = {
            'q' => []
          }

Severity: Minor
Found in lib/fog/openstack/event/requests/list_events.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 default_options has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

        def default_options
          template_content =
            if template && template.kind_of?(Fog::OpenStack::Orchestration::Template)
              template.content
            else
Severity: Minor
Found in lib/fog/openstack/orchestration/models/stack.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 list_usages has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

        def list_usages(date_start = nil, date_end = nil, detailed = false)
          params = {}
          params[:start] = date_start.iso8601.gsub(/\+.*/, '') if date_start
          params[:end]   = date_end.iso8601.gsub(/\+.*/, '')   if date_end
          params[:detailed] = (detailed ? '1' : '0')           if detailed
Severity: Minor
Found in lib/fog/openstack/compute/requests/list_usages.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 has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

        def get(key, options = {})
          data = service.get_container(key, options)
          directory = new(:key => key)
          for key, value in data.headers
            if ['X-Container-Bytes-Used', 'X-Container-Object-Count'].include?(key)
Severity: Minor
Found in lib/fog/openstack/storage/models/directories.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 list_recordsets has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

          def list_recordsets(zone_id = nil, options = {})
            # for backward compatability: consider removing the zone_id param (breaking change)
            unless zone_id.nil?
              if zone_id.kind_of?(Hash)
                options = zone_id
Severity: Minor
Found in lib/fog/openstack/dns/v2/requests/list_recordsets.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