saltstack/salt

View on GitHub
salt/modules/gpg.py

Summary

Maintainability
F
2 wks
Test Coverage

File gpg.py has 1001 lines of code (exceeds 250 allowed). Consider refactoring.
Open

# -*- coding: utf-8 -*-
'''
Manage a GPG keychains, add keys, create keys, retrieve keys from keyservers.
Sign, encrypt and sign plus encrypt text and files.

Severity: Major
Found in salt/modules/gpg.py - About 2 days to fix

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

    def encrypt(user=None,
                recipients=None,
                text=None,
                filename=None,
                output=None,
    Severity: Minor
    Found in salt/modules/gpg.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 trust_key has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
    Open

    def trust_key(keyid=None,
                  fingerprint=None,
                  trust_level=None,
                  user=None):
        '''
    Severity: Minor
    Found in salt/modules/gpg.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 decrypt has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
    Open

    def decrypt(user=None,
                text=None,
                filename=None,
                output=None,
                use_passphrase=False,
    Severity: Minor
    Found in salt/modules/gpg.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 get_secret_key has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
    Open

    def get_secret_key(keyid=None, fingerprint=None, user=None, gnupghome=None):
        '''
        Get a key from the GPG keychain
    
        keyid
    Severity: Minor
    Found in salt/modules/gpg.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 get_key has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
    Open

    def get_key(keyid=None, fingerprint=None, user=None, gnupghome=None):
        '''
        Get a key from the GPG keychain
    
        keyid
    Severity: Minor
    Found in salt/modules/gpg.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 import_key has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
    Open

    def import_key(text=None,
                   filename=None,
                   user=None,
                   gnupghome=None):
        r'''
    Severity: Minor
    Found in salt/modules/gpg.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 _restore_ownership has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
    Open

    def _restore_ownership(func):
        @functools.wraps(func)
        def func_wrapper(*args, **kwargs):
            '''
            Wrap gpg function calls to fix permissions
    Severity: Minor
    Found in salt/modules/gpg.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 search_keys has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
    Open

    def search_keys(text, keyserver=None, user=None):
        '''
        Search keys from keyserver
    
        text
    Severity: Minor
    Found in salt/modules/gpg.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 sign has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
    Open

    def sign(user=None,
             keyid=None,
             text=None,
             filename=None,
             output=None,
    Severity: Minor
    Found in salt/modules/gpg.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 list_keys has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

    def list_keys(user=None, gnupghome=None):
        '''
        List keys in GPG keychain
    
        user
    Severity: Minor
    Found in salt/modules/gpg.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 list_secret_keys has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

    def list_secret_keys(user=None, gnupghome=None):
        '''
        List secret keys in GPG keychain
    
        user
    Severity: Minor
    Found in salt/modules/gpg.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 create_key has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

    def create_key(key_type='RSA',
                   key_length=1024,
                   name_real='Autogenerated Key',
                   name_comment='Generated by SaltStack',
                   name_email=None,
    Severity: Minor
    Found in salt/modules/gpg.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 verify has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

    def verify(text=None,
               user=None,
               filename=None,
               gnupghome=None,
               signature=None,
    Severity: Minor
    Found in salt/modules/gpg.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 receive_keys has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

    def receive_keys(keyserver=None, keys=None, user=None, gnupghome=None):
        '''
        Receive key(s) from keyserver and add them to keychain
    
        keyserver
    Severity: Minor
    Found in salt/modules/gpg.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 9 (exceeds 5 allowed). Consider refactoring.
    Open

    def delete_key(keyid=None,
                   fingerprint=None,
                   delete_secret=False,
                   user=None,
                   gnupghome=None):
    Severity: Minor
    Found in salt/modules/gpg.py - About 55 mins to fix

    Cognitive Complexity

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

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

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

    Further reading

    Avoid too many return statements within this function.
    Open

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

      Avoid too many return statements within this function.
      Open

              return 'ERROR: Valid trust levels - {0}'.format(','.join(_VALID_TRUST_LEVELS))
      Severity: Major
      Found in salt/modules/gpg.py - About 30 mins to fix

        Avoid too many return statements within this function.
        Open

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

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

          def _get_user_info(user=None):
              '''
              Wrapper for user.info Salt function
              '''
              if not user:
          Severity: Minor
          Found in salt/modules/gpg.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

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

              for _key in _list_keys(user, gnupghome):
                  if (_key['fingerprint'] == fingerprint or
                          _key['keyid'] == keyid or
                          _key['keyid'][8:] == keyid):
                      tmp['keyid'] = _key['keyid']
          Severity: Major
          Found in salt/modules/gpg.py and 1 other location - About 3 days to fix
          salt/modules/gpg.py on lines 650..675

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

          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 _key in _list_keys(user, gnupghome, secret=True):
                  if (_key['fingerprint'] == fingerprint or
                          _key['keyid'] == keyid or
                          _key['keyid'][8:] == keyid):
                      tmp['keyid'] = _key['keyid']
          Severity: Major
          Found in salt/modules/gpg.py and 1 other location - About 3 days to fix
          salt/modules/gpg.py on lines 588..613

          Duplicated Code

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

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

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

          Tuning

          This issue has a mass of 314.

          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 _key in _list_keys(user, gnupghome):
                  tmp = {'keyid': _key['keyid'],
                         'fingerprint': _key['fingerprint'],
                         'uids': _key['uids']}
          
          
          Severity: Major
          Found in salt/modules/gpg.py and 1 other location - About 2 days to fix
          salt/modules/gpg.py on lines 332..355

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

          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 _key in _list_keys(user, gnupghome, secret=True):
                  tmp = {'keyid': _key['keyid'],
                         'fingerprint': _key['fingerprint'],
                         'uids': _key['uids']}
          
          
          Severity: Major
          Found in salt/modules/gpg.py and 1 other location - About 2 days to fix
          salt/modules/gpg.py on lines 285..308

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

          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 result.ok:
                  if not bare:
                      if output:
                          ret['comment'] = 'Decrypted data has been written to {0}'.format(output)
                      else:
          Severity: Major
          Found in salt/modules/gpg.py and 1 other location - About 6 hrs to fix
          salt/modules/gpg.py on lines 1208..1222

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

          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 result.ok:
                  if not bare:
                      if output:
                          ret['comment'] = 'Encrypted data has been written to {0}'.format(output)
                      else:
          Severity: Major
          Found in salt/modules/gpg.py and 1 other location - About 6 hrs to fix
          salt/modules/gpg.py on lines 1294..1309

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

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

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

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

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

          Refactorings

          Further Reading

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

              if use_passphrase:
                  gpg_passphrase = __salt__['pillar.get']('gpg_passphrase')
                  if not gpg_passphrase:
                      raise SaltInvocationError('gpg_passphrase not available in pillar.')
                  gpg_passphrase = gpg_passphrase['gpg_passphrase']
          Severity: Major
          Found in salt/modules/gpg.py and 1 other location - About 2 hrs to fix
          salt/modules/gpg.py on lines 1181..1187

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

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

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

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

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

          Refactorings

          Further Reading

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

              if use_passphrase:
                  gpg_passphrase = __salt__['pillar.get']('gpg_passphrase')
                  if not gpg_passphrase:
                      raise SaltInvocationError('gpg_passphrase not available in pillar.')
                  gpg_passphrase = gpg_passphrase['gpg_passphrase']
          Severity: Major
          Found in salt/modules/gpg.py and 1 other location - About 2 hrs to fix
          salt/modules/gpg.py on lines 1275..1281

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

          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 text:
                  if gnupg_version >= '1.3.1':
                      signed_data = gpg.sign(text, default_key=keyid, passphrase=gpg_passphrase)
                  else:
                      signed_data = gpg.sign(text, keyid=keyid, passphrase=gpg_passphrase)
          Severity: Major
          Found in salt/modules/gpg.py and 1 other location - About 1 hr to fix
          salt/modules/gpg.py on lines 1017..1021

          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

                  with salt.utils.files.flopen(filename, 'rb') as _fp:
                      if gnupg_version >= '1.3.1':
                          signed_data = gpg.sign(text, default_key=keyid, passphrase=gpg_passphrase)
                      else:
                          signed_data = gpg.sign_file(_fp, keyid=keyid, passphrase=gpg_passphrase)
          Severity: Major
          Found in salt/modules/gpg.py and 1 other location - About 1 hr to fix
          salt/modules/gpg.py on lines 1011..1015

          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 not fingerprint and not keyid:
                  ret['res'] = False
                  ret['message'] = 'Required argument, fingerprint or keyid'
                  return ret
          Severity: Minor
          Found in salt/modules/gpg.py and 1 other location - About 40 mins to fix
          salt/states/cryptdev.py on lines 88..91

          Duplicated Code

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

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

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

          Tuning

          This issue has a mass of 42.

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

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

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

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

          Refactorings

          Further Reading

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

                          if 'fingerprint' not in key:
                              ret['res'] = False
                              ret['message'] = 'Fingerprint not found for keyid {0}'.format(keyid)
                              return ret
          Severity: Major
          Found in salt/modules/gpg.py and 14 other locations - About 35 mins to fix
          salt/states/azurearm_compute.py on lines 257..260
          salt/states/azurearm_dns.py on lines 298..301
          salt/states/azurearm_dns.py on lines 617..620
          salt/states/azurearm_network.py on lines 252..255
          salt/states/azurearm_network.py on lines 457..460
          salt/states/azurearm_network.py on lines 665..668
          salt/states/azurearm_network.py on lines 1046..1049
          salt/states/azurearm_network.py on lines 1472..1475
          salt/states/azurearm_network.py on lines 1721..1724
          salt/states/azurearm_network.py on lines 2041..2044
          salt/states/azurearm_network.py on lines 2245..2248
          salt/states/azurearm_network.py on lines 2441..2444
          salt/states/azurearm_resource.py on lines 538..541
          salt/states/azurearm_resource.py on lines 747..750

          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