saltstack/salt

View on GitHub
salt/states/boto3_route53.py

Summary

Maintainability
F
1 wk
Test Coverage

Function hosted_zone_present has a Cognitive Complexity of 120 (exceeds 5 allowed). Consider refactoring.
Open

def hosted_zone_present(name, Name=None, PrivateZone=False,
                        CallerReference=None, Comment=None, VPCs=None,
                        region=None, key=None, keyid=None, profile=None):
    '''
    Ensure a hosted zone exists with the given attributes.
Severity: Minor
Found in salt/states/boto3_route53.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

Function rr_present has a Cognitive Complexity of 91 (exceeds 5 allowed). Consider refactoring.
Open

def rr_present(name, HostedZoneId=None, DomainName=None, PrivateZone=False, Name=None, Type=None,
               SetIdentifier=None, Weight=None, Region=None, GeoLocation=None, Failover=None,
               TTL=None, ResourceRecords=None, AliasTarget=None, HealthCheckId=None,
               TrafficPolicyInstanceId=None,
               region=None, key=None, keyid=None, profile=None):
Severity: Minor
Found in salt/states/boto3_route53.py - About 1 day to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

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

# -*- coding: utf-8 -*-
'''
Manage Route53 records with Boto 3

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

    Cyclomatic complexity is too high in function hosted_zone_present. (63)
    Open

    def hosted_zone_present(name, Name=None, PrivateZone=False,
                            CallerReference=None, Comment=None, VPCs=None,
                            region=None, key=None, keyid=None, profile=None):
        '''
        Ensure a hosted zone exists with the given attributes.
    Severity: Minor
    Found in salt/states/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 rr_present. (40)
    Open

    def rr_present(name, HostedZoneId=None, DomainName=None, PrivateZone=False, Name=None, Type=None,
                   SetIdentifier=None, Weight=None, Region=None, GeoLocation=None, Failover=None,
                   TTL=None, ResourceRecords=None, AliasTarget=None, HealthCheckId=None,
                   TrafficPolicyInstanceId=None,
                   region=None, key=None, keyid=None, profile=None):
    Severity: Minor
    Found in salt/states/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 hosted_zone_absent has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
    Open

    def hosted_zone_absent(name, Name=None, PrivateZone=False,
                           region=None, key=None, keyid=None, profile=None):
        '''
        Ensure the Route53 Hostes Zone described is absent
    
    
    Severity: Minor
    Found in salt/states/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 rr_absent has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
    Open

    def rr_absent(name, HostedZoneId=None, DomainName=None, PrivateZone=False,
                  Name=None, Type=None, SetIdentifier=None,
                  region=None, key=None, keyid=None, profile=None):
        '''
        Ensure the Route53 record is deleted.
    Severity: Minor
    Found in salt/states/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

    Avoid deeply nested control flow statements.
    Open

                        if not r:
                            ret['comment'] = 'No EC2 instance with tag {} == {} found'.format(tag_name,
                                    tag_value)
                            log.error(ret['comment'])
                            ret['result'] = False
    Severity: Major
    Found in salt/states/boto3_route53.py - About 45 mins to fix

      Avoid deeply nested control flow statements.
      Open

                          if len(r) > 1:
                              ret['comment'] = 'Multiple EC2 instances with tag {} == {} found'.format(
                                      tag_name, tag_value)
                              log.error(ret['comment'])
                              ret['result'] = False
      Severity: Major
      Found in salt/states/boto3_route53.py - About 45 mins to fix

        Avoid deeply nested control flow statements.
        Open

                            if len(fields) != 5:
                                log.warning("Invalid magic RR value seen: '%s'.  Passing as-is.", rr)
                                fixed_rrs += [rr]
                                continue
                            tag_name = fields[2]
        Severity: Major
        Found in salt/states/boto3_route53.py - About 45 mins to fix

          Avoid deeply nested control flow statements.
          Open

                              if res:
                                  log.debug('Found %s %s for instance %s', instance_attr, res, instance.id)
                                  fixed_rrs += [__salt__['boto3_route53.aws_encode'](res)]
                              else:
                                  ret['comment'] = 'Attribute {} not found on instance {}'.format(instance_attr,
          Severity: Major
          Found in salt/states/boto3_route53.py - About 45 mins to fix

            Avoid too many return statements within this function.
            Open

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

              Avoid too many return statements within this function.
              Open

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

                Avoid too many return statements within this function.
                Open

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

                  Avoid too many return statements within this function.
                  Open

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

                    Avoid too many return statements within this function.
                    Open

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

                      Avoid too many return statements within this function.
                      Open

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

                        Avoid too many return statements within this function.
                        Open

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

                          Avoid too many return statements within this function.
                          Open

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

                            Avoid too many return statements within this function.
                            Open

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

                              Avoid too many return statements within this function.
                              Open

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

                                Avoid too many return statements within this function.
                                Open

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

                                  Avoid too many return statements within this function.
                                  Open

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

                                    Avoid too many return statements within this function.
                                    Open

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

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

                                              for vpc in add_vpcs:  # Add any new first to avoid the "can't delete last VPC" errors.
                                                  r = __salt__['boto3_route53.associate_vpc_with_hosted_zone'](Name=Name,
                                                          VPCId=vpc['VPCId'], VPCRegion=vpc['VPCRegion'], region=region, key=key,
                                                          keyid=keyid, profile=profile)
                                                  if not r:
                                      Severity: Major
                                      Found in salt/states/boto3_route53.py and 1 other location - About 2 hrs to fix
                                      salt/states/boto3_route53.py on lines 277..282

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

                                      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

                                              for vpc in del_vpcs:
                                                  r = __salt__['boto3_route53.disassociate_vpc_from_hosted_zone'](Name=Name,
                                                          VPCId=vpc['VPCId'], VPCRegion=vpc['VPCRegion'], region=region, key=key,
                                                          keyid=keyid, profile=profile)
                                                  if not r:
                                      Severity: Major
                                      Found in salt/states/boto3_route53.py and 1 other location - About 2 hrs to fix
                                      salt/states/boto3_route53.py on lines 271..276

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

                                      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 SetIdentifier and recordsets:
                                              log.debug('Filter recordsets %s by SetIdentifier %s.', recordsets, SetIdentifier)
                                              recordsets = [r for r in recordsets if r.get('SetIdentifier') == SetIdentifier]
                                              log.debug('Resulted in recordsets %s.', recordsets)
                                      Severity: Major
                                      Found in salt/states/boto3_route53.py and 1 other location - About 2 hrs to fix
                                      salt/states/boto3_route53.py on lines 759..762

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

                                      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 SetIdentifier and recordsets:
                                              log.debug('Filter recordsets %s by SetIdentifier %s.', recordsets, SetIdentifier)
                                              recordsets = [r for r in recordsets if r.get('SetIdentifier') == SetIdentifier]
                                              log.debug('Resulted in recordsets %s.', recordsets)
                                      Severity: Major
                                      Found in salt/states/boto3_route53.py and 1 other location - About 2 hrs to fix
                                      salt/states/boto3_route53.py on lines 610..613

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

                                      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

                                          if __salt__['boto3_route53.delete_hosted_zone'](Id=Id, region=region, key=key,
                                                  keyid=keyid, profile=profile):
                                              ret['comment'] = 'Route 53 {} hosted zone {} deleted'.format('private' if PrivateZone else
                                                      'public', Name)
                                              log.info(ret['comment'])
                                      Severity: Major
                                      Found in salt/states/boto3_route53.py and 3 other locations - About 1 hr to fix
                                      salt/states/boto3_route53.py on lines 226..237
                                      salt/states/boto3_route53.py on lines 248..261
                                      salt/states/boto3_route53.py on lines 286..296

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

                                      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

                                              if r:
                                                  r = r[0]
                                                  msg = 'Route 53 {} hosted zone {} comment successfully updated'.format('private' if
                                                          PrivateZone else 'public', Name)
                                                  log.info(msg)
                                      Severity: Major
                                      Found in salt/states/boto3_route53.py and 3 other locations - About 1 hr to fix
                                      salt/states/boto3_route53.py on lines 226..237
                                      salt/states/boto3_route53.py on lines 286..296
                                      salt/states/boto3_route53.py on lines 336..348

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

                                      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

                                              if all_added and all_deled:
                                                  msg = 'Route 53 {} hosted zone {} associated VPCs successfully updated'.format('private'
                                                          if PrivateZone else 'public', Name)
                                                  log.info(msg)
                                                  ret['comment'] = '  '.join([ret['comment'], msg])
                                      Severity: Major
                                      Found in salt/states/boto3_route53.py and 3 other locations - About 1 hr to fix
                                      salt/states/boto3_route53.py on lines 226..237
                                      salt/states/boto3_route53.py on lines 248..261
                                      salt/states/boto3_route53.py on lines 336..348

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

                                      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

                                              if newzone:
                                                  newzone = newzone[0]
                                                  ret['comment'] = 'Route 53 {} hosted zone {} successfully created'.format('private' if
                                                          PrivateZone else 'public', Name)
                                                  log.info(ret['comment'])
                                      Severity: Major
                                      Found in salt/states/boto3_route53.py and 3 other locations - About 1 hr to fix
                                      salt/states/boto3_route53.py on lines 248..261
                                      salt/states/boto3_route53.py on lines 286..296
                                      salt/states/boto3_route53.py on lines 336..348

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

                                      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 not zone:
                                              ret['comment'] = 'Route 53 {} hosted zone {} not found'.format('private' if PrivateZone
                                                      else 'public', DomainName)
                                              log.info(ret['comment'])
                                              return ret
                                      Severity: Major
                                      Found in salt/states/boto3_route53.py and 2 other locations - About 1 hr to fix
                                      salt/states/boto3_route53.py on lines 324..328
                                      salt/states/boto3_route53.py on lines 541..545

                                      Duplicated Code

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

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

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

                                      Tuning

                                      This issue has a mass of 50.

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

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

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

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

                                      Refactorings

                                      Further Reading

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

                                          if not zone:
                                              ret['comment'] = 'Route 53 {} hosted zone {} already absent'.format('private' if
                                                      PrivateZone else 'public', Name)
                                              log.info(ret['comment'])
                                              return ret
                                      Severity: Major
                                      Found in salt/states/boto3_route53.py and 2 other locations - About 1 hr to fix
                                      salt/states/boto3_route53.py on lines 541..545
                                      salt/states/boto3_route53.py on lines 748..752

                                      Duplicated Code

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

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

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

                                      Tuning

                                      This issue has a mass of 50.

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

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

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

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

                                      Refactorings

                                      Further Reading

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

                                          if not zone:
                                              ret['comment'] = 'Route 53 {} hosted zone {} not found'.format('private' if PrivateZone
                                                      else 'public', DomainName)
                                              log.info(ret['comment'])
                                              return ret
                                      Severity: Major
                                      Found in salt/states/boto3_route53.py and 2 other locations - About 1 hr to fix
                                      salt/states/boto3_route53.py on lines 324..328
                                      salt/states/boto3_route53.py on lines 748..752

                                      Duplicated Code

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

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

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

                                      Tuning

                                      This issue has a mass of 50.

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

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

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

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

                                      Refactorings

                                      Further Reading

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

                                          elif len(recordsets) > 1:
                                              ret['comment'] = 'Given criteria matched more than one ResourceRecordSet.'
                                              log.error(ret['comment'])
                                              ret['result'] = False
                                              return ret
                                      Severity: Major
                                      Found in salt/states/boto3_route53.py and 1 other location - About 1 hr to fix
                                      salt/states/boto3_route53.py on lines 767..771

                                      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

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

                                          elif len(recordsets) > 1:
                                              ret['comment'] = 'Given criteria matched more than one ResourceRecordSet.'
                                              log.error(ret['comment'])
                                              ret['result'] = False
                                              return ret
                                      Severity: Major
                                      Found in salt/states/boto3_route53.py and 1 other location - About 1 hr to fix
                                      salt/states/boto3_route53.py on lines 626..630

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

                                              if __opts__['test']:
                                                  ret['comment'] = 'Route 53 {} hosted zone {} would be created.'.format('private' if
                                                          PrivateZone else 'public', Name)
                                                  ret['result'] = None
                                                  return ret
                                      Severity: Major
                                      Found in salt/states/boto3_route53.py and 3 other locations - About 1 hr to fix
                                      salt/states/boto3_route53.py on lines 240..244
                                      salt/states/boto3_route53.py on lines 264..268
                                      salt/states/boto3_route53.py on lines 329..333

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

                                      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

                                              if __opts__['test']:
                                                  ret['comment'] = 'Route 53 {} hosted zone {} comment would be updated.'.format('private'
                                                          if PrivateZone else 'public', Name)
                                                  ret['result'] = None
                                                  return ret
                                      Severity: Major
                                      Found in salt/states/boto3_route53.py and 3 other locations - About 1 hr to fix
                                      salt/states/boto3_route53.py on lines 215..219
                                      salt/states/boto3_route53.py on lines 264..268
                                      salt/states/boto3_route53.py on lines 329..333

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

                                      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

                                              if __opts__['test']:
                                                  ret['comment'] = 'Route 53 {} hosted zone {} associated VPCs would be updated.'.format(
                                                          'private' if PrivateZone else 'public', Name)
                                                  ret['result'] = None
                                                  return ret
                                      Severity: Major
                                      Found in salt/states/boto3_route53.py and 3 other locations - About 1 hr to fix
                                      salt/states/boto3_route53.py on lines 215..219
                                      salt/states/boto3_route53.py on lines 240..244
                                      salt/states/boto3_route53.py on lines 329..333

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

                                      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

                                          if __opts__['test']:
                                              ret['comment'] = 'Route 53 {} hosted zone {} would be deleted'.format('private' if
                                                      PrivateZone else 'public', Name)
                                              ret['result'] = None
                                              return ret
                                      Severity: Major
                                      Found in salt/states/boto3_route53.py and 3 other locations - About 1 hr to fix
                                      salt/states/boto3_route53.py on lines 215..219
                                      salt/states/boto3_route53.py on lines 240..244
                                      salt/states/boto3_route53.py on lines 264..268

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

                                      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 r:
                                                              ret['comment'] = 'No EC2 instance with tag {} == {} found'.format(tag_name,
                                                                      tag_value)
                                                              log.error(ret['comment'])
                                                              ret['result'] = False
                                      Severity: Major
                                      Found in salt/states/boto3_route53.py and 1 other location - About 1 hr to fix
                                      salt/states/boto3_route53.py on lines 573..578

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

                                      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 len(r) > 1:
                                                              ret['comment'] = 'Multiple EC2 instances with tag {} == {} found'.format(
                                                                      tag_name, tag_value)
                                                              log.error(ret['comment'])
                                                              ret['result'] = False
                                      Severity: Major
                                      Found in salt/states/boto3_route53.py and 1 other location - About 1 hr to fix
                                      salt/states/boto3_route53.py on lines 567..572

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

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

                                              newzone = __salt__['boto3_route53.create_hosted_zone'](Name=Name,
                                      Severity: Major
                                      Found in salt/states/boto3_route53.py and 7 other locations - About 50 mins to fix
                                      salt/states/boto_cloudwatch_event.py on lines 153..153
                                      salt/states/boto_cloudwatch_event.py on lines 229..229
                                      salt/states/boto_elb.py on lines 632..632
                                      salt/states/boto_route53.py on lines 474..474
                                      salt/states/cron.py on lines 349..350
                                      salt/states/mount.py on lines 1117..1128
                                      salt/states/ssh_known_hosts.py on lines 163..163

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

                                      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 rr_present(name, HostedZoneId=None, DomainName=None, PrivateZone=False, Name=None, Type=None,
                                                     SetIdentifier=None, Weight=None, Region=None, GeoLocation=None, Failover=None,
                                                     TTL=None, ResourceRecords=None, AliasTarget=None, HealthCheckId=None,
                                                     TrafficPolicyInstanceId=None,
                                                     region=None, key=None, keyid=None, profile=None):
                                      Severity: Minor
                                      Found in salt/states/boto3_route53.py and 1 other location - About 40 mins to fix
                                      salt/states/boto_elasticache.py on lines 100..120

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

                                      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