Showing 1,218 of 1,218 total issues

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

  module AWS
    class IAM
      class Real
        require 'fog/aws/parsers/iam/list_managed_policies'

Severity: Major
Found in lib/fog/aws/requests/iam/list_attached_group_policies.rb and 1 other location - About 5 hrs to fix
lib/fog/aws/requests/iam/list_attached_role_policies.rb on lines 2..84

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

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 RDS
      class Real
        require 'fog/aws/parsers/rds/describe_db_cluster_snapshots'

Severity: Major
Found in lib/fog/aws/requests/rds/describe_db_cluster_snapshots.rb and 1 other location - About 5 hrs to fix
lib/fog/aws/requests/rds/describe_db_snapshots.rb on lines 2..62

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

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 RDS
      class Real
        require 'fog/aws/parsers/rds/describe_db_snapshots'

Severity: Major
Found in lib/fog/aws/requests/rds/describe_db_snapshots.rb and 1 other location - About 5 hrs to fix
lib/fog/aws/requests/rds/describe_db_cluster_snapshots.rb on lines 2..61

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

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

      def self.change_resource_record_sets_data(zone_id, change_batch, version, options = {})
        # AWS methods return zone_ids that looks like '/hostedzone/id'.  Let the caller either use
        # that form or just the actual id (which is what this request needs)
        zone_id = zone_id.sub('/hostedzone/', '')

Severity: Minor
Found in lib/fog/aws/dns.rb - About 5 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_volume has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring.
Open

        def create_volume(availability_zone, size, options = {})
          unless options.is_a?(Hash)
            Fog::Logger.deprecation("create_volume with a bare snapshot_id is deprecated, use create_volume(availability_zone, size, 'SnapshotId' => snapshot_id) instead [light_black](#{caller.first})[/]")
            options = { 'SnapshotId' => options }
          end
Severity: Minor
Found in lib/fog/aws/requests/compute/create_volume.rb - About 5 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_instances has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring.
Open

        def describe_instances(filters = {})
          unless filters.is_a?(Hash)
            Fog::Logger.deprecation("describe_instances with #{filters.class} param is deprecated, use describe_instances('instance-id' => []) instead [light_black](#{caller.first})[/]")
            filters = {'instance-id' => [*filters]}
          end
Severity: Minor
Found in lib/fog/aws/requests/compute/describe_instances.rb - About 5 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

Class Mock has 38 methods (exceeds 20 allowed). Consider refactoring.
Open

    class Mock
      def self.arn(vendor, account_id, path, region = nil)
        "arn:aws:#{vendor}:#{region}:#{account_id}:#{path}"
      end

Severity: Minor
Found in lib/fog/aws/mock.rb - About 5 hrs to fix

    Method delete_attributes has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring.
    Open

            def delete_attributes(domain_name, item_name, attributes = nil)
              response = Excon::Response.new
              if self.data[:domains][domain_name]
                if self.data[:domains][domain_name][item_name]
                  if attributes
    Severity: Minor
    Found in lib/fog/aws/requests/simpledb/delete_attributes.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

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

            def authorize_security_group_ingress(group_name, options = {})
              options = Fog::AWS.parse_security_group_options(group_name, options)
    
              group = if options.key?('GroupName')
                        self.data[:security_groups].values.find { |v| v['groupName'] == options['GroupName'] }
    lib/fog/aws/requests/compute/authorize_security_group_egress.rb on lines 58..101

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

    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

            def authorize_security_group_egress(group_name, options = {})
              options = Fog::AWS.parse_security_group_options(group_name, options)
    
              group = if options.key?('GroupName')
                        self.data[:security_groups].values.find { |v| v['groupName'] == options['GroupName'] }
    lib/fog/aws/requests/compute/authorize_security_group_ingress.rb on lines 88..131

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

    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 run_instances has 112 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

            def run_instances(image_id, min_count, max_count, options = {})
              response = Excon::Response.new
              response.status = 200
    
              group_set = [ (options['SecurityGroup'] || 'default') ].flatten
    Severity: Major
    Found in lib/fog/aws/requests/compute/run_instances.rb - About 4 hrs to fix

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

                def end_element(name)
                  if @context.last == 'BootstrapActions'
                    case name
                    when 'Name'
                      @bootstrap_actions[name] = value
      Severity: Minor
      Found in lib/fog/aws/parsers/emr/describe_job_flows.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

      Class LoadBalancer has 34 methods (exceeds 20 allowed). Consider refactoring.
      Open

            class LoadBalancer < Fog::Model
              identity  :id,                    :aliases => 'LoadBalancerName'
              attribute :availability_zones,    :aliases => 'AvailabilityZones'
              attribute :created_at,            :aliases => 'CreatedTime'
              attribute :dns_name,              :aliases => 'DNSName'
      Severity: Minor
      Found in lib/fog/aws/models/elb/load_balancer.rb - About 4 hrs to fix

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

                  def end_element(name)
                    case name
        
                    when 'LatestRestorableTime', 'InstanceCreateTime'
                      @db_instance[name] = Time.parse value
        Severity: Major
        Found in lib/fog/aws/parsers/rds/db_parser.rb - About 4 hrs to fix

          Method create_load_balancer has 107 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                  def create_load_balancer(availability_zones, lb_name, listeners = [], options = {})
                    response = Excon::Response.new
                    response.status = 200
          
                    raise Fog::AWS::ELB::IdentifierTaken if self.data[:load_balancers].key? lb_name
          Severity: Major
          Found in lib/fog/aws/requests/elb/create_load_balancer.rb - About 4 hrs to fix

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

                      def end_element(name)
                        if @in_instanceType
                          case name
                          when 'value'
                            @response['instanceType'] = value
            Severity: Major
            Found in lib/fog/aws/parsers/compute/describe_instance_attribute.rb - About 4 hrs to fix

              Method data has 105 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                      def self.data
                        @data ||= Hash.new do |hash, region|
                          hash[region] = Hash.new do |region_hash, key|
                            owner_id = Fog::AWS::Mock.owner_id
                            security_group_id = Fog::AWS::Mock.security_group_id
              Severity: Major
              Found in lib/fog/aws/compute.rb - About 4 hrs to fix

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

                  module AWS
                    class Compute
                      class Real
                        require 'fog/aws/parsers/compute/basic'
                
                
                Severity: Major
                Found in lib/fog/aws/requests/compute/revoke_security_group_egress.rb and 1 other location - About 4 hrs to fix
                lib/fog/aws/requests/compute/revoke_security_group_ingress.rb on lines 2..86

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

                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 Compute
                      class Real
                        require 'fog/aws/parsers/compute/basic'
                
                
                lib/fog/aws/requests/compute/revoke_security_group_egress.rb on lines 2..87

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

                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 create_db_instance has 104 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                        def create_db_instance(db_name, options={})
                          response = Excon::Response.new
                          if self.data[:servers] and self.data[:servers][db_name]
                            # I don't know how to raise an exception that contains the excon data
                            #response.status = 400
                Severity: Major
                Found in lib/fog/aws/requests/rds/create_db_instance.rb - About 4 hrs to fix
                  Severity
                  Category
                  Status
                  Source
                  Language