saltstack/salt

View on GitHub
salt/states/boto_cloudfront.py

Summary

Maintainability
F
2 wks
Test Coverage

File boto_cloudfront.py has 984 lines of code (exceeds 250 allowed). Consider refactoring.
Open

# -*- coding: utf-8 -*-
'''
Manage CloudFront distributions

.. versionadded:: 2018.3.0
Severity: Major
Found in salt/states/boto_cloudfront.py - About 2 days to fix

    Function distribution_present has a Cognitive Complexity of 49 (exceeds 5 allowed). Consider refactoring.
    Open

    def distribution_present(name, region=None, key=None, keyid=None, profile=None, **kwargs):
        '''
        Ensure the given CloudFront distribution exists in the described state.
    
        The implementation of this function, and all those following, is orthagonal
    Severity: Minor
    Found in salt/states/boto_cloudfront.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

    Cyclomatic complexity is too high in function distribution_present. (28)
    Open

    def distribution_present(name, region=None, key=None, keyid=None, profile=None, **kwargs):
        '''
        Ensure the given CloudFront distribution exists in the described state.
    
        The implementation of this function, and all those following, is orthagonal
    Severity: Minor
    Found in salt/states/boto_cloudfront.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 distribution_absent has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
    Open

    def distribution_absent(name, region=None, key=None, keyid=None, profile=None, **kwargs):
        '''
        Ensure a distribution with the given Name tag does not exist.
    
        Note that CloudFront does not allow directly deleting an enabled
    Severity: Minor
    Found in salt/states/boto_cloudfront.py - About 2 hrs to fix

    Cognitive Complexity

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

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

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

    Further reading

    Function route53_alias_present has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
    Open

    def route53_alias_present(name, region=None, key=None, keyid=None, profile=None, **kwargs):
        '''
        Ensure a Route53 Alias exists and is pointing at the given CloudFront
        distribution. An ``A`` record is always created, and if IPV6 is enabled on
        the given distribution, an ``AAAA`` record will be created as well. Also be
    Severity: Minor
    Found in salt/states/boto_cloudfront.py - About 2 hrs to fix

    Cognitive Complexity

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

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

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

    Further reading

    Function origin_access_identity_present has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
    Open

    def origin_access_identity_present(name, region=None, key=None, keyid=None, profile=None, **kwargs):
        '''
        Ensure a given CloudFront Origin Access Identity exists.
    
        .. note::
    Severity: Minor
    Found in salt/states/boto_cloudfront.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 present has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

    def present(
        name,
        config,
        tags,
        region=None,
    Severity: Minor
    Found in salt/states/boto_cloudfront.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 origin_access_identity_absent has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

    def origin_access_identity_absent(name, region=None, key=None, keyid=None, profile=None, **kwargs):
        '''
        Ensure a given CloudFront Origin Access Identity is absent.
    
        name
    Severity: Minor
    Found in salt/states/boto_cloudfront.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 oai_bucket_policy_present has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
    Open

    def oai_bucket_policy_present(name, Bucket, OAI, Policy,
                                  region=None, key=None, keyid=None, profile=None):
        '''
        Ensure the given policy exists on an S3 bucket, granting access for the given origin access
        identity to do the things specified in the policy.
    Severity: Minor
    Found in salt/states/boto_cloudfront.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 route53_alias_present has 33 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    def route53_alias_present(name, region=None, key=None, keyid=None, profile=None, **kwargs):
        '''
        Ensure a Route53 Alias exists and is pointing at the given CloudFront
        distribution. An ``A`` record is always created, and if IPV6 is enabled on
        the given distribution, an ``AAAA`` record will be created as well. Also be
    Severity: Minor
    Found in salt/states/boto_cloudfront.py - About 1 hr to fix

      Function _fix_quantities has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

      def _fix_quantities(tree):
          '''
          Stupidly simple function to fix any Items/Quantity disparities inside a
          DistributionConfig block before use. Since AWS only accepts JSON-encodable
          data types, this implementation is "good enough" for our purposes.
      Severity: Minor
      Found in salt/states/boto_cloudfront.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 too many return statements within this function.
      Open

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

        Avoid too many return statements within this function.
        Open

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

          Avoid too many return statements within this function.
          Open

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

            Avoid too many return statements within this function.
            Open

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

              Avoid too many return statements within this function.
              Open

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

                Avoid too many return statements within this function.
                Open

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

                  Avoid too many return statements within this function.
                  Open

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

                    Avoid too many return statements within this function.
                    Open

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

                      Avoid too many return statements within this function.
                      Open

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

                        Avoid too many return statements within this function.
                        Open

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

                          Avoid too many return statements within this function.
                          Open

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

                            Avoid too many return statements within this function.
                            Open

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

                              Avoid too many return statements within this function.
                              Open

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

                                Avoid too many return statements within this function.
                                Open

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

                                  Avoid too many return statements within this function.
                                  Open

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

                                    Avoid too many return statements within this function.
                                    Open

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

                                      Avoid too many return statements within this function.
                                      Open

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

                                        Avoid too many return statements within this function.
                                        Open

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

                                          Avoid too many return statements within this function.
                                          Open

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

                                            Avoid too many return statements within this function.
                                            Open

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

                                              Avoid too many return statements within this function.
                                              Open

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

                                                Avoid too many return statements within this function.
                                                Open

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

                                                  Avoid too many return statements within this function.
                                                  Open

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

                                                    Avoid too many return statements within this function.
                                                    Open

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

                                                      Avoid too many return statements within this function.
                                                      Open

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

                                                        Avoid too many return statements within this function.
                                                        Open

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

                                                          Avoid too many return statements within this function.
                                                          Open

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

                                                            Avoid too many return statements within this function.
                                                            Open

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

                                                              Avoid too many return statements within this function.
                                                              Open

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

                                                                Avoid too many return statements within this function.
                                                                Open

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

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

                                                                      if not Id:
                                                                          current = __salt__['boto_cloudfront.get_cloud_front_origin_access_identities_by_comment'](
                                                                                  Comment=Name, **authargs)
                                                                          if current is None:
                                                                              msg = 'Error dereferencing origin access identity `{}` to a Resource ID.'.format(Name)
                                                                  Severity: Major
                                                                  Found in salt/states/boto_cloudfront.py and 1 other location - About 1 day to fix
                                                                  salt/states/boto_cloudfront.py on lines 885..906

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

                                                                  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 Id:
                                                                          res = __salt__['boto_cloudfront.get_distributions_by_comment'](Comment=Name, **authargs)
                                                                          if res is None:
                                                                              msg = 'Error dereferencing CloudFront distribution `{}` to a Resource ID.'.format(Name)
                                                                              log.error(msg)
                                                                  Severity: Major
                                                                  Found in salt/states/boto_cloudfront.py and 1 other location - About 1 day to fix
                                                                  salt/states/boto_cloudfront.py on lines 1122..1144

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

                                                                  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 tagged is False:
                                                                                  ret['result'] = False
                                                                                  msg = 'Error occurred while updating Tags on distribution `{}`.'.format(Name)
                                                                                  log.error(msg)
                                                                                  comments += [msg]
                                                                  Severity: Major
                                                                  Found in salt/states/boto_cloudfront.py and 1 other location - About 3 hrs to fix
                                                                  salt/states/boto_cloudfront.py on lines 493..499

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

                                                                  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 tagged is False:
                                                                              ret['result'] = False
                                                                              msg = 'Error occurred while tagging distribution `{}`.'.format(Name)
                                                                              log.error(msg)
                                                                              comments += [msg]
                                                                  Severity: Major
                                                                  Found in salt/states/boto_cloudfront.py and 1 other location - About 3 hrs to fix
                                                                  salt/states/boto_cloudfront.py on lines 563..569

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

                                                                  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['result'] = None
                                                                              ret['comment'] = 'CloudFront origin access identity `{}` would be updated.'.format(Name)
                                                                              ret['pchanges'] = {'old': currentOAIC, 'new': new}
                                                                              return ret
                                                                  Severity: Major
                                                                  Found in salt/states/boto_cloudfront.py and 3 other locations - About 2 hrs to fix
                                                                  salt/states/boto_cloudfront.py on lines 143..147
                                                                  salt/states/boto_cloudfront.py on lines 1160..1164
                                                                  salt/states/boto_sqs.py on lines 300..304

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

                                                                  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['result'] = None
                                                                              ret['comment'] = 'Distribution {0} set for creation.'.format(name)
                                                                              ret['changes'] = {'old': None, 'new': name}
                                                                              return ret
                                                                  Severity: Major
                                                                  Found in salt/states/boto_cloudfront.py and 3 other locations - About 2 hrs to fix
                                                                  salt/states/boto_cloudfront.py on lines 1061..1065
                                                                  salt/states/boto_cloudfront.py on lines 1160..1164
                                                                  salt/states/boto_sqs.py on lines 300..304

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

                                                                  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['result'] = None
                                                                          ret['comment'] = 'CloudFront origin access identity `{}` would be deleted.'.format(ref)
                                                                          ret['pchanges'] = {'old': old, 'new': None}
                                                                          return ret
                                                                  Severity: Major
                                                                  Found in salt/states/boto_cloudfront.py and 3 other locations - About 2 hrs to fix
                                                                  salt/states/boto_cloudfront.py on lines 143..147
                                                                  salt/states/boto_cloudfront.py on lines 1061..1065
                                                                  salt/states/boto_sqs.py on lines 300..304

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

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

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

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

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

                                                                  Refactorings

                                                                  Further Reading

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

                                                                      if __opts__['test']:
                                                                          ret['comment'] = 'Policy on S3 bucket `{}` would be updated.'.format(Bucket)
                                                                          ret['result'] = None
                                                                          ret['changes'] = {'old': curr_policy, 'new': fake_Policy}
                                                                          return ret
                                                                  Severity: Major
                                                                  Found in salt/states/boto_cloudfront.py and 2 other locations - About 2 hrs to fix
                                                                  salt/states/ipmi.py on lines 137..141
                                                                  salt/states/selinux.py on lines 117..123

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

                                                                  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 __salt__['boto_cloudfront.cloud_front_origin_access_identity_exists'](Id=Id, **authargs):
                                                                          msg = 'CloudFront origin access identity `{}` already absent.'.format(ref)
                                                                          log.info(msg)
                                                                          ret['comment'] = msg
                                                                          return ret
                                                                  Severity: Major
                                                                  Found in salt/states/boto_cloudfront.py and 1 other location - About 1 hr to fix
                                                                  salt/states/boto_cloudfront.py on lines 908..912

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

                                                                  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 __salt__['boto_cloudfront.distribution_exists'](Id=Id, **authargs):
                                                                          msg = 'CloudFront distribution `{}` already absent.'.format(ref)
                                                                          log.info(msg)
                                                                          ret['comment'] = msg
                                                                          return ret
                                                                  Severity: Major
                                                                  Found in salt/states/boto_cloudfront.py and 1 other location - About 1 hr to fix
                                                                  salt/states/boto_cloudfront.py on lines 1146..1150

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

                                                                  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

                                                                          if res is None:
                                                                              ret['result'] = False
                                                                              msg = 'Error occurred while creating distribution `{}`.'.format(Name)
                                                                              log.error(msg)
                                                                              ret['comment'] = msg
                                                                  Severity: Major
                                                                  Found in salt/states/boto_cloudfront.py and 7 other locations - About 1 hr to fix
                                                                  salt/states/boto_cloudfront.py on lines 551..556
                                                                  salt/states/boto_cloudfront.py on lines 915..920
                                                                  salt/states/boto_cloudfront.py on lines 934..939
                                                                  salt/states/boto_cloudfront.py on lines 1039..1044
                                                                  salt/states/boto_cloudfront.py on lines 1070..1075
                                                                  salt/states/boto_cloudfront.py on lines 1153..1158
                                                                  salt/states/boto_cloudfront.py on lines 1168..1173

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

                                                                  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

                                                                      if deleted is False:
                                                                          ret['result'] = False
                                                                          msg = 'Error deleting CloudFront origin access identity `{}`'.format(ref)
                                                                          log.error(msg)
                                                                          ret['comment'] = msg
                                                                  Severity: Major
                                                                  Found in salt/states/boto_cloudfront.py and 7 other locations - About 1 hr to fix
                                                                  salt/states/boto_cloudfront.py on lines 483..488
                                                                  salt/states/boto_cloudfront.py on lines 551..556
                                                                  salt/states/boto_cloudfront.py on lines 915..920
                                                                  salt/states/boto_cloudfront.py on lines 934..939
                                                                  salt/states/boto_cloudfront.py on lines 1039..1044
                                                                  salt/states/boto_cloudfront.py on lines 1070..1075
                                                                  salt/states/boto_cloudfront.py on lines 1153..1158

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

                                                                  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

                                                                          if disabled is None:
                                                                              ret['result'] = False
                                                                              msg = 'Error disabling CloudFront distribution `{}`'.format(ref)
                                                                              log.error(msg)
                                                                              ret['comment'] = msg
                                                                  Severity: Major
                                                                  Found in salt/states/boto_cloudfront.py and 7 other locations - About 1 hr to fix
                                                                  salt/states/boto_cloudfront.py on lines 483..488
                                                                  salt/states/boto_cloudfront.py on lines 551..556
                                                                  salt/states/boto_cloudfront.py on lines 915..920
                                                                  salt/states/boto_cloudfront.py on lines 1039..1044
                                                                  salt/states/boto_cloudfront.py on lines 1070..1075
                                                                  salt/states/boto_cloudfront.py on lines 1153..1158
                                                                  salt/states/boto_cloudfront.py on lines 1168..1173

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

                                                                  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

                                                                      if old is None:
                                                                          ret['result'] = False
                                                                          msg = 'Error getting state of CloudFront origin access identity `{}`.'.format(ref)
                                                                          log.error(msg)
                                                                          ret['comment'] = msg
                                                                  Severity: Major
                                                                  Found in salt/states/boto_cloudfront.py and 7 other locations - About 1 hr to fix
                                                                  salt/states/boto_cloudfront.py on lines 483..488
                                                                  salt/states/boto_cloudfront.py on lines 551..556
                                                                  salt/states/boto_cloudfront.py on lines 915..920
                                                                  salt/states/boto_cloudfront.py on lines 934..939
                                                                  salt/states/boto_cloudfront.py on lines 1039..1044
                                                                  salt/states/boto_cloudfront.py on lines 1070..1075
                                                                  salt/states/boto_cloudfront.py on lines 1168..1173

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

                                                                  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

                                                                      if old is None:
                                                                          ret['result'] = False
                                                                          msg = 'Error getting state of CloudFront distribution `{}`.'.format(ref)
                                                                          log.error(msg)
                                                                          ret['comment'] = msg
                                                                  Severity: Major
                                                                  Found in salt/states/boto_cloudfront.py and 7 other locations - About 1 hr to fix
                                                                  salt/states/boto_cloudfront.py on lines 483..488
                                                                  salt/states/boto_cloudfront.py on lines 551..556
                                                                  salt/states/boto_cloudfront.py on lines 934..939
                                                                  salt/states/boto_cloudfront.py on lines 1039..1044
                                                                  salt/states/boto_cloudfront.py on lines 1070..1075
                                                                  salt/states/boto_cloudfront.py on lines 1153..1158
                                                                  salt/states/boto_cloudfront.py on lines 1168..1173

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

                                                                  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

                                                                              if res is None:
                                                                                  ret['result'] = False
                                                                                  msg = 'Error occurred while updating distribution `{}`.'.format(Name)
                                                                                  log.error(msg)
                                                                                  ret['comment'] = msg
                                                                  Severity: Major
                                                                  Found in salt/states/boto_cloudfront.py and 7 other locations - About 1 hr to fix
                                                                  salt/states/boto_cloudfront.py on lines 483..488
                                                                  salt/states/boto_cloudfront.py on lines 915..920
                                                                  salt/states/boto_cloudfront.py on lines 934..939
                                                                  salt/states/boto_cloudfront.py on lines 1039..1044
                                                                  salt/states/boto_cloudfront.py on lines 1070..1075
                                                                  salt/states/boto_cloudfront.py on lines 1153..1158
                                                                  salt/states/boto_cloudfront.py on lines 1168..1173

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

                                                                  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

                                                                          if res is None:
                                                                              ret['result'] = False
                                                                              msg = 'Failed to create CloudFront origin access identity `{}`.'.format(Name)
                                                                              log.error(msg)
                                                                              ret['comment'] = msg
                                                                  Severity: Major
                                                                  Found in salt/states/boto_cloudfront.py and 7 other locations - About 1 hr to fix
                                                                  salt/states/boto_cloudfront.py on lines 483..488
                                                                  salt/states/boto_cloudfront.py on lines 551..556
                                                                  salt/states/boto_cloudfront.py on lines 915..920
                                                                  salt/states/boto_cloudfront.py on lines 934..939
                                                                  salt/states/boto_cloudfront.py on lines 1070..1075
                                                                  salt/states/boto_cloudfront.py on lines 1153..1158
                                                                  salt/states/boto_cloudfront.py on lines 1168..1173

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

                                                                  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

                                                                          if res is None:
                                                                              ret['result'] = False
                                                                              msg = 'Error occurred while updating origin access identity `{}`.'.format(Name)
                                                                              log.error(msg)
                                                                              ret['comment'] = msg
                                                                  Severity: Major
                                                                  Found in salt/states/boto_cloudfront.py and 7 other locations - About 1 hr to fix
                                                                  salt/states/boto_cloudfront.py on lines 483..488
                                                                  salt/states/boto_cloudfront.py on lines 551..556
                                                                  salt/states/boto_cloudfront.py on lines 915..920
                                                                  salt/states/boto_cloudfront.py on lines 934..939
                                                                  salt/states/boto_cloudfront.py on lines 1039..1044
                                                                  salt/states/boto_cloudfront.py on lines 1153..1158
                                                                  salt/states/boto_cloudfront.py on lines 1168..1173

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

                                                                  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 _yaml_safe_dump(attrs):
                                                                              '''
                                                                              Safely dump YAML using a readable flow style
                                                                              '''
                                                                              dumper_name = 'IndentedSafeOrderedDumper'
                                                                  Severity: Major
                                                                  Found in salt/states/boto_cloudfront.py and 1 other location - About 1 hr to fix
                                                                  salt/states/boto_s3.py on lines 265..271

                                                                  Duplicated Code

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

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

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

                                                                  Tuning

                                                                  This issue has a mass of 49.

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

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

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

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

                                                                  Refactorings

                                                                  Further Reading

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

                                                                          if 'error' in res:
                                                                              ret['result'] = False
                                                                              ret['comment'] = 'Error creating distribution {0}: {1}'.format(
                                                                                  name,
                                                                                  res['error'],
                                                                  Severity: Major
                                                                  Found in salt/states/boto_cloudfront.py and 10 other locations - About 1 hr to fix
                                                                  salt/states/boto_apigateway.py on lines 1771..1774
                                                                  salt/states/boto_apigateway.py on lines 1806..1809
                                                                  salt/states/boto_cloudfront.py on lines 133..139
                                                                  salt/states/boto_cloudfront.py on lines 226..232
                                                                  salt/states/boto_datapipeline.py on lines 150..154
                                                                  salt/states/boto_datapipeline.py on lines 178..182
                                                                  salt/states/boto_datapipeline.py on lines 192..196
                                                                  salt/states/boto_datapipeline.py on lines 211..216
                                                                  salt/states/boto_datapipeline.py on lines 225..229
                                                                  salt/states/boto_s3.py on lines 298..304

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

                                                                      if 'error' in res:
                                                                          ret['result'] = False
                                                                          ret['comment'] = 'Error checking distribution {0}: {1}'.format(
                                                                              name,
                                                                              res['error'],
                                                                  Severity: Major
                                                                  Found in salt/states/boto_cloudfront.py and 10 other locations - About 1 hr to fix
                                                                  salt/states/boto_apigateway.py on lines 1771..1774
                                                                  salt/states/boto_apigateway.py on lines 1806..1809
                                                                  salt/states/boto_cloudfront.py on lines 158..164
                                                                  salt/states/boto_cloudfront.py on lines 226..232
                                                                  salt/states/boto_datapipeline.py on lines 150..154
                                                                  salt/states/boto_datapipeline.py on lines 178..182
                                                                  salt/states/boto_datapipeline.py on lines 192..196
                                                                  salt/states/boto_datapipeline.py on lines 211..216
                                                                  salt/states/boto_datapipeline.py on lines 225..229
                                                                  salt/states/boto_s3.py on lines 298..304

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

                                                                          if 'error' in res:
                                                                              ret['result'] = False
                                                                              ret['comment'] = 'Error updating distribution {0}: {1}'.format(
                                                                                  name,
                                                                                  res['error'],
                                                                  Severity: Major
                                                                  Found in salt/states/boto_cloudfront.py and 10 other locations - About 1 hr to fix
                                                                  salt/states/boto_apigateway.py on lines 1771..1774
                                                                  salt/states/boto_apigateway.py on lines 1806..1809
                                                                  salt/states/boto_cloudfront.py on lines 133..139
                                                                  salt/states/boto_cloudfront.py on lines 158..164
                                                                  salt/states/boto_datapipeline.py on lines 150..154
                                                                  salt/states/boto_datapipeline.py on lines 178..182
                                                                  salt/states/boto_datapipeline.py on lines 192..196
                                                                  salt/states/boto_datapipeline.py on lines 211..216
                                                                  salt/states/boto_datapipeline.py on lines 225..229
                                                                  salt/states/boto_s3.py on lines 298..304

                                                                  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 correct:
                                                                                  comments += ['CloudFront distribution `{}` config would be updated.'.format(Name)]
                                                                                  old['DistributionConfig'] = copyOne
                                                                                  new['DistributionConfig'] = copyTwo
                                                                  Severity: Minor
                                                                  Found in salt/states/boto_cloudfront.py and 1 other location - About 55 mins to fix
                                                                  salt/states/boto_cloudfront.py on lines 538..541

                                                                  Duplicated Code

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

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

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

                                                                  Tuning

                                                                  This issue has a mass of 45.

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

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

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

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

                                                                  Refactorings

                                                                  Further Reading

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

                                                                          changes['old'] += [res['changes']['old']] if res['changes'].get('old') else []
                                                                  Severity: Minor
                                                                  Found in salt/states/boto_cloudfront.py and 1 other location - About 55 mins to fix
                                                                  salt/states/boto_cloudfront.py on lines 830..830

                                                                  Duplicated Code

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

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

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

                                                                  Tuning

                                                                  This issue has a mass of 45.

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

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

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

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

                                                                  Refactorings

                                                                  Further Reading

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

                                                                          changes['new'] += [res['changes']['new']] if res['changes'].get('new') else []
                                                                  Severity: Minor
                                                                  Found in salt/states/boto_cloudfront.py and 1 other location - About 55 mins to fix
                                                                  salt/states/boto_cloudfront.py on lines 829..829

                                                                  Duplicated Code

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

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

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

                                                                  Tuning

                                                                  This issue has a mass of 45.

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

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

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

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

                                                                  Refactorings

                                                                  Further Reading

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

                                                                              if not tags_correct:
                                                                                  comments += ['CloudFront distribution `{}` Tags would be updated.'.format(Name)]
                                                                                  old['Tags'] = currentTags
                                                                                  new['Tags'] = Tags
                                                                  Severity: Minor
                                                                  Found in salt/states/boto_cloudfront.py and 1 other location - About 55 mins to fix
                                                                  salt/states/boto_cloudfront.py on lines 534..537

                                                                  Duplicated Code

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

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

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

                                                                  Tuning

                                                                  This issue has a mass of 45.

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

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

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

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

                                                                  Refactorings

                                                                  Further Reading

                                                                  There are no issues that match your filters.

                                                                  Category
                                                                  Status