Showing 1,218 of 1,218 total issues

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

          def end_element(name)
            if @in_tag_set
              case name
                when 'item'
                  @security_group['tagSet'][@tag['key']] = @tag['value']
Severity: Major
Found in lib/fog/aws/parsers/compute/describe_security_groups.rb - About 3 hrs to fix

    Class File has 28 methods (exceeds 20 allowed). Consider refactoring.
    Open

          class File < Fog::Model
            # @deprecated use {Fog::AWS::Storage::MIN_MULTIPART_CHUNK_SIZE} instead
            MIN_MULTIPART_CHUNK_SIZE = Fog::AWS::Storage::MIN_MULTIPART_CHUNK_SIZE
            # @deprecated use {Fog::AWS::Storage::MAX_SINGLE_PUT_SIZE} instead
            MAX_SINGLE_PUT_SIZE = Fog::AWS::Storage::MAX_SINGLE_PUT_SIZE
    Severity: Minor
    Found in lib/fog/aws/models/storage/file.rb - About 3 hrs to fix

      Method normalize_permissions has 82 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

              def normalize_permissions(options)
                normalized_permissions = []
                if options['SourceSecurityGroupName']
                  group_name = if options['SourceSecurityGroupName'] =~ /default_elb/
                                 "default"
      Severity: Major
      Found in lib/fog/aws/requests/compute/authorize_security_group_ingress.rb - About 3 hrs to fix

        Method tagged_resources has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
        Open

                def tagged_resources(resources)
                  Array(resources).map do |resource_id|
                    if match = resource_id.match(/^(\w+)-[a-z0-9]{8,17}/i)
                      id = match.captures.first
                    else
        Severity: Minor
        Found in lib/fog/aws/compute.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 23 (exceeds 5 allowed). Consider refactoring.
        Open

                  def end_element(name)
                    if @in_block_device_mapping
                      case name
                        when 'blockDeviceMapping'
                          @in_block_device_mapping = false
        Severity: Minor
        Found in lib/fog/aws/parsers/compute/describe_images.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 23 (exceeds 5 allowed). Consider refactoring.
        Open

                  def end_element(name)
                    if @in_entry_set
                      if @in_port_range
                        case name
                        when 'portRange'
        Severity: Minor
        Found in lib/fog/aws/parsers/compute/network_acl_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 describe_cache_security_groups has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
        Open

                def describe_cache_security_groups(name = nil, opts={})
                  if name
                    sec_group_set = [self.data[:security_groups][name]].compact
                    raise Fog::AWS::Elasticache::NotFound.new("Security Group #{name} not found") if sec_group_set.empty?
                  else
        Severity: Minor
        Found in lib/fog/aws/requests/elasticache/describe_cache_security_groups.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 receive_message has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
        Open

                def receive_message(queue_url, options = {})
                  Excon::Response.new.tap do |response|
                    if (queue = data[:queues][queue_url])
                      max_number_of_messages = options['MaxNumberOfMessages'] || 1
                      now = Time.now
        Severity: Minor
        Found in lib/fog/aws/requests/sqs/receive_message.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_subnet has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
        Open

                def create_subnet(vpcId, cidrBlock, options = {})
                  av_zone = options['AvailabilityZone'].nil? ? 'us-east-1c' : options['AvailabilityZone']
                  Excon::Response.new.tap do |response|
                    if cidrBlock && vpcId
                      vpc = self.data[:vpcs].find{ |v| v['vpcId'] == vpcId }
        Severity: Minor
        Found in lib/fog/aws/requests/compute/create_subnet.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

        File file.rb has 299 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        require 'fog/aws/models/storage/versions'
        
        module Fog
          module AWS
            class Storage
        Severity: Minor
        Found in lib/fog/aws/models/storage/file.rb - About 3 hrs to fix

          Method get_object has 79 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                  def get_object(bucket_name, object_name, options = {}, &block)
                    version_id = options.delete('versionId')
          
                    unless bucket_name
                      raise ArgumentError.new('bucket_name is required')
          Severity: Major
          Found in lib/fog/aws/requests/storage/get_object.rb - About 3 hrs to fix

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

              module AWS
                class RDS
                  class Real
                    require 'fog/aws/parsers/rds/describe_db_parameter_groups'
            
            
            Severity: Major
            Found in lib/fog/aws/requests/rds/describe_db_parameter_groups.rb and 2 other locations - About 3 hrs to fix
            lib/fog/aws/requests/elasticache/describe_cache_subnet_groups.rb on lines 2..54
            lib/fog/aws/requests/rds/describe_db_subnet_groups.rb on lines 2..54

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

            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 3 locations. Consider refactoring.
            Open

              module AWS
                class RDS
                  class Real
                    require 'fog/aws/parsers/rds/describe_db_subnet_groups'
            
            
            Severity: Major
            Found in lib/fog/aws/requests/rds/describe_db_subnet_groups.rb and 2 other locations - About 3 hrs to fix
            lib/fog/aws/requests/elasticache/describe_cache_subnet_groups.rb on lines 2..54
            lib/fog/aws/requests/rds/describe_db_parameter_groups.rb on lines 2..53

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

            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 3 locations. Consider refactoring.
            Open

              module AWS
                class Elasticache
                  class Real
                    require 'fog/aws/parsers/elasticache/describe_cache_subnet_groups'
            
            
            lib/fog/aws/requests/rds/describe_db_parameter_groups.rb on lines 2..53
            lib/fog/aws/requests/rds/describe_db_subnet_groups.rb on lines 2..54

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

            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

            File iam.rb has 297 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            module Fog
              module AWS
                class IAM < Fog::Service
                  extend Fog::AWS::CredentialFetcher::ServiceMethods
            
            
            Severity: Minor
            Found in lib/fog/aws/iam.rb - About 3 hrs to fix

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

                        def end_element(name)
                          if @in_tag_set
                            case name
                            when 'item'
                              @nic['tagSet'][@tag['key']] = @tag['value']
              Severity: Minor
              Found in lib/fog/aws/parsers/compute/network_interface_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 create_load_balancer has a Cognitive Complexity of 22 (exceeds 5 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: Minor
              Found in lib/fog/aws/requests/elb/create_load_balancer.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

                module Parsers
                  module AWS
                    module ELB
                      # parses an XML-formatted list of resource tags from AWS
                      class TagListParser < Fog::Parsers::Base
              Severity: Major
              Found in lib/fog/aws/parsers/elb/tag_list_parser.rb and 1 other location - About 3 hrs to fix
              lib/fog/aws/parsers/elbv2/describe_tags.rb on lines 2..46

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

              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 Parsers
                  module AWS
                    module ELBV2
                      class DescribeTags < Fog::Parsers::Base
                        def reset
              Severity: Major
              Found in lib/fog/aws/parsers/elbv2/describe_tags.rb and 1 other location - About 3 hrs to fix
              lib/fog/aws/parsers/elb/tag_list_parser.rb on lines 2..49

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

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

                        def end_element(name)
                          case name
                          when 'member'
                            if @in_availability_zones
                              @auto_scaling_group['AvailabilityZones'] << value
              Severity: Major
              Found in lib/fog/aws/parsers/auto_scaling/describe_auto_scaling_groups.rb - About 3 hrs to fix
                Severity
                Category
                Status
                Source
                Language