Showing 1,218 of 1,218 total issues

Method _request has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
Open

        def _request(scheme, host, port, params, original_params, &block)
          connection(scheme, host, port).request(params, &block)
        rescue Excon::Errors::MovedPermanently, Excon::Errors::TemporaryRedirect => error
          headers = (error.response.is_a?(Hash) ? error.response[:headers] : error.response.headers)
          new_params = {}
Severity: Minor
Found in lib/fog/aws/storage.rb - About 2 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 AWS
    class AutoScaling
      class Real
        require 'fog/aws/parsers/auto_scaling/basic'

lib/fog/aws/requests/auto_scaling/attach_load_balancer_target_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 100.

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 AutoScaling
      class Real
        require 'fog/aws/parsers/auto_scaling/basic'

lib/fog/aws/requests/auto_scaling/detach_load_balancer_target_groups.rb on lines 2..52

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

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 fetch_credentials has 68 lines of code (exceeds 25 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: Major
Found in lib/fog/aws/credential_fetcher.rb - About 2 hrs to fix

    Method associate_address has 68 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

            def associate_address(*args)
              if args.first.kind_of? Hash
                params = args.first
              else
                params = {
    Severity: Major
    Found in lib/fog/aws/requests/compute/associate_address.rb - About 2 hrs to fix

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

        module AWS
          class IAM
            class Real
              require 'fog/aws/parsers/iam/get_group_policy'
      
      
      Severity: Major
      Found in lib/fog/aws/requests/iam/get_group_policy.rb and 1 other location - About 2 hrs to fix
      lib/fog/aws/requests/iam/get_user_policy.rb on lines 2..45

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

      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 IAM
            class Real
              require 'fog/aws/parsers/iam/get_user_policy'
      
      
      Severity: Major
      Found in lib/fog/aws/requests/iam/get_user_policy.rb and 1 other location - About 2 hrs to fix
      lib/fog/aws/requests/iam/get_group_policy.rb on lines 2..45

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

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

                def end_element(name)
                  case name
                  when 'AutoMinorVersionUpgrade', 'CacheClusterId',
                    'CacheClusterStatus', 'CacheNodeType', 'Engine',
                    'PreferredAvailabilityZone', 'PreferredMaintenanceWindow'
      Severity: Major
      Found in lib/fog/aws/parsers/elasticache/cache_cluster_parser.rb - About 2 hrs to fix

        Method create_volume has 67 lines of code (exceeds 25 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: Major
        Found in lib/fog/aws/requests/compute/create_volume.rb - About 2 hrs to fix

          Method end_element has 66 lines of code (exceeds 25 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: Major
          Found in lib/fog/aws/parsers/cloud_formation/describe_change_set.rb - About 2 hrs to fix

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

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

              Method put_bucket_lifecycle has 66 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                      def put_bucket_lifecycle(bucket_name, lifecycle)
                        builder = Nokogiri::XML::Builder.new do
                          LifecycleConfiguration {
                            lifecycle['Rules'].each do |rule|
                              Rule {
              Severity: Major
              Found in lib/fog/aws/requests/storage/put_bucket_lifecycle.rb - About 2 hrs to fix

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

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

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

                            def end_element(name)
                              if @in_default_actions
                                case name
                                when 'member'
                                  if @in_target_groups
                  Severity: Major
                  Found in lib/fog/aws/parsers/elbv2/describe_listeners.rb - About 2 hrs to fix

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

                              def end_element(name)
                                case name
                                when 'member'
                                  if @in_policy_names && @in_listeners
                                    @listener_description['PolicyNames'] << value
                    Severity: Minor
                    Found in lib/fog/aws/parsers/elb/describe_load_balancers.rb - About 2 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 19 (exceeds 5 allowed). Consider refactoring.
                    Open

                              def end_element(name)
                                case name
                                when 'amiLaunchIndex'
                                  @instance[name] = value.to_i
                                when 'arn'
                    Severity: Minor
                    Found in lib/fog/aws/parsers/compute/describe_instances.rb - About 2 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_load_balancers has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
                    Open

                            def describe_load_balancers(options = {})
                              unless options.is_a?(Hash)
                                Fog::Logger.deprecation("describe_load_balancers with #{options.class} is deprecated, use all('LoadBalancerNames' => []) instead [light_black](#{caller.first})[/]")
                                options = { 'LoadBalancerNames' => [options].flatten }
                              end
                    Severity: Minor
                    Found in lib/fog/aws/requests/elb/describe_load_balancers.rb - About 2 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 revoke_db_security_group_ingress has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
                    Open

                            def revoke_db_security_group_ingress(name, opts = {})
                              unless opts.key?('CIDRIP') || ((opts.key?('EC2SecurityGroupName') || opts.key?('EC2SecurityGroupId')) && opts.key?('EC2SecurityGroupOwnerId'))
                                raise ArgumentError, 'Must specify CIDRIP, or one of EC2SecurityGroupName or EC2SecurityGroupId, and EC2SecurityGroupOwnerId'
                              end
                    
                    
                    Severity: Minor
                    Found in lib/fog/aws/requests/rds/revoke_db_security_group_ingress.rb - About 2 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 has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
                    Open

                            def get_bucket(bucket_name, options = {})
                              prefix, marker, delimiter, max_keys = \
                                options['prefix'], options['marker'], options['delimiter'], options['max-keys']
                              common_prefixes = []
                    
                    
                    Severity: Minor
                    Found in lib/fog/aws/requests/storage/get_bucket.rb - About 2 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_spot_instances has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
                    Open

                            def request_spot_instances(image_id, instance_type, spot_price, options = {})
                              response = Excon::Response.new
                              id       = Fog::AWS::Mock.spot_instance_request_id
                    
                              if (image_id && instance_type && spot_price)
                    Severity: Minor
                    Found in lib/fog/aws/requests/compute/request_spot_instances.rb - About 2 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

                    Severity
                    Category
                    Status
                    Source
                    Language