saltstack/salt

View on GitHub
salt/modules/boto3_route53.py

Summary

Maintainability
F
2 wks
Test Coverage

File boto3_route53.py has 792 lines of code (exceeds 250 allowed). Consider refactoring.
Open

# -*- coding: utf-8 -*-
'''
Execution module for Amazon Route53 written against Boto 3

.. versionadded:: 2017.7.0
Severity: Major
Found in salt/modules/boto3_route53.py - About 1 day to fix

    Function get_resource_records has a Cognitive Complexity of 51 (exceeds 5 allowed). Consider refactoring.
    Open

    def get_resource_records(HostedZoneId=None, Name=None, StartRecordName=None,
                             StartRecordType=None, PrivateZone=None,
                             region=None, key=None, keyid=None, profile=None):
        '''
        Get all resource records from a given zone matching the provided StartRecordName (if given) or all
    Severity: Minor
    Found in salt/modules/boto3_route53.py - About 7 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 create_hosted_zone has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
    Open

    def create_hosted_zone(Name, VPCId=None, VPCName=None, VPCRegion=None, CallerReference=None,
                           Comment='', PrivateZone=False, DelegationSetId=None,
                           region=None, key=None, keyid=None, profile=None):
        '''
        Create a new Route53 Hosted Zone. Returns a Python data structure with information about the
    Severity: Minor
    Found in salt/modules/boto3_route53.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 disassociate_vpc_from_hosted_zone has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
    Open

    def disassociate_vpc_from_hosted_zone(HostedZoneId=None, Name=None, VPCId=None,
                                         VPCName=None, VPCRegion=None, Comment=None,
                                         region=None, key=None, keyid=None, profile=None):
        '''
        Disassociates an Amazon VPC from a private hosted zone.
    Severity: Minor
    Found in salt/modules/boto3_route53.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 associate_vpc_with_hosted_zone has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
    Open

    def associate_vpc_with_hosted_zone(HostedZoneId=None, Name=None, VPCId=None,
                                       VPCName=None, VPCRegion=None, Comment=None,
                                       region=None, key=None, keyid=None, profile=None):
        '''
        Associates an Amazon VPC with a private hosted zone.
    Severity: Minor
    Found in salt/modules/boto3_route53.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

    Cyclomatic complexity is too high in function get_resource_records. (24)
    Open

    def get_resource_records(HostedZoneId=None, Name=None, StartRecordName=None,
                             StartRecordType=None, PrivateZone=None,
                             region=None, key=None, keyid=None, profile=None):
        '''
        Get all resource records from a given zone matching the provided StartRecordName (if given) or all
    Severity: Minor
    Found in salt/modules/boto3_route53.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

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

    def disassociate_vpc_from_hosted_zone(HostedZoneId=None, Name=None, VPCId=None,
                                         VPCName=None, VPCRegion=None, Comment=None,
                                         region=None, key=None, keyid=None, profile=None):
        '''
        Disassociates an Amazon VPC from a private hosted zone.
    Severity: Minor
    Found in salt/modules/boto3_route53.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

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

    def associate_vpc_with_hosted_zone(HostedZoneId=None, Name=None, VPCId=None,
                                       VPCName=None, VPCRegion=None, Comment=None,
                                       region=None, key=None, keyid=None, profile=None):
        '''
        Associates an Amazon VPC with a private hosted zone.
    Severity: Minor
    Found in salt/modules/boto3_route53.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

    Cyclomatic complexity is too high in function create_hosted_zone. (21)
    Open

    def create_hosted_zone(Name, VPCId=None, VPCName=None, VPCRegion=None, CallerReference=None,
                           Comment='', PrivateZone=False, DelegationSetId=None,
                           region=None, key=None, keyid=None, profile=None):
        '''
        Create a new Route53 Hosted Zone. Returns a Python data structure with information about the
    Severity: Minor
    Found in salt/modules/boto3_route53.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 change_resource_record_sets has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
    Open

    def change_resource_record_sets(HostedZoneId=None, Name=None,
                                    PrivateZone=None, ChangeBatch=None,
                                    region=None, key=None, keyid=None, profile=None):
        '''
        See the `AWS Route53 API docs`__ as well as the `Boto3 documentation`__ for all the details...
    Severity: Minor
    Found in salt/modules/boto3_route53.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 _collect_results has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
    Open

    def _collect_results(func, item, args, marker='Marker', nextmarker='NextMarker'):
        ret = []
        Marker = args.get(marker, '')
        tries = 10
        while Marker is not None:
    Severity: Minor
    Found in salt/modules/boto3_route53.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 update_hosted_zone_comment has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

    def update_hosted_zone_comment(Id=None, Name=None, Comment=None, PrivateZone=None,
                                   region=None, key=None, keyid=None, profile=None):
        '''
        Update the comment on an existing Route 53 hosted zone.
    
    
    Severity: Minor
    Found in salt/modules/boto3_route53.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 _wait_for_sync has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

    def _wait_for_sync(change, conn, tries=10, sleep=20):
        for retry in range(1, tries+1):
            log.info('Getting route53 status (attempt %s)', retry)
            status = 'wait'
            try:
    Severity: Minor
    Found in salt/modules/boto3_route53.py - About 55 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 deeply nested control flow statements.
    Open

                            if 'Value' in rr['ResourceRecords'][x]:
                                rr['ResourceRecords'][x]['Value'] = _aws_decode(rr['ResourceRecords'][x]['Value'])
                            x += 1
    Severity: Major
    Found in salt/modules/boto3_route53.py - About 45 mins to fix

      Function _aws_encode_changebatch has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

      def _aws_encode_changebatch(o):
          '''
          helper method to process a change batch & encode the bits which need encoding.
          '''
          change_idx = 0
      Severity: Minor
      Found in salt/modules/boto3_route53.py - About 45 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 True
      Severity: Major
      Found in salt/modules/boto3_route53.py - About 30 mins to fix

        Avoid too many return statements within this function.
        Open

            return False
        Severity: Major
        Found in salt/modules/boto3_route53.py - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

                      return []
          Severity: Major
          Found in salt/modules/boto3_route53.py - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

                return False
            Severity: Major
            Found in salt/modules/boto3_route53.py - About 30 mins to fix

              Avoid too many return statements within this function.
              Open

                              return True
              Severity: Major
              Found in salt/modules/boto3_route53.py - About 30 mins to fix

                Avoid too many return statements within this function.
                Open

                    return []
                Severity: Major
                Found in salt/modules/boto3_route53.py - About 30 mins to fix

                  Avoid too many return statements within this function.
                  Open

                              return []
                  Severity: Major
                  Found in salt/modules/boto3_route53.py - About 30 mins to fix

                    Function find_hosted_zone has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                    Open

                    def find_hosted_zone(Id=None, Name=None, PrivateZone=None,
                                         region=None, key=None, keyid=None, profile=None):
                        '''
                        Find a hosted zone with the given characteristics.
                    
                    
                    Severity: Minor
                    Found in salt/modules/boto3_route53.py - About 25 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

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

                    def associate_vpc_with_hosted_zone(HostedZoneId=None, Name=None, VPCId=None,
                                                       VPCName=None, VPCRegion=None, Comment=None,
                                                       region=None, key=None, keyid=None, profile=None):
                        '''
                        Associates an Amazon VPC with a private hosted zone.
                    Severity: Major
                    Found in salt/modules/boto3_route53.py and 1 other location - About 5 days to fix
                    salt/modules/boto3_route53.py on lines 570..662

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

                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                    Refactorings

                    Further Reading

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

                    def disassociate_vpc_from_hosted_zone(HostedZoneId=None, Name=None, VPCId=None,
                                                         VPCName=None, VPCRegion=None, Comment=None,
                                                         region=None, key=None, keyid=None, profile=None):
                        '''
                        Disassociates an Amazon VPC from a private hosted zone.
                    Severity: Major
                    Found in salt/modules/boto3_route53.py and 1 other location - About 5 days to fix
                    salt/modules/boto3_route53.py on lines 465..567

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

                    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 Name:
                            args = {'Name': Name, 'region': region, 'key': key, 'keyid': keyid,
                                    'profile': profile}
                            args.update({'PrivateZone': PrivateZone}) if PrivateZone is not None else None
                            zone = find_hosted_zone(**args)
                    Severity: Major
                    Found in salt/modules/boto3_route53.py and 1 other location - About 6 hrs to fix
                    salt/modules/boto3_route53.py on lines 839..847

                    Duplicated Code

                    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                    Tuning

                    This issue has a mass of 99.

                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                    Refactorings

                    Further Reading

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

                        if Name:
                            args = {'Name': Name, 'region': region, 'key': key, 'keyid': keyid,
                                    'profile': profile}
                            args.update({'PrivateZone': PrivateZone}) if PrivateZone is not None else None
                            zone = find_hosted_zone(**args)
                    Severity: Major
                    Found in salt/modules/boto3_route53.py and 1 other location - About 6 hrs to fix
                    salt/modules/boto3_route53.py on lines 975..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 99.

                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                    Refactorings

                    Further Reading

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

                            try:
                                r = func(**args)
                            except ClientError as e:
                                if tries and e.response.get('Error', {}).get('Code') == 'Throttling':
                                    # Rate limited - retry
                    Severity: Major
                    Found in salt/modules/boto3_route53.py and 1 other location - About 3 hrs to fix
                    salt/modules/boto3_route53.py on lines 398..411

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

                    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

                            try:
                                r = conn.create_hosted_zone(**args)
                                r.pop('ResponseMetadata', None)
                                if _wait_for_sync(r['ChangeInfo']['Id'], conn):
                                    return [r]
                    Severity: Major
                    Found in salt/modules/boto3_route53.py and 1 other location - About 3 hrs to fix
                    salt/modules/boto3_route53.py on lines 95..105

                    Duplicated Code

                    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                    Tuning

                    This issue has a mass of 76.

                    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 len(vpcs) > 1:
                                log.error(
                                    'Private zone requested but multiple VPCs matching given '
                                    'criteria found: %s.', [v['id'] for v in vpcs]
                                )
                    Severity: Minor
                    Found in salt/modules/boto3_route53.py and 2 other locations - About 35 mins to fix
                    salt/modules/boto_route53.py on lines 893..896
                    salt/states/boto_route53.py on lines 419..424

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

                    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

                    try:
                        #pylint: disable=unused-import
                        import boto3
                        #pylint: enable=unused-import
                        from botocore.exceptions import ClientError
                    Severity: Minor
                    Found in salt/modules/boto3_route53.py and 1 other location - About 30 mins to fix
                    salt/modules/elasticsearch.py on lines 64..70

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

                    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