Showing 1,218 of 1,218 total issues

Method create_network_interface has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
Open

        def create_network_interface(subnetId, options = {})
          response = Excon::Response.new
          if subnetId
            subnet = self.data[:subnets].find{ |s| s['subnetId'] == subnetId }
            if subnet.nil?
Severity: Minor
Found in lib/fog/aws/requests/compute/create_network_interface.rb - About 4 hrs 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 fetch_credentials has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
Open

        def fetch_credentials(options)
          if options[:use_iam_profile] && Fog.mocking?
            return Fog::AWS::Compute::Mock.data[:iam_role_based_creds]
          end
          if options[:use_iam_profile]
Severity: Minor
Found in lib/fog/aws/credential_fetcher.rb - About 3 hrs 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 end_element has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
Open

          def end_element(name)
            case name

            when 'LatestRestorableTime', 'InstanceCreateTime'
              @db_instance[name] = Time.parse value
Severity: Minor
Found in lib/fog/aws/parsers/rds/db_parser.rb - About 3 hrs 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_bucket_object_versions has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
Open

        def get_bucket_object_versions(bucket_name, options = {})
          delimiter, key_marker, max_keys, prefix, version_id_marker = \
            options['delimiter'], options['key-marker'], options['max-keys'],options['prefix'],options['version-id-marker']

          unless bucket_name
Severity: Minor
Found in lib/fog/aws/requests/storage/get_bucket_object_versions.rb - About 3 hrs 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 describe_db_instances has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
Open

        def describe_db_instances(identifier=nil, opts={})
          response = Excon::Response.new
          server_set = []
          if identifier
            if specified_server = self.data[:servers][identifier]
Severity: Minor
Found in lib/fog/aws/requests/rds/describe_db_instances.rb - About 3 hrs 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_security_group has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
Open

        def delete_security_group(name, id = nil)
          if name == 'default'
            raise Fog::AWS::Compute::Error.new("InvalidGroup.Reserved => The security group 'default' is reserved")
          end

Severity: Minor
Found in lib/fog/aws/requests/compute/delete_security_group.rb - About 3 hrs 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 request_params has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
Open

        def request_params(params)
          headers  = params[:headers] || {}

          if params[:scheme]
            scheme = params[:scheme]
Severity: Minor
Found in lib/fog/aws/storage.rb - About 3 hrs 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_health_check has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
Open

        def create_health_check(ip_address, port, type, options = {})
          version = @version
          builder = Nokogiri::XML::Builder.new(:encoding => 'UTF-8') do |xml|
            xml.CreateHealthCheckRequest(:xmlns => "https://route53.amazonaws.com/doc/#{version}/") do
              xml.CallerReference options[:caller_reference] || "#{Time.now.to_i.to_s}-#{SecureRandom.hex(6)}"
Severity: Minor
Found in lib/fog/aws/requests/dns/create_health_check.rb - About 3 hrs 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 end_element has 90 lines of code (exceeds 25 allowed). Consider refactoring.
Open

          def end_element(name)
            case name
            when 'amiLaunchIndex'
              @instance[name] = value.to_i
            when 'arn'
Severity: Major
Found in lib/fog/aws/parsers/compute/describe_instances.rb - About 3 hrs to fix

    Method end_element has 90 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

              def end_element(name)
                if @context.last == 'BootstrapActions'
                  case name
                  when 'Name'
                    @bootstrap_actions[name] = value
    Severity: Major
    Found in lib/fog/aws/parsers/emr/describe_job_flows.rb - About 3 hrs to fix

      Method end_element has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
      Open

                def end_element(name)
                  case name
                  when 'ChangeSetId', 'ChangeSetName', 'Description', 'ExecutionStatus', 'StackId', 'StackName', 'StatusReason', 'Status'
                    @response[name] = value
                  when 'CreationTime'
      Severity: Minor
      Found in lib/fog/aws/parsers/cloud_formation/describe_change_set.rb - About 3 hrs 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 hash_to_acl has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
      Open

              def self.hash_to_acl(acl)
                data =  "<AccessControlPolicy>\n"
      
                if acl['Owner'] && (acl['Owner']['ID'] || acl['Owner']['DisplayName'])
                  data << "  <Owner>\n"
      Severity: Minor
      Found in lib/fog/aws/requests/storage/acl_utils.rb - About 3 hrs 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 byte_ranges has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
      Open

              def byte_ranges(http_range, size)
                # See <http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.35>
                return nil unless http_range
                ranges = []
                http_range.split(/,\s*/).each do |range_spec|
      Severity: Minor
      Found in lib/fog/aws/requests/storage/get_object.rb - About 3 hrs 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_object_helper has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
      Open

              def delete_object_helper(bucket, object_name, version_id)
                response = { 'Deleted' => {} }
                if bucket[:versioning]
                  bucket[:objects][object_name] ||= []
      
      
      Severity: Minor
      Found in lib/fog/aws/requests/storage/delete_multiple_objects.rb - About 3 hrs 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 end_element has 89 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

                def end_element(name)
                  case name
                  when 'member'
                    if @in_policy_names && @in_listeners
                      @listener_description['PolicyNames'] << value
      Severity: Major
      Found in lib/fog/aws/parsers/elb/describe_load_balancers.rb - About 3 hrs to fix

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

          module AWS
            class Redshift
              class Real
                require 'fog/aws/parsers/redshift/describe_events'
        
        
        Severity: Major
        Found in lib/fog/aws/requests/redshift/describe_events.rb and 1 other location - About 3 hrs to fix
        lib/fog/aws/requests/redshift/describe_cluster_snapshots.rb on lines 2..67

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 122.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

          module AWS
            class Redshift
              class Real
                require 'fog/aws/parsers/redshift/describe_cluster_snapshots'
        
        
        Severity: Major
        Found in lib/fog/aws/requests/redshift/describe_cluster_snapshots.rb and 1 other location - About 3 hrs to fix
        lib/fog/aws/requests/redshift/describe_events.rb on lines 2..74

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 122.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Method end_element has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
        Open

                  def end_element(name)
                    if @in_description
                      case name
                      when 'value'
                        @response['description'] = value
        Severity: Minor
        Found in lib/fog/aws/parsers/compute/describe_image_attribute.rb - About 3 hrs 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

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

              class Real
                require 'fog/aws/parsers/cdn/streaming_distribution'
        
                # Create a new streaming distribution in CloudFront.
                #
        Severity: Major
        Found in lib/fog/aws/requests/cdn/post_streaming_distribution.rb and 1 other location - About 3 hrs to fix
        lib/fog/aws/requests/cdn/post_distribution.rb on lines 4..81

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 119.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

              class Real
                require 'fog/aws/parsers/cdn/distribution'
        
                # Create a new distribution in CloudFront.
                #
        Severity: Major
        Found in lib/fog/aws/requests/cdn/post_distribution.rb and 1 other location - About 3 hrs to fix
        lib/fog/aws/requests/cdn/post_streaming_distribution.rb on lines 4..68

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 119.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Severity
        Category
        Status
        Source
        Language