saltstack/salt

View on GitHub
salt/states/boto_iam.py

Summary

Maintainability
F
1 mo
Test Coverage

File boto_iam.py has 1489 lines of code (exceeds 250 allowed). Consider refactoring.
Open

# -*- coding: utf-8 -*-
'''
Manage IAM objects
==================

Severity: Major
Found in salt/states/boto_iam.py - About 3 days to fix

    Function user_absent has a Cognitive Complexity of 66 (exceeds 5 allowed). Consider refactoring.
    Open

    def user_absent(name, delete_keys=True, delete_mfa_devices=True, delete_profile=True, region=None, key=None, keyid=None, profile=None):
        '''
    
        .. versionadded:: 2015.8.0
    
    
    Severity: Minor
    Found in salt/states/boto_iam.py - About 1 day to fix

    Cognitive Complexity

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

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

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

    Further reading

    Function _group_policies_attached has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
    Open

    def _group_policies_attached(
            name,
            managed_policies=None,
            region=None,
            key=None,
    Severity: Minor
    Found in salt/states/boto_iam.py - About 3 hrs to fix

    Cognitive Complexity

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

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

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

    Further reading

    Function _user_policies_attached has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
    Open

    def _user_policies_attached(
            name,
            managed_policies=None,
            region=None,
            key=None,
    Severity: Minor
    Found in salt/states/boto_iam.py - About 3 hrs to fix

    Cognitive Complexity

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

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

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

    Further reading

    Function _group_policies_present has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
    Open

    def _group_policies_present(
            name,
            policies=None,
            region=None,
            key=None,
    Severity: Minor
    Found in salt/states/boto_iam.py - About 3 hrs to fix

    Cognitive Complexity

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

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

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

    Further reading

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

    def _user_policies_present(name, policies=None, region=None, key=None, keyid=None, profile=None):
        ret = {'result': True, 'comment': '', 'changes': {}}
        policies_to_create = {}
        policies_to_delete = []
        for policy_name, policy in six.iteritems(policies):
    Severity: Minor
    Found in salt/states/boto_iam.py - About 3 hrs to fix

    Cognitive Complexity

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

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

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

    Further reading

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

    def policy_present(name, policy_document, path=None, description=None,
                     region=None, key=None, keyid=None, profile=None):
        '''
    
        .. versionadded:: 2015.8.0
    Severity: Minor
    Found in salt/states/boto_iam.py - About 2 hrs to fix

    Cognitive Complexity

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

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

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

    Further reading

    Cyclomatic complexity is too high in function user_absent. (25)
    Open

    def user_absent(name, delete_keys=True, delete_mfa_devices=True, delete_profile=True, region=None, key=None, keyid=None, profile=None):
        '''
    
        .. versionadded:: 2015.8.0
    
    
    Severity: Minor
    Found in salt/states/boto_iam.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 group_absent has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
    Open

    def group_absent(name, region=None, key=None, keyid=None, profile=None):
        '''
    
        .. versionadded:: 2015.8.0
    
    
    Severity: Minor
    Found in salt/states/boto_iam.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 user_present has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
    Open

    def user_present(name, policies=None, policies_from_pillars=None, managed_policies=None, password=None, path=None,
                     region=None, key=None, keyid=None, profile=None):
        '''
    
        .. versionadded:: 2015.8.0
    Severity: Minor
    Found in salt/states/boto_iam.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 _case_group has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
    Open

    def _case_group(ret, users, group_name, existing_users, region, key, keyid, profile):
        _users = []
        for user in existing_users:
            _users.append(user['user_name'])
        log.debug('upstream users are %s', _users)
    Severity: Minor
    Found in salt/states/boto_iam.py - About 2 hrs to fix

    Cognitive Complexity

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

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

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

    Further reading

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

    def _group_policies_attached(
            name,
            managed_policies=None,
            region=None,
            key=None,
    Severity: Minor
    Found in salt/states/boto_iam.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 group_present has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
    Open

    def group_present(name, policies=None, policies_from_pillars=None, managed_policies=None, users=None, path='/', region=None, key=None, keyid=None, profile=None, delete_policies=True):
        '''
    
        .. versionadded:: 2015.8.0
    
    
    Severity: Minor
    Found in salt/states/boto_iam.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 server_cert_present has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
    Open

    def server_cert_present(name, public_key, private_key, cert_chain=None, path=None,
                            region=None, key=None, keyid=None, profile=None):
        '''
        Crete server certificate.
    
    
    Severity: Minor
    Found in salt/states/boto_iam.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 policy_absent has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
    Open

    def policy_absent(name,
                     region=None, key=None, keyid=None, profile=None):
        '''
    
        .. versionadded:: 2015.8.0
    Severity: Minor
    Found in salt/states/boto_iam.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 keys_present has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

    def keys_present(name, number, save_dir, region=None, key=None, keyid=None, profile=None,
                     save_format="{2}\n{0}\n{3}\n{1}\n"):
        '''
        .. versionadded:: 2015.8.0
    
    
    Severity: Minor
    Found in salt/states/boto_iam.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 _delete_key has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

    def _delete_key(ret, access_key_id, user_name, region=None, key=None, keyid=None, profile=None):
        keys = __salt__['boto_iam.get_all_access_keys'](user_name=user_name, region=region, key=key,
                                                        keyid=keyid, profile=profile)
        log.debug('Keys for user %s are : %s.', keys, user_name)
        if isinstance(keys, six.string_types):
    Severity: Minor
    Found in salt/states/boto_iam.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 account_policy has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

    def account_policy(name=None, allow_users_to_change_password=None,
                       hard_expiry=None, max_password_age=None,
                       minimum_password_length=None, password_reuse_prevention=None,
                       require_lowercase_characters=None, require_numbers=None,
                       require_symbols=None, require_uppercase_characters=None,
    Severity: Minor
    Found in salt/states/boto_iam.py - About 1 hr to fix

    Cognitive Complexity

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

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

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

    Further reading

    Avoid deeply nested control flow statements.
    Open

                        if _delete_key(ret, k['access_key_id'], name, region, key, keyid, profile):
                            ret['comment'] = ' '.join([ret['comment'], 'Key {0} has been deleted.'.format(k['access_key_id'])])
                            ret['changes'][k['access_key_id']] = 'deleted'
        # delete the user's MFA tokens
        if delete_mfa_devices:
    Severity: Major
    Found in salt/states/boto_iam.py - About 45 mins to fix

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

      def saml_provider_present(name, saml_metadata_document, region=None, key=None, keyid=None, profile=None):
          '''
          .. versionadded:: 2016.11.0
      
          Ensure the SAML provider with the specified name is present.
      Severity: Minor
      Found in salt/states/boto_iam.py - About 45 mins to fix

      Cognitive Complexity

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

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

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

      Further reading

      Avoid deeply nested control flow statements.
      Open

                          if mfa_deleted:
                              ret['comment'] = ' '.join([ret['comment'], 'Virtual MFA device {0} is deleted.'.format(serial)])
          # delete the user's login profile
          if delete_profile:
      Severity: Major
      Found in salt/states/boto_iam.py - About 45 mins to fix

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

            def _byteify(thing):
                # Note that we intentionally don't treat odicts here - they won't
                # compare equal in many circumstances where AWS treats them the same...
                if isinstance(thing, dict):
                    return dict([(_byteify(k), _byteify(v)) for k, v in six.iteritems(thing)])
        Severity: Minor
        Found in salt/states/boto_iam.py - About 45 mins to fix

        Cognitive Complexity

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

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

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

        Further reading

        Avoid deeply nested control flow statements.
        Open

                            if mfa_deactivated:
                                ret['comment'] = ' '.join([ret['comment'], 'IAM user {0} MFA device {1} is deactivated.'.format(name, serial)])
                        if __opts__['test']:
        Severity: Major
        Found in salt/states/boto_iam.py - About 45 mins to fix

          Avoid too many return statements within this function.
          Open

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

            Avoid too many return statements within this function.
            Open

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

              Avoid too many return statements within this function.
              Open

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

                Avoid too many return statements within this function.
                Open

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

                  Avoid too many return statements within this function.
                  Open

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

                    Avoid too many return statements within this function.
                    Open

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

                      Avoid too many return statements within this function.
                      Open

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

                        Avoid too many return statements within this function.
                        Open

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

                          Avoid too many return statements within this function.
                          Open

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

                            Avoid too many return statements within this function.
                            Open

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

                              Avoid too many return statements within this function.
                              Open

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

                                Avoid too many return statements within this function.
                                Open

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

                                  Avoid too many return statements within this function.
                                  Open

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

                                    Avoid too many return statements within this function.
                                    Open

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

                                      Avoid too many return statements within this function.
                                      Open

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

                                        Avoid too many return statements within this function.
                                        Open

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

                                          Avoid too many return statements within this function.
                                          Open

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

                                            Avoid too many return statements within this function.
                                            Open

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

                                              Avoid too many return statements within this function.
                                              Open

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

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

                                                def _case_password(ret, name, password, region=None, key=None, keyid=None, profile=None):
                                                    if __opts__['test']:
                                                        ret['comment'] = 'Login policy for {0} is set to be changed.'.format(name)
                                                        ret['result'] = None
                                                        return ret
                                                Severity: Minor
                                                Found in salt/states/boto_iam.py - About 25 mins to fix

                                                Cognitive Complexity

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

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

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

                                                Further reading

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

                                                    if policies_to_attach or policies_to_detach:
                                                        _to_modify = list(policies_to_detach)
                                                        _to_modify.extend(policies_to_attach)
                                                        if __opts__['test']:
                                                            ret['comment'] = '{0} policies to be modified on group {1}.'.format(', '.join(_to_modify), name)
                                                Severity: Major
                                                Found in salt/states/boto_iam.py and 1 other location - About 4 days to fix
                                                salt/states/boto_iam.py on lines 660..706

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

                                                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 policies_to_attach or policies_to_detach:
                                                        _to_modify = list(policies_to_detach)
                                                        _to_modify.extend(policies_to_attach)
                                                        if __opts__['test']:
                                                            ret['comment'] = '{0} policies to be modified on user {1}.'.format(', '.join(_to_modify), name)
                                                Severity: Major
                                                Found in salt/states/boto_iam.py and 1 other location - About 4 days to fix
                                                salt/states/boto_iam.py on lines 1109..1152

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

                                                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

                                                def _group_policies_detached(
                                                        name,
                                                        region=None,
                                                        key=None,
                                                        keyid=None,
                                                Severity: Major
                                                Found in salt/states/boto_iam.py and 2 other locations - About 3 days to fix
                                                salt/states/boto_iam.py on lines 710..748
                                                salt/states/boto_iam_role.py on lines 671..709

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

                                                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

                                                def _user_policies_detached(
                                                        name,
                                                        region=None,
                                                        key=None,
                                                        keyid=None,
                                                Severity: Major
                                                Found in salt/states/boto_iam.py and 2 other locations - About 3 days to fix
                                                salt/states/boto_iam.py on lines 1156..1194
                                                salt/states/boto_iam_role.py on lines 671..709

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

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

                                                    if policies_to_create or policies_to_delete:
                                                        _to_modify = list(policies_to_delete)
                                                        _to_modify.extend(policies_to_create)
                                                        if __opts__['test']:
                                                            ret['comment'] = '{0} policies to be modified on group {1}.'.format(', '.join(_to_modify), name)
                                                Severity: Major
                                                Found in salt/states/boto_iam.py and 1 other location - About 3 days to fix
                                                salt/states/boto_iam_role.py on lines 391..431

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

                                                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 _group_policies_deleted(
                                                        name,
                                                        region=None,
                                                        key=None,
                                                        keyid=None,
                                                Severity: Major
                                                Found in salt/states/boto_iam.py and 1 other location - About 3 days to fix
                                                salt/states/boto_iam.py on lines 751..786

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

                                                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 _user_policies_deleted(
                                                        name,
                                                        region=None,
                                                        key=None,
                                                        keyid=None,
                                                Severity: Major
                                                Found in salt/states/boto_iam.py and 1 other location - About 3 days to fix
                                                salt/states/boto_iam.py on lines 1197..1232

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

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

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

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

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

                                                Refactorings

                                                Further Reading

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

                                                    if __opts__['test']:
                                                        ret['comment'] = ' '.join([ret['comment'], 'IAM group {0} managed policies are set to be detached.'.format(name)])
                                                        ret['result'] = None
                                                    else:
                                                        _ret = _group_policies_detached(name, region, key, keyid, profile)
                                                Severity: Major
                                                Found in salt/states/boto_iam.py and 3 other locations - About 1 day to fix
                                                salt/states/boto_iam.py on lines 277..286
                                                salt/states/boto_iam.py on lines 287..296
                                                salt/states/boto_iam.py on lines 846..855

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

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

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

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

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

                                                Refactorings

                                                Further Reading

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

                                                    if __opts__['test']:
                                                        ret['comment'] = ' '.join([ret['comment'], 'IAM group {0} inline policies are set to be deleted.'.format(name)])
                                                        ret['result'] = None
                                                    else:
                                                        _ret = _group_policies_deleted(name, region, key, keyid, profile)
                                                Severity: Major
                                                Found in salt/states/boto_iam.py and 3 other locations - About 1 day to fix
                                                salt/states/boto_iam.py on lines 277..286
                                                salt/states/boto_iam.py on lines 287..296
                                                salt/states/boto_iam.py on lines 836..845

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

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

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

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

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

                                                Refactorings

                                                Further Reading

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

                                                    if __opts__['test']:
                                                        ret['comment'] = ' '.join([ret['comment'], 'IAM user {0} inline policies are set to be deleted.'.format(name)])
                                                        ret['result'] = None
                                                    else:
                                                        _ret = _user_policies_deleted(name, region, key, keyid, profile)
                                                Severity: Major
                                                Found in salt/states/boto_iam.py and 3 other locations - About 1 day to fix
                                                salt/states/boto_iam.py on lines 277..286
                                                salt/states/boto_iam.py on lines 836..845
                                                salt/states/boto_iam.py on lines 846..855

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

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

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

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

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

                                                Refactorings

                                                Further Reading

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

                                                    if __opts__['test']:
                                                        ret['comment'] = ' '.join([ret['comment'], 'IAM user {0} managed policies are set to be detached.'.format(name)])
                                                        ret['result'] = None
                                                    else:
                                                        _ret = _user_policies_detached(name, region, key, keyid, profile)
                                                Severity: Major
                                                Found in salt/states/boto_iam.py and 3 other locations - About 1 day to fix
                                                salt/states/boto_iam.py on lines 287..296
                                                salt/states/boto_iam.py on lines 836..845
                                                salt/states/boto_iam.py on lines 846..855

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

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

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

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

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

                                                Refactorings

                                                Further Reading

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

                                                    for policy_name, policy in six.iteritems(policies):
                                                        if isinstance(policy, six.string_types):
                                                            dict_policy = _byteify(salt.utils.json.loads(policy, object_pairs_hook=odict.OrderedDict))
                                                        else:
                                                            dict_policy = _byteify(policy)
                                                Severity: Major
                                                Found in salt/states/boto_iam.py and 1 other location - About 6 hrs to fix
                                                salt/states/boto_iam.py on lines 1023..1031

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

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

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

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

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

                                                Refactorings

                                                Further Reading

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

                                                    for policy_name, policy in six.iteritems(policies):
                                                        if isinstance(policy, six.string_types):
                                                            dict_policy = _byteify(salt.utils.json.loads(policy, object_pairs_hook=odict.OrderedDict))
                                                        else:
                                                            dict_policy = _byteify(policy)
                                                Severity: Major
                                                Found in salt/states/boto_iam.py and 1 other location - About 6 hrs to fix
                                                salt/states/boto_iam.py on lines 576..584

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

                                                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

                                                    for policy in managed_policies or []:
                                                        entities = __salt__['boto_iam.list_entities_for_policy'](policy,
                                                                                       entity_filter='Group',
                                                                                       region=region, key=key, keyid=keyid,
                                                                                       profile=profile)
                                                Severity: Major
                                                Found in salt/states/boto_iam.py and 2 other locations - About 5 hrs to fix
                                                salt/states/boto_iam.py on lines 641..652
                                                salt/states/boto_iam_role.py on lines 445..456

                                                Duplicated Code

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

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

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

                                                Tuning

                                                This issue has a mass of 99.

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

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

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

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

                                                Refactorings

                                                Further Reading

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

                                                    for policy in managed_policies or []:
                                                        entities = __salt__['boto_iam.list_entities_for_policy'](policy,
                                                                                       entity_filter='User',
                                                                                       region=region, key=key, keyid=keyid,
                                                                                       profile=profile)
                                                Severity: Major
                                                Found in salt/states/boto_iam.py and 2 other locations - About 5 hrs to fix
                                                salt/states/boto_iam.py on lines 1089..1100
                                                salt/states/boto_iam_role.py on lines 445..456

                                                Duplicated Code

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

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

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

                                                Tuning

                                                This issue has a mass of 99.

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

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

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

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

                                                Refactorings

                                                Further Reading

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

                                                def _get_error(error):
                                                    # Converts boto exception to string that can be used to output error.
                                                    error = '\n'.join(error.split('\n')[1:])
                                                    error = ET.fromstring(error)
                                                    code = error[0][1].text
                                                Severity: Major
                                                Found in salt/states/boto_iam.py and 1 other location - About 4 hrs to fix
                                                salt/states/boto_cfn.py on lines 268..274

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

                                                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 policy_unset:
                                                                _list = __salt__['boto_iam.get_all_user_policies'](
                                                                    user_name=name, region=region, key=key, keyid=keyid, profile=profile
                                                                )
                                                                ret['changes']['new'] = {'policies': _list}
                                                Severity: Major
                                                Found in salt/states/boto_iam.py and 1 other location - About 4 hrs to fix
                                                salt/states/boto_iam.py on lines 603..610

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

                                                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 policy_set:
                                                                _list = __salt__['boto_iam.get_all_user_policies'](
                                                                    user_name=name, region=region, key=key, keyid=keyid, profile=profile
                                                                )
                                                                ret['changes']['new'] = {'policies': _list}
                                                Severity: Major
                                                Found in salt/states/boto_iam.py and 1 other location - About 4 hrs to fix
                                                salt/states/boto_iam.py on lines 615..622

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

                                                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 cert_chain is not None and 'salt://' in cert_chain:
                                                        try:
                                                            cert_chain = __salt__['cp.get_file_str'](cert_chain)
                                                        except IOError as e:
                                                            log.debug(e)
                                                Severity: Major
                                                Found in salt/states/boto_iam.py and 1 other location - About 4 hrs to fix
                                                salt/states/boto_ec2.py on lines 91..98

                                                Duplicated Code

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

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

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

                                                Tuning

                                                This issue has a mass of 85.

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

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

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

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

                                                Refactorings

                                                Further Reading

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

                                                    if 'salt://' in public_key:
                                                        try:
                                                            public_key = __salt__['cp.get_file_str'](public_key)
                                                        except IOError as e:
                                                            log.debug(e)
                                                Severity: Major
                                                Found in salt/states/boto_iam.py and 1 other location - About 3 hrs to fix
                                                salt/states/boto_iam.py on lines 1421..1428

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

                                                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 'salt://' in private_key:
                                                        try:
                                                            private_key = __salt__['cp.get_file_str'](private_key)
                                                        except IOError as e:
                                                            log.debug(e)
                                                Severity: Major
                                                Found in salt/states/boto_iam.py and 1 other location - About 3 hrs to fix
                                                salt/states/boto_iam.py on lines 1413..1420

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

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

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

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

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

                                                Refactorings

                                                Further Reading

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

                                                    if deleted is True:
                                                        ret['comment'] = ' '.join([ret['comment'], 'IAM group {0} is deleted.'.format(name)])
                                                        ret['result'] = True
                                                        ret['changes']['deleted'] = name
                                                        return ret
                                                Severity: Major
                                                Found in salt/states/boto_iam.py and 1 other location - About 3 hrs to fix
                                                salt/states/boto_iam.py on lines 303..307

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

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

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

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

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

                                                Refactorings

                                                Further Reading

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

                                                    if deleted is True:
                                                        ret['comment'] = ' '.join([ret['comment'], 'IAM user {0} is deleted.'.format(name)])
                                                        ret['result'] = True
                                                        ret['changes']['deleted'] = name
                                                        return ret
                                                Severity: Major
                                                Found in salt/states/boto_iam.py and 1 other location - About 3 hrs to fix
                                                salt/states/boto_iam.py on lines 870..874

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

                                                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 not r.get('created'):
                                                                ret['result'] = False
                                                                ret['comment'] = 'Failed to update policy: {0}.'.format(r['error']['message'])
                                                                ret['changes'] = {}
                                                                return ret
                                                Severity: Major
                                                Found in salt/states/boto_iam.py and 7 other locations - About 2 hrs to fix
                                                salt/states/boto_cloudtrail.py on lines 205..209
                                                salt/states/boto_cloudtrail.py on lines 275..279
                                                salt/states/boto_cloudtrail.py on lines 284..288
                                                salt/states/boto_cloudtrail.py on lines 292..296
                                                salt/states/boto_cloudwatch_event.py on lines 236..240
                                                salt/states/boto_iot.py on lines 392..396
                                                salt/states/boto_lambda.py on lines 444..449

                                                Duplicated Code

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

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

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

                                                Tuning

                                                This issue has a mass of 68.

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

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

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

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

                                                Refactorings

                                                Further Reading

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

                                                    for policy_data in _list:
                                                        if policy_data.get('policy_name') not in managed_policies \
                                                                  and policy_data.get('policy_arn') not in managed_policies:
                                                            policies_to_detach.append(policy_data.get('policy_arn'))
                                                Severity: Major
                                                Found in salt/states/boto_iam.py and 1 other location - About 2 hrs to fix
                                                salt/states/boto_iam_role.py on lines 460..463

                                                Duplicated Code

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

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

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

                                                Tuning

                                                This issue has a mass of 54.

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

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

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

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

                                                Refactorings

                                                Further Reading

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

                                                    if __opts__['test']:
                                                        ret['comment'] = ' '.join([ret['comment'], 'IAM user {0} is set to be deleted.'.format(name)])
                                                        ret['result'] = None
                                                        return ret
                                                Severity: Major
                                                Found in salt/states/boto_iam.py and 1 other location - About 1 hr to fix
                                                salt/states/boto_iam.py on lines 865..868

                                                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 __opts__['test']:
                                                        ret['comment'] = ' '.join([ret['comment'], 'IAM group {0} is set to be deleted.'.format(name)])
                                                        ret['result'] = None
                                                        return ret
                                                Severity: Major
                                                Found in salt/states/boto_iam.py and 1 other location - About 1 hr to fix
                                                salt/states/boto_iam.py on lines 298..301

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

                                                    if not __salt__['boto_iam.get_group'](name, region, key, keyid, profile):
                                                        ret['result'] = True
                                                        ret['comment'] = 'IAM Group {0} does not exist.'.format(name)
                                                        return ret
                                                Severity: Major
                                                Found in salt/states/boto_iam.py and 4 other locations - About 1 hr to fix
                                                salt/states/boto_elbv2.py on lines 176..179
                                                salt/states/boto_iam.py on lines 229..232
                                                salt/states/boto_iam.py on lines 350..353
                                                salt/states/boto_iam.py on lines 444..447

                                                Duplicated Code

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

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

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

                                                Tuning

                                                This issue has a mass of 53.

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

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

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

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

                                                Refactorings

                                                Further Reading

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

                                                    if not __salt__['boto_iam.get_user'](name, region, key, keyid, profile):
                                                        ret['result'] = True
                                                        ret['comment'] = 'IAM User {0} does not exist.'.format(name)
                                                        return ret
                                                Severity: Major
                                                Found in salt/states/boto_iam.py and 4 other locations - About 1 hr to fix
                                                salt/states/boto_elbv2.py on lines 176..179
                                                salt/states/boto_iam.py on lines 350..353
                                                salt/states/boto_iam.py on lines 444..447
                                                salt/states/boto_iam.py on lines 832..835

                                                Duplicated Code

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

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

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

                                                Tuning

                                                This issue has a mass of 53.

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

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

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

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

                                                Refactorings

                                                Further Reading

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

                                                    if not __salt__['boto_iam.get_user'](user_name, region, key, keyid, profile):
                                                        ret['result'] = False
                                                        ret['comment'] = 'IAM User {0} does not exist.'.format(user_name)
                                                        return ret
                                                Severity: Major
                                                Found in salt/states/boto_iam.py and 4 other locations - About 1 hr to fix
                                                salt/states/boto_elbv2.py on lines 176..179
                                                salt/states/boto_iam.py on lines 229..232
                                                salt/states/boto_iam.py on lines 350..353
                                                salt/states/boto_iam.py on lines 832..835

                                                Duplicated Code

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

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

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

                                                Tuning

                                                This issue has a mass of 53.

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

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

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

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

                                                Refactorings

                                                Further Reading

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

                                                    if not __salt__['boto_iam.get_user'](name, region, key, keyid, profile):
                                                        ret['result'] = False
                                                        ret['comment'] = 'IAM User {0} does not exist.'.format(name)
                                                        return ret
                                                Severity: Major
                                                Found in salt/states/boto_iam.py and 4 other locations - About 1 hr to fix
                                                salt/states/boto_elbv2.py on lines 176..179
                                                salt/states/boto_iam.py on lines 229..232
                                                salt/states/boto_iam.py on lines 444..447
                                                salt/states/boto_iam.py on lines 832..835

                                                Duplicated Code

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

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

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

                                                Tuning

                                                This issue has a mass of 53.

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

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

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

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

                                                Refactorings

                                                Further Reading

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

                                                def __virtual__():
                                                    '''
                                                    Only load if elementtree xml library and boto are available.
                                                    '''
                                                    if not HAS_ELEMENT_TREE:
                                                Severity: Major
                                                Found in salt/states/boto_iam.py and 1 other location - About 1 hr to fix
                                                salt/states/boto_cfn.py on lines 62..72

                                                Duplicated Code

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

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

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

                                                Tuning

                                                This issue has a mass of 53.

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

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

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

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

                                                Refactorings

                                                Further Reading

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

                                                        if isinstance(_describe['document'], six.string_types):
                                                            describeDict = salt.utils.json.loads(_describe['document'])
                                                        else:
                                                            describeDict = _describe['document']
                                                Severity: Major
                                                Found in salt/states/boto_iam.py and 5 other locations - About 1 hr to fix
                                                salt/cloud/clouds/ec2.py on lines 2954..2957
                                                salt/cloud/clouds/ec2.py on lines 4252..4255
                                                salt/cloud/clouds/msazure.py on lines 708..711
                                                salt/cloud/clouds/msazure.py on lines 802..805
                                                salt/states/boto_iot.py on lines 368..371

                                                Duplicated Code

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

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

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

                                                Tuning

                                                This issue has a mass of 50.

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

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

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

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

                                                Refactorings

                                                Further Reading

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

                                                    if not os.path.isdir(save_dir):
                                                        ret['comment'] = 'The directory {0} does not exist.'.format(save_dir)
                                                        ret['result'] = False
                                                        return ret
                                                Severity: Major
                                                Found in salt/states/boto_iam.py and 5 other locations - About 1 hr to fix
                                                salt/states/linux_acl.py on lines 111..114
                                                salt/states/linux_acl.py on lines 250..253
                                                salt/states/linux_acl.py on lines 347..350
                                                salt/states/linux_acl.py on lines 536..539
                                                salt/states/mysql_query.py on lines 108..111

                                                Duplicated Code

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

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

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

                                                Tuning

                                                This issue has a mass of 47.

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

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

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

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

                                                Refactorings

                                                Further Reading

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

                                                        new_keys[six.text_type(i)]['key_id'] = created[response][result]['access_key']['access_key_id']
                                                Severity: Major
                                                Found in salt/states/boto_iam.py and 1 other location - About 1 hr to fix
                                                salt/states/boto_iam.py on lines 393..393

                                                Duplicated Code

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

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

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

                                                Tuning

                                                This issue has a mass of 47.

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

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

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

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

                                                Refactorings

                                                Further Reading

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

                                                        new_keys[six.text_type(i)]['secret_key'] = created[response][result]['access_key']['secret_access_key']
                                                Severity: Major
                                                Found in salt/states/boto_iam.py and 1 other location - About 1 hr to fix
                                                salt/states/boto_iam.py on lines 392..392

                                                Duplicated Code

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

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

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

                                                Tuning

                                                This issue has a mass of 47.

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

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

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

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

                                                Refactorings

                                                Further Reading

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

                                                            if __opts__['test']:
                                                                ret['comment'] = ' '.join([ret['comment'], 'User {0} is set to be removed from group {1}.'.format(user, group_name)])
                                                                ret['result'] = None
                                                Severity: Minor
                                                Found in salt/states/boto_iam.py and 1 other location - About 55 mins to fix
                                                salt/states/boto_iam.py on lines 254..256

                                                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 __opts__['test']:
                                                                    ret['comment'] = ' '.join([ret['comment'], 'IAM user {0} MFA device {1} is set to be deactivated.'.format(name, serial)])
                                                                    ret['result'] = None
                                                Severity: Minor
                                                Found in salt/states/boto_iam.py and 1 other location - About 55 mins to fix
                                                salt/states/boto_iam.py on lines 1001..1003

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

                                                    if created:
                                                        ret['comment'] = 'SAML provider {0} was created.'.format(name)
                                                        ret['changes']['new'] = name
                                                        return ret
                                                Severity: Minor
                                                Found in salt/states/boto_iam.py and 2 other locations - About 35 mins to fix
                                                salt/states/boto_cfn.py on lines 198..201
                                                salt/states/boto_cfn.py on lines 237..240

                                                Duplicated Code

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

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

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

                                                Tuning

                                                This issue has a mass of 41.

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

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

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

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

                                                Refactorings

                                                Further Reading

                                                There are no issues that match your filters.

                                                Category
                                                Status