saltstack/salt

View on GitHub
salt/states/boto_ec2.py

Summary

Maintainability
F
3 wks
Test Coverage

File boto_ec2.py has 1538 lines of code (exceeds 250 allowed). Consider refactoring.
Open

# -*- coding: utf-8 -*-
'''
Manage EC2

.. versionadded:: 2015.8.0
Severity: Major
Found in salt/states/boto_ec2.py - About 4 days to fix

    Function instance_present has a Cognitive Complexity of 165 (exceeds 5 allowed). Consider refactoring.
    Open

    def instance_present(name, instance_name=None, instance_id=None, image_id=None,
                         image_name=None, tags=None, key_name=None,
                         security_groups=None, user_data=None, instance_type=None,
                         placement=None, kernel_id=None, ramdisk_id=None,
                         vpc_id=None, vpc_name=None, monitoring_enabled=None,
    Severity: Minor
    Found in salt/states/boto_ec2.py - About 3 days 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

    Function eni_present has a Cognitive Complexity of 104 (exceeds 5 allowed). Consider refactoring.
    Open

    def eni_present(
            name,
            subnet_id=None,
            subnet_name=None,
            private_ip_address=None,
    Severity: Minor
    Found in salt/states/boto_ec2.py - About 2 days 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

    Cyclomatic complexity is too high in function instance_present. (67)
    Open

    def instance_present(name, instance_name=None, instance_id=None, image_id=None,
                         image_name=None, tags=None, key_name=None,
                         security_groups=None, user_data=None, instance_type=None,
                         placement=None, kernel_id=None, ramdisk_id=None,
                         vpc_id=None, vpc_name=None, monitoring_enabled=None,
    Severity: Minor
    Found in salt/states/boto_ec2.py by radon

    Cyclomatic Complexity

    Cyclomatic Complexity corresponds to the number of decisions a block of code contains plus 1. This number (also called McCabe number) is equal to the number of linearly independent paths through the code. This number can be used as a guide when testing conditional logic in blocks.

    Radon analyzes the AST tree of a Python program to compute Cyclomatic Complexity. Statements have the following effects on Cyclomatic Complexity:

    Construct Effect on CC Reasoning
    if +1 An if statement is a single decision.
    elif +1 The elif statement adds another decision.
    else +0 The else statement does not cause a new decision. The decision is at the if.
    for +1 There is a decision at the start of the loop.
    while +1 There is a decision at the while statement.
    except +1 Each except branch adds a new conditional path of execution.
    finally +0 The finally block is unconditionally executed.
    with +1 The with statement roughly corresponds to a try/except block (see PEP 343 for details).
    assert +1 The assert statement internally roughly equals a conditional statement.
    Comprehension +1 A list/set/dict comprehension of generator expression is equivalent to a for loop.
    Boolean Operator +1 Every boolean operator (and, or) adds a decision point.

    Source: http://radon.readthedocs.org/en/latest/intro.html

    Function private_ips_absent has a Cognitive Complexity of 42 (exceeds 5 allowed). Consider refactoring.
    Open

    def private_ips_absent(name, network_interface_name=None, network_interface_id=None,
                           private_ip_addresses=None, region=None, key=None, keyid=None, profile=None):
    
        '''
        Ensure an ENI does not have secondary private ip addresses associated with it
    Severity: Minor
    Found in salt/states/boto_ec2.py - About 6 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

    Function volume_present has a Cognitive Complexity of 40 (exceeds 5 allowed). Consider refactoring.
    Open

    def volume_present(name, volume_name=None, volume_id=None, instance_name=None,
                       instance_id=None, device=None, size=None, snapshot_id=None,
                       volume_type=None, iops=None, encrypted=False, kms_key_id=None,
                       region=None, key=None, keyid=None, profile=None):
        '''
    Severity: Minor
    Found in salt/states/boto_ec2.py - About 6 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

    Function instance_absent has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring.
    Open

    def instance_absent(name, instance_name=None, instance_id=None,
                        release_eip=False, region=None, key=None, keyid=None,
                        profile=None, filters=None):
        '''
        Ensure an EC2 instance does not exist (is stopped and removed).
    Severity: Minor
    Found in salt/states/boto_ec2.py - 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

    Function private_ips_present has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring.
    Open

    def private_ips_present(name, network_interface_name=None, network_interface_id=None,
                            private_ip_addresses=None, allow_reassignment=False, region=None, key=None,
                            keyid=None, profile=None):
        '''
        Ensure an ENI has secondary private ip addresses associated with it
    Severity: Minor
    Found in salt/states/boto_ec2.py - 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

    Cyclomatic complexity is too high in function eni_present. (38)
    Open

    def eni_present(
            name,
            subnet_id=None,
            subnet_name=None,
            private_ip_address=None,
    Severity: Minor
    Found in salt/states/boto_ec2.py by radon

    Cyclomatic Complexity

    Cyclomatic Complexity corresponds to the number of decisions a block of code contains plus 1. This number (also called McCabe number) is equal to the number of linearly independent paths through the code. This number can be used as a guide when testing conditional logic in blocks.

    Radon analyzes the AST tree of a Python program to compute Cyclomatic Complexity. Statements have the following effects on Cyclomatic Complexity:

    Construct Effect on CC Reasoning
    if +1 An if statement is a single decision.
    elif +1 The elif statement adds another decision.
    else +0 The else statement does not cause a new decision. The decision is at the if.
    for +1 There is a decision at the start of the loop.
    while +1 There is a decision at the while statement.
    except +1 Each except branch adds a new conditional path of execution.
    finally +0 The finally block is unconditionally executed.
    with +1 The with statement roughly corresponds to a try/except block (see PEP 343 for details).
    assert +1 The assert statement internally roughly equals a conditional statement.
    Comprehension +1 A list/set/dict comprehension of generator expression is equivalent to a for loop.
    Boolean Operator +1 Every boolean operator (and, or) adds a decision point.

    Source: http://radon.readthedocs.org/en/latest/intro.html

    Function eni_absent has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
    Open

    def eni_absent(
            name,
            release_eip=False,
            region=None,
            key=None,
    Severity: Minor
    Found in salt/states/boto_ec2.py - 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

    Function key_present has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
    Open

    def key_present(name, save_private=None, upload_public=None, region=None,
                    key=None, keyid=None, profile=None):
        '''
        Ensure key pair is present.
        '''
    Severity: Minor
    Found in salt/states/boto_ec2.py - 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

    Function volume_absent has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
    Open

    def volume_absent(name, volume_name=None, volume_id=None, instance_name=None,
                      instance_id=None, device=None, region=None, key=None, keyid=None, profile=None):
        '''
        Ensure the EC2 volume is detached and absent.
    
    
    Severity: Minor
    Found in salt/states/boto_ec2.py - 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

    Cyclomatic complexity is too high in function volume_present. (22)
    Open

    def volume_present(name, volume_name=None, volume_id=None, instance_name=None,
                       instance_id=None, device=None, size=None, snapshot_id=None,
                       volume_type=None, iops=None, encrypted=False, kms_key_id=None,
                       region=None, key=None, keyid=None, profile=None):
        '''
    Severity: Minor
    Found in salt/states/boto_ec2.py by radon

    Cyclomatic Complexity

    Cyclomatic Complexity corresponds to the number of decisions a block of code contains plus 1. This number (also called McCabe number) is equal to the number of linearly independent paths through the code. This number can be used as a guide when testing conditional logic in blocks.

    Radon analyzes the AST tree of a Python program to compute Cyclomatic Complexity. Statements have the following effects on Cyclomatic Complexity:

    Construct Effect on CC Reasoning
    if +1 An if statement is a single decision.
    elif +1 The elif statement adds another decision.
    else +0 The else statement does not cause a new decision. The decision is at the if.
    for +1 There is a decision at the start of the loop.
    while +1 There is a decision at the while statement.
    except +1 Each except branch adds a new conditional path of execution.
    finally +0 The finally block is unconditionally executed.
    with +1 The with statement roughly corresponds to a try/except block (see PEP 343 for details).
    assert +1 The assert statement internally roughly equals a conditional statement.
    Comprehension +1 A list/set/dict comprehension of generator expression is equivalent to a for loop.
    Boolean Operator +1 Every boolean operator (and, or) adds a decision point.

    Source: http://radon.readthedocs.org/en/latest/intro.html

    Function snapshot_created has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

    def snapshot_created(name, ami_name, instance_name, wait_until_available=True, wait_timeout_seconds=300, **kwargs):
        '''
        Create a snapshot from the given instance
    
        .. versionadded:: 2016.3.0
    Severity: Minor
    Found in salt/states/boto_ec2.py - 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

    Function volumes_tagged has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

    def volumes_tagged(name, tag_maps, authoritative=False, region=None, key=None,
                       keyid=None, profile=None):
        '''
        Ensure EC2 volume(s) matching the given filters have the defined tags.
    
    
    Severity: Minor
    Found in salt/states/boto_ec2.py - 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

    Avoid deeply nested control flow statements.
    Open

                        if not __salt__['boto_ec2.delete_tags'](resource_ids=instance_id, tags=remove,
                                                                region=region, key=key, keyid=keyid,
                                                                profile=profile):
                            msg = "Error while deleting tags on instance {0}".format(instance_name if
                                                                                    instance_name else name)
    Severity: Major
    Found in salt/states/boto_ec2.py - About 45 mins to fix

      Avoid deeply nested control flow statements.
      Open

                          if not __salt__['boto_ec2.create_tags'](resource_ids=instance_id, tags=add,
                                                                  region=region, key=key, keyid=keyid,
                                                                  profile=profile):
                              msg = "Error while creating tags on instance {0}".format(instance_name if
                                                                                      instance_name else name)
      Severity: Major
      Found in salt/states/boto_ec2.py - About 45 mins to fix

        Avoid deeply nested control flow statements.
        Open

                            if not _ret:
                                _ret = __salt__['boto_ec2.release_eip_address'](public_ip=None,
                                                                                allocation_id=eip_alloc['allocation_id'],
                                                                                region=region,
                                                                                key=key,
        Severity: Major
        Found in salt/states/boto_ec2.py - About 45 mins to fix

          Function key_absent has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

          def key_absent(name, region=None, key=None, keyid=None, profile=None):
              '''
              Deletes a key pair
              '''
              ret = {'name': name,
          Severity: Minor
          Found in salt/states/boto_ec2.py - About 35 mins 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

          Avoid too many return statements within this function.
          Open

                              return ret
          Severity: Major
          Found in salt/states/boto_ec2.py - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

                            return ret
            Severity: Major
            Found in salt/states/boto_ec2.py - About 30 mins to fix

              Avoid too many return statements within this function.
              Open

                  return ret
              Severity: Major
              Found in salt/states/boto_ec2.py - About 30 mins to fix

                Avoid too many return statements within this function.
                Open

                    return ret
                Severity: Major
                Found in salt/states/boto_ec2.py - About 30 mins to fix

                  Avoid too many return statements within this function.
                  Open

                              return ret
                  Severity: Major
                  Found in salt/states/boto_ec2.py - About 30 mins to fix

                    Avoid too many return statements within this function.
                    Open

                                            return ret
                    Severity: Major
                    Found in salt/states/boto_ec2.py - About 30 mins to fix

                      Avoid too many return statements within this function.
                      Open

                          return ret
                      Severity: Major
                      Found in salt/states/boto_ec2.py - About 30 mins to fix

                        Avoid too many return statements within this function.
                        Open

                                        return ret
                        Severity: Major
                        Found in salt/states/boto_ec2.py - About 30 mins to fix

                          Avoid too many return statements within this function.
                          Open

                              return ret
                          Severity: Major
                          Found in salt/states/boto_ec2.py - About 30 mins to fix

                            Avoid too many return statements within this function.
                            Open

                                            return ret
                            Severity: Major
                            Found in salt/states/boto_ec2.py - About 30 mins to fix

                              Avoid too many return statements within this function.
                              Open

                                      return ret
                              Severity: Major
                              Found in salt/states/boto_ec2.py - About 30 mins to fix

                                Avoid too many return statements within this function.
                                Open

                                                        return ret
                                Severity: Major
                                Found in salt/states/boto_ec2.py - About 30 mins to fix

                                  Avoid too many return statements within this function.
                                  Open

                                                  return ret
                                  Severity: Major
                                  Found in salt/states/boto_ec2.py - About 30 mins to fix

                                    Avoid too many return statements within this function.
                                    Open

                                                        return ret
                                    Severity: Major
                                    Found in salt/states/boto_ec2.py - About 30 mins to fix

                                      Avoid too many return statements within this function.
                                      Open

                                                              return ret
                                      Severity: Major
                                      Found in salt/states/boto_ec2.py - About 30 mins to fix

                                        Avoid too many return statements within this function.
                                        Open

                                                        return ret
                                        Severity: Major
                                        Found in salt/states/boto_ec2.py - About 30 mins to fix

                                          Avoid too many return statements within this function.
                                          Open

                                              return ret
                                          Severity: Major
                                          Found in salt/states/boto_ec2.py - About 30 mins to fix

                                            Avoid too many return statements within this function.
                                            Open

                                                                return ret
                                            Severity: Major
                                            Found in salt/states/boto_ec2.py - About 30 mins to fix

                                              Avoid too many return statements within this function.
                                              Open

                                                      return ret
                                              Severity: Major
                                              Found in salt/states/boto_ec2.py - About 30 mins to fix

                                                Avoid too many return statements within this function.
                                                Open

                                                    return ret
                                                Severity: Major
                                                Found in salt/states/boto_ec2.py - About 30 mins to fix

                                                  Avoid too many return statements within this function.
                                                  Open

                                                                      return ret
                                                  Severity: Major
                                                  Found in salt/states/boto_ec2.py - About 30 mins to fix

                                                    Avoid too many return statements within this function.
                                                    Open

                                                                return ret
                                                    Severity: Major
                                                    Found in salt/states/boto_ec2.py - About 30 mins to fix

                                                      Avoid too many return statements within this function.
                                                      Open

                                                                      return ret
                                                      Severity: Major
                                                      Found in salt/states/boto_ec2.py - About 30 mins to fix

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

                                                                    if ips_not_added:
                                                                        ret['result'] = False
                                                                        ret['comment'] = ('ips on eni: {0}\n'
                                                                                          'attempted to add: {1}\n'
                                                                                          'could not add the following ips: {2}\n'.format(
                                                        Severity: Major
                                                        Found in salt/states/boto_ec2.py and 1 other location - About 6 hrs to fix
                                                        salt/states/boto_ec2.py on lines 1736..1745

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

                                                                    if ips_not_removed:
                                                                        ret['result'] = False
                                                                        ret['comment'] = ('ips on eni: {0}\n'
                                                                                          'attempted to remove: {1}\n'
                                                                                          'could not remove the following ips: {2}\n'.format(
                                                        Severity: Major
                                                        Found in salt/states/boto_ec2.py and 1 other location - About 6 hrs to fix
                                                        salt/states/boto_ec2.py on lines 1602..1612

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

                                                                        if remove:
                                                                            if not __salt__['boto_ec2.delete_tags'](resource_ids=instance_id, tags=remove,
                                                                                                                    region=region, key=key, keyid=keyid,
                                                                                                                    profile=profile):
                                                                                msg = "Error while deleting tags on instance {0}".format(instance_name if
                                                        Severity: Major
                                                        Found in salt/states/boto_ec2.py and 1 other location - About 5 hrs to fix
                                                        salt/states/boto_ec2.py on lines 973..982

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

                                                        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

                                                                        if add:
                                                                            if not __salt__['boto_ec2.create_tags'](resource_ids=instance_id, tags=add,
                                                                                                                    region=region, key=key, keyid=keyid,
                                                                                                                    profile=profile):
                                                                                msg = "Error while creating tags on instance {0}".format(instance_name if
                                                        Severity: Major
                                                        Found in salt/states/boto_ec2.py and 1 other location - About 5 hrs to fix
                                                        salt/states/boto_ec2.py on lines 963..972

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

                                                        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

                                                                if 'id' in r['result']['attachment']:
                                                                    result_detach = __salt__['boto_ec2.detach_network_interface'](
                                                                        name=name, force=True, region=region, key=key,
                                                                        keyid=keyid, profile=profile
                                                                    )
                                                        Severity: Major
                                                        Found in salt/states/boto_ec2.py and 1 other location - About 4 hrs to fix
                                                        salt/states/boto_iot.py on lines 246..255

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

                                                        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

                                                            if upload_public is not None and 'salt://' in upload_public:
                                                                try:
                                                                    upload_public = __salt__['cp.get_file_str'](upload_public)
                                                                except IOError as e:
                                                                    log.debug(e)
                                                        Severity: Major
                                                        Found in salt/states/boto_ec2.py and 1 other location - About 4 hrs to fix
                                                        salt/states/boto_iam.py on lines 1429..1436

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

                                                        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

                                                                if deleted:
                                                                    ret['result'] = True
                                                                    ret['comment'] = 'The key {0} is deleted.'.format(name)
                                                                    ret['changes']['old'] = name
                                                                else:
                                                        Severity: Major
                                                        Found in salt/states/boto_ec2.py and 1 other location - About 3 hrs to fix
                                                        salt/states/boto_ec2.py on lines 108..114

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

                                                        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

                                                                    if created:
                                                                        ret['result'] = True
                                                                        ret['comment'] = 'The key {0} is created.'.format(name)
                                                                        ret['changes']['new'] = created
                                                                    else:
                                                        Severity: Major
                                                        Found in salt/states/boto_ec2.py and 1 other location - About 3 hrs to fix
                                                        salt/states/boto_ec2.py on lines 155..161

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

                                                        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

                                                                if not __opts__['test']:
                                                                    # Assign secondary private ips to ENI
                                                                    assign_ips_args = {
                                                                        'network_interface_id': network_interface_id,
                                                                        'private_ip_addresses': ips_to_add,
                                                        Severity: Major
                                                        Found in salt/states/boto_ec2.py and 1 other location - About 3 hrs to fix
                                                        salt/states/boto_ec2.py on lines 1713..1758

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

                                                        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

                                                                if not __opts__['test']:
                                                                    # Unassign secondary private ips to ENI
                                                                    assign_ips_args = {
                                                                        'network_interface_id': network_interface_id,
                                                                        'private_ip_addresses': ips_to_remove,
                                                        Severity: Major
                                                        Found in salt/states/boto_ec2.py and 1 other location - About 3 hrs to fix
                                                        salt/states/boto_ec2.py on lines 1576..1625

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

                                                        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 eni and eni.get('result', {}).get('private_ip_addresses', None):
                                                                        for eni_pip in eni['result']['private_ip_addresses']:
                                                                            ret['changes']['new'].append(eni_pip['private_ip_address'])
                                                        Severity: Major
                                                        Found in salt/states/boto_ec2.py and 1 other location - About 3 hrs to fix
                                                        salt/states/boto_ec2.py on lines 1728..1730

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

                                                        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 eni and eni.get('result', {}).get('private_ip_addresses', None):
                                                                        for eni_pip in eni['result']['private_ip_addresses']:
                                                                            ret['changes']['new'].append(eni_pip['private_ip_address'])
                                                        Severity: Major
                                                        Found in salt/states/boto_ec2.py and 1 other location - About 3 hrs to fix
                                                        salt/states/boto_ec2.py on lines 1592..1594

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

                                                        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 ret['changes']['old'] == ret['changes']['new']:
                                                                        ret['changes'] = {}
                                                        Severity: Major
                                                        Found in salt/states/boto_ec2.py and 1 other location - About 1 hr to fix
                                                        salt/states/boto_ec2.py on lines 1748..1749

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

                                                        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 ret['changes']['old'] == ret['changes']['new']:
                                                                        ret['changes'] = {}
                                                        Severity: Major
                                                        Found in salt/states/boto_ec2.py and 1 other location - About 1 hr to fix
                                                        salt/states/boto_ec2.py on lines 1615..1616

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

                                                        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

                                                            if ips_to_remove:
                                                                if not __opts__['test']:
                                                                    # Unassign secondary private ips to ENI
                                                                    assign_ips_args = {
                                                                        'network_interface_id': network_interface_id,
                                                        Severity: Major
                                                        Found in salt/states/boto_ec2.py and 1 other location - About 1 hr to fix
                                                        salt/states/boto_ec2.py on lines 1575..1632

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

                                                        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

                                                            if ips_to_add:
                                                                if not __opts__['test']:
                                                                    # Assign secondary private ips to ENI
                                                                    assign_ips_args = {
                                                                        'network_interface_id': network_interface_id,
                                                        Severity: Major
                                                        Found in salt/states/boto_ec2.py and 1 other location - About 1 hr to fix
                                                        salt/states/boto_ec2.py on lines 1712..1765

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

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

                                                                        ret['changes']['old'] = ret['changes']['old'] if 'old' in ret['changes'] else {}
                                                        Severity: Major
                                                        Found in salt/states/boto_ec2.py and 3 other locations - About 1 hr to fix
                                                        salt/states/boto_ec2.py on lines 957..957
                                                        salt/states/boto_ec2.py on lines 983..983
                                                        salt/states/boto_ec2.py on lines 984..984

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

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

                                                                        ret['changes']['new'] = ret['changes']['new'] if 'new' in ret['changes'] else {}
                                                        Severity: Major
                                                        Found in salt/states/boto_ec2.py and 3 other locations - About 1 hr to fix
                                                        salt/states/boto_ec2.py on lines 956..956
                                                        salt/states/boto_ec2.py on lines 957..957
                                                        salt/states/boto_ec2.py on lines 983..983

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

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

                                                                        ret['changes']['new'] = ret['changes']['new'] if 'new' in ret['changes'] else {}
                                                        Severity: Major
                                                        Found in salt/states/boto_ec2.py and 3 other locations - About 1 hr to fix
                                                        salt/states/boto_ec2.py on lines 956..956
                                                        salt/states/boto_ec2.py on lines 983..983
                                                        salt/states/boto_ec2.py on lines 984..984

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

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

                                                                        ret['changes']['old'] = ret['changes']['old'] if 'old' in ret['changes'] else {}
                                                        Severity: Major
                                                        Found in salt/states/boto_ec2.py and 3 other locations - About 1 hr to fix
                                                        salt/states/boto_ec2.py on lines 956..956
                                                        salt/states/boto_ec2.py on lines 957..957
                                                        salt/states/boto_ec2.py on lines 984..984

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

                                                        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

                                                            if __opts__['test']:
                                                                ret['comment'] = 'The volume {0} is set to be attached on {1}({2}).'.format(volume_id,
                                                                                                                                            instance_id,
                                                                                                                                            device)
                                                                ret['result'] = None
                                                        Severity: Major
                                                        Found in salt/states/boto_ec2.py and 2 other locations - About 45 mins to fix
                                                        salt/states/alternatives.py on lines 76..81
                                                        salt/states/boto_ec2.py on lines 1420..1424

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

                                                        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

                                                                    if __opts__['test']:
                                                                        ret['comment'] = ('The volume with name {0} is set to be created and attached'
                                                                                          ' on {1}({2}).'.format(volume_name, instance_id, device))
                                                                        ret['result'] = None
                                                                        return ret
                                                        Severity: Major
                                                        Found in salt/states/boto_ec2.py and 2 other locations - About 45 mins to fix
                                                        salt/states/alternatives.py on lines 76..81
                                                        salt/states/boto_ec2.py on lines 1490..1495

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

                                                        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

                                                                result_create = __salt__['boto_ec2.create_network_interface'](
                                                        Severity: Minor
                                                        Found in salt/states/boto_ec2.py and 1 other location - About 45 mins to fix
                                                        salt/states/boto_vpc.py on lines 230..230

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

                                                        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