ashrithr/awscli

View on GitHub
lib/awscli/dynamo.rb

Summary

Maintainability
F
1 wk
Test Coverage

Method update has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring.
Open

      def update(options)
        opts = {}
        key = {}
        attribute_updates = {}
        #Build and validate key
Severity: Minor
Found in lib/awscli/dynamo.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 put has a Cognitive Complexity of 37 (exceeds 5 allowed). Consider refactoring.
Open

      def put(options)
        items = {}
        opts = {}
        options[:item].each do |item|
          abort "invalid item format: #{item}" unless item =~ /(.*):(N|S|NS|SS|B|BS):(.*)/
Severity: Minor
Found in lib/awscli/dynamo.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

File dynamo.rb has 390 lines of code (exceeds 250 allowed). Consider refactoring.
Open

module Awscli
  module DynamoDB
    class Table
      def initialize(connection)
        @conn = connection
Severity: Minor
Found in lib/awscli/dynamo.rb - About 5 hrs to fix

    Method delete has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring.
    Open

          def delete(options)
            key = {}
            opts = {}
            #Build and validate key
            abort 'Invalid --hash-key format' unless options[:hash_key] =~ /(N|S|NS|SS|B|BS):(.*)/
    Severity: Minor
    Found in lib/awscli/dynamo.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 scan has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
    Open

          def scan(options)
            opts = {}
            opts['AttributesToGet'] = options[:attrs_to_get] if options[:attrs_to_get]
            opts['Limit'] = options[:limit] if options[:limit]
            opts['ConsistentRead'] = options[:consistent_read] if options[:consistent_read]
    Severity: Minor
    Found in lib/awscli/dynamo.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 query has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
    Open

          def query(options)
            opts = {}
            hash_key_type, hash_key_value = options[:hash_key_value].split(',')
            hash_key = { hash_key_type => hash_key_value }
            opts['AttributesToGet'] = options[:attrs_to_get] if options[:attrs_to_get]
    Severity: Minor
    Found in lib/awscli/dynamo.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 batch_write has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
    Open

          def batch_write(options)
            request_items = {}
            #request_items['RequestItems'] = {}
            options[:put_requests] and options[:put_requests].each do |request|
              #table_name,col_name1:col_type1:col_value1,col_name2:col_type2:col_value2 ..
    Severity: Minor
    Found in lib/awscli/dynamo.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 has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
    Open

          def get(options)
            #get_item(table_name, key, options = {})
            opts = {}
            key = {}
            abort 'Invalid --hash-key format' unless options[:hash_key] =~ /(N|S|NS|SS|B|BS):(.*)/
    Severity: Minor
    Found in lib/awscli/dynamo.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 update has 46 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

          def update(options)
            opts = {}
            key = {}
            attribute_updates = {}
            #Build and validate key
    Severity: Minor
    Found in lib/awscli/dynamo.rb - About 1 hr to fix

      Method batch_write has 44 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

            def batch_write(options)
              request_items = {}
              #request_items['RequestItems'] = {}
              options[:put_requests] and options[:put_requests].each do |request|
                #table_name,col_name1:col_type1:col_value1,col_name2:col_type2:col_value2 ..
      Severity: Minor
      Found in lib/awscli/dynamo.rb - About 1 hr to fix

        Method create has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
        Open

              def create(options)
                key_schema, provisioned_throughput = {}, {}
                abort 'Invalid key type' unless %w(N NS S SS).include?(options[:pk_type])
                key_schema['HashKeyElement'] = {
                  'AttributeName' => options[:pk_name],
        Severity: Minor
        Found in lib/awscli/dynamo.rb - About 1 hr 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 batch_get has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
        Open

              def batch_get(options)
                request_items = {}
                map = options[:requests].zip(options[:attrs_to_get])
                map.each do |request_attrs_mapping|
                  #tbl1_name*,KeySet1(hash_key_type*=hash_key_value*:range_key_type=range_key_value),KeySet2,KeySetN
        Severity: Minor
        Found in lib/awscli/dynamo.rb - About 1 hr 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 put has 43 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

              def put(options)
                items = {}
                opts = {}
                options[:item].each do |item|
                  abort "invalid item format: #{item}" unless item =~ /(.*):(N|S|NS|SS|B|BS):(.*)/
        Severity: Minor
        Found in lib/awscli/dynamo.rb - About 1 hr to fix

          Method query has 38 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                def query(options)
                  opts = {}
                  hash_key_type, hash_key_value = options[:hash_key_value].split(',')
                  hash_key = { hash_key_type => hash_key_value }
                  opts['AttributesToGet'] = options[:attrs_to_get] if options[:attrs_to_get]
          Severity: Minor
          Found in lib/awscli/dynamo.rb - About 1 hr to fix

            Method delete has 37 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                  def delete(options)
                    key = {}
                    opts = {}
                    #Build and validate key
                    abort 'Invalid --hash-key format' unless options[:hash_key] =~ /(N|S|NS|SS|B|BS):(.*)/
            Severity: Minor
            Found in lib/awscli/dynamo.rb - About 1 hr to fix

              Method scan has 36 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                    def scan(options)
                      opts = {}
                      opts['AttributesToGet'] = options[:attrs_to_get] if options[:attrs_to_get]
                      opts['Limit'] = options[:limit] if options[:limit]
                      opts['ConsistentRead'] = options[:consistent_read] if options[:consistent_read]
              Severity: Minor
              Found in lib/awscli/dynamo.rb - About 1 hr to fix

                Method get has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                      def get(options)
                        #get_item(table_name, key, options = {})
                        opts = {}
                        key = {}
                        abort 'Invalid --hash-key format' unless options[:hash_key] =~ /(N|S|NS|SS|B|BS):(.*)/
                Severity: Minor
                Found in lib/awscli/dynamo.rb - About 1 hr to fix

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

                          if options[:expected_attr] #-a
                            expected_attr_name, expected_attr_type, expected_attr_value = options[:expected_attr].split(':')
                            if expected_attr_name and expected_attr_type and expected_attr_value
                              if options[:expected_exists] and options[:expected_exists] == 'true' #-a Id:S:001 -e true
                                opts['Expected'] = { expected_attr_name => { 'Value' => { expected_attr_type => expected_attr_value }, 'Exists' => options[:expected_exists] } }
                  Severity: Major
                  Found in lib/awscli/dynamo.rb and 2 other locations - About 2 hrs to fix
                  lib/awscli/dynamo.rb on lines 189..205
                  lib/awscli/dynamo.rb on lines 393..409

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

                  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

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

                          if options[:expected_attr] #-a
                            expected_attr_name, expected_attr_type, expected_attr_value = options[:expected_attr].split(':')
                            if expected_attr_name and expected_attr_type and expected_attr_value
                              if options[:expected_exists] and options[:expected_exists] == 'true' #-a Id:S:001 -e true
                                opts['Expected'] = { expected_attr_name => { 'Value' => { expected_attr_type => expected_attr_value }, 'Exists' => options[:expected_exists] } }
                  Severity: Major
                  Found in lib/awscli/dynamo.rb and 2 other locations - About 2 hrs to fix
                  lib/awscli/dynamo.rb on lines 352..368
                  lib/awscli/dynamo.rb on lines 393..409

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

                  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

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

                          if options[:expected_attr] #-e
                            expected_attr_name, expected_attr_type, expected_attr_value = options[:expected_attr].split(':')
                            if expected_attr_name and expected_attr_type and expected_attr_value
                              if options[:expected_exists] and options[:expected_exists] == 'true' #-e Id:S:001 -x true
                                opts['Expected'] = { expected_attr_name => { 'Value' => { expected_attr_type => expected_attr_value }, 'Exists' => options[:expected_exists] } }
                  Severity: Major
                  Found in lib/awscli/dynamo.rb and 2 other locations - About 2 hrs to fix
                  lib/awscli/dynamo.rb on lines 189..205
                  lib/awscli/dynamo.rb on lines 352..368

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

                  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

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

                          if options[:start_key]
                            opts['ExclusiveStartKey'] = {}
                            hash_key_type, hash_key_value = options[:start_key].split(',')
                            opts['ExclusiveStartKey']['HashKeyElement'] = { hash_key_type => hash_key_value }
                            if options[:start_range_key]
                  Severity: Major
                  Found in lib/awscli/dynamo.rb and 1 other location - About 1 hr to fix
                  lib/awscli/dynamo.rb on lines 99..105

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

                  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

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

                          if options[:start_key]
                            opts['ExclusiveStartKey'] = {}
                            hash_key_type, hash_key_value = options[:start_key].split(',')
                            opts['ExclusiveStartKey']['HashKeyElement'] = { hash_key_type => hash_key_value }
                            if options[:start_range_key]
                  Severity: Major
                  Found in lib/awscli/dynamo.rb and 1 other location - About 1 hr to fix
                  lib/awscli/dynamo.rb on lines 148..154

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

                  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

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

                          total_items = data.data[:body]['Count']
                          items = data.data[:body]['Items']
                          if not options[:count]
                            puts "Retrieved #{total_items} Items"
                            Formatador.display_table(items)
                  Severity: Major
                  Found in lib/awscli/dynamo.rb and 1 other location - About 1 hr to fix
                  lib/awscli/dynamo.rb on lines 161..169

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

                  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

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

                          total_items = data.data[:body]['Count']
                          items = data.data[:body]['Items']
                          if not options[:count]
                            puts "Retrieved #{total_items} Items"
                            Formatador.display_table(items)
                  Severity: Major
                  Found in lib/awscli/dynamo.rb and 1 other location - About 1 hr to fix
                  lib/awscli/dynamo.rb on lines 113..121

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

                  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

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

                          if options[:range_key]
                            abort 'Invalid --range-key format' unless options[:hash_key] =~ /(N|S|NS|SS|B|BS):(.*)/
                            range_key_type, range_key_name = options[:range_key].split(':')
                            key['RangeKeyElement'] = { range_key_type => range_key_name }
                  Severity: Minor
                  Found in lib/awscli/dynamo.rb and 2 other locations - About 25 mins to fix
                  lib/awscli/dynamo.rb on lines 337..340
                  lib/awscli/dynamo.rb on lines 388..391

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

                  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

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

                          if options[:range_key]
                            abort 'Invalid --range-key format' unless options[:hash_key] =~ /(N|S|NS|SS|B|BS):(.*)/
                            range_key_type, range_key_name = options[:range_key].split(':')
                            key['RangeKeyElement'] = { range_key_type => range_key_name }
                  Severity: Minor
                  Found in lib/awscli/dynamo.rb and 2 other locations - About 25 mins to fix
                  lib/awscli/dynamo.rb on lines 225..228
                  lib/awscli/dynamo.rb on lines 388..391

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

                  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

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

                          if options[:range_key]
                            abort 'Invalid --range-key format' unless options[:hash_key] =~ /(N|S|NS|SS|B|BS):(.*)/
                            range_key_type, range_key_name = options[:range_key].split(':')
                            key['RangeKeyElement'] = { range_key_type => range_key_name }
                  Severity: Minor
                  Found in lib/awscli/dynamo.rb and 2 other locations - About 25 mins to fix
                  lib/awscli/dynamo.rb on lines 225..228
                  lib/awscli/dynamo.rb on lines 337..340

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

                  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

                  There are no issues that match your filters.

                  Category
                  Status