saltstack/salt

View on GitHub
salt/modules/x509.py

Summary

Maintainability
F
1 wk
Test Coverage

File x509.py has 1411 lines of code (exceeds 250 allowed). Consider refactoring.
Open

# -*- coding: utf-8 -*-
'''
Manage X509 certificates

.. versionadded:: 2015.8.0
Severity: Major
Found in salt/modules/x509.py - About 3 days to fix

    Function create_certificate has a Cognitive Complexity of 84 (exceeds 5 allowed). Consider refactoring.
    Open

    def create_certificate(
            path=None, text=False, overwrite=True, ca_server=None, **kwargs):
        '''
        Create an X509 certificate.
    
    
    Severity: Minor
    Found in salt/modules/x509.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

    Cyclomatic complexity is too high in function create_certificate. (60)
    Open

    def create_certificate(
            path=None, text=False, overwrite=True, ca_server=None, **kwargs):
        '''
        Create an X509 certificate.
    
    
    Severity: Minor
    Found in salt/modules/x509.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 create_csr has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring.
    Open

    def create_csr(path=None, text=False, **kwargs):
        '''
        Create a certificate signing request.
    
        path:
    Severity: Minor
    Found in salt/modules/x509.py - About 4 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 _parse_openssl_crl has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
    Open

    def _parse_openssl_crl(crl_filename):
        '''
        Parses openssl command line output, this is a workaround for M2Crypto's
        inability to get them from CSR objects.
        '''
    Severity: Minor
    Found in salt/modules/x509.py - About 4 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 create_csr. (31)
    Open

    def create_csr(path=None, text=False, **kwargs):
        '''
        Create a certificate signing request.
    
        path:
    Severity: Minor
    Found in salt/modules/x509.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 get_pem_entry has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
    Open

    def get_pem_entry(text, pem_type=None):
        '''
        Returns a properly formatted PEM string from the input text fixing
        any whitespace or line-break issues
    
    
    Severity: Minor
    Found in salt/modules/x509.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 create_crl has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
    Open

    def create_crl(  # pylint: disable=too-many-arguments,too-many-locals
            path=None, text=False, signing_private_key=None,
            signing_private_key_passphrase=None,
            signing_cert=None, revoked=None, include_expired=False,
            days_valid=100, digest=''):
    Severity: Minor
    Found in salt/modules/x509.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 sign_remote_certificate has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
    Open

    def sign_remote_certificate(argdic, **kwargs):
        '''
        Request a certificate to be remotely signed according to a signing policy.
    
        argdic:
    Severity: Minor
    Found in salt/modules/x509.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 create_certificate has 31 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    def create_certificate(
            path=None, text=False, overwrite=True, ca_server=None, **kwargs):
        '''
        Create an X509 certificate.
    
    
    Severity: Minor
    Found in salt/modules/x509.py - About 1 hr to fix

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

      def get_public_key(key, passphrase=None, asObj=False):
          '''
          Returns a string containing the public key in PEM format.
      
          key:
      Severity: Minor
      Found in salt/modules/x509.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 _get_csr_extensions has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

      def _get_csr_extensions(csr):
          '''
          Returns a list of dicts containing the name, value and critical value of
          any extension contained in a csr object.
          '''
      Severity: Minor
      Found in salt/modules/x509.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

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

      def write_pem(text, path, overwrite=True, pem_type=None):
          '''
          Writes out a PEM string fixing any formatting or whitespace
          issues before writing.
      
      
      Severity: Minor
      Found in salt/modules/x509.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

      Function _parse_subject has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

      def _parse_subject(subject):
          '''
          Returns a dict containing all values in an X509 Subject
          '''
          ret = {}
      Severity: Minor
      Found in salt/modules/x509.py - About 35 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

      Function create_private_key has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

      def create_private_key(path=None,
                             text=False,
                             bits=2048,
                             passphrase=None,
                             cipher='aes_128_cbc',
      Severity: Minor
      Found in salt/modules/x509.py - About 35 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 six.text_type(except_)
      Severity: Major
      Found in salt/modules/x509.py - About 30 mins to fix

        Avoid too many return statements within this function.
        Open

                return salt.utils.stringutils.to_str(cert.as_pem())
        Severity: Major
        Found in salt/modules/x509.py - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

                  return create_certificate(path=None, text=True, **argdic)
          Severity: Major
          Found in salt/modules/x509.py - About 30 mins to fix

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

            def get_signing_policy(signing_policy_name):
                '''
                Returns the details of a names signing policy, including the text of
                the public key that will be used to sign it. Does not return the
                private key.
            Severity: Minor
            Found in salt/modules/x509.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

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

            def read_certificates(glob_path):
                '''
                Returns a dict containing details of all certificates matching a glob
            
                glob_path:
            Severity: Minor
            Found in salt/modules/x509.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

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

            def get_pem_entries(glob_path):
                '''
                Returns a dict containing PEM entries in files matching a glob
            
                glob_path:
            Severity: Minor
            Found in salt/modules/x509.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

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

            def expired(certificate):
                '''
                Returns a dict containing limited details of a
                certificate and whether the certificate has expired.
            
            
            Severity: Minor
            Found in salt/modules/x509.py - About 25 mins to fix

            Cognitive Complexity

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

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

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

            Further reading

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

            def get_pem_entries(glob_path):
                '''
                Returns a dict containing PEM entries in files matching a glob
            
                glob_path:
            Severity: Major
            Found in salt/modules/x509.py and 1 other location - About 3 hrs to fix
            salt/modules/x509.py on lines 591..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 78.

            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 read_certificates(glob_path):
                '''
                Returns a dict containing details of all certificates matching a glob
            
                glob_path:
            Severity: Major
            Found in salt/modules/x509.py and 1 other location - About 3 hrs to fix
            salt/modules/x509.py on lines 512..534

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

            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 line.startswith('Last Update: '):
                        crl['Last Update'] = line.replace('Last Update: ', '')
                        last_update = datetime.datetime.strptime(
                            crl['Last Update'], "%b %d %H:%M:%S %Y %Z")
                        crl['Last Update'] = last_update.strftime("%Y-%m-%d %H:%M:%S")
            Severity: Major
            Found in salt/modules/x509.py and 1 other location - About 2 hrs to fix
            salt/modules/x509.py on lines 247..251

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

            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 line.startswith('Next Update: '):
                        crl['Next Update'] = line.replace('Next Update: ', '')
                        next_update = datetime.datetime.strptime(
                            crl['Next Update'], "%b %d %H:%M:%S %Y %Z")
                        crl['Next Update'] = next_update.strftime("%Y-%m-%d %H:%M:%S")
            Severity: Major
            Found in salt/modules/x509.py and 1 other location - About 2 hrs to fix
            salt/modules/x509.py on lines 242..246

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

            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 entry, num in six.iteritems(subject.nid):
                    if entry in kwargs:
                        setattr(subject, entry, kwargs[entry])
            Severity: Major
            Found in salt/modules/x509.py and 1 other location - About 1 hr to fix
            salt/modules/x509.py on lines 1665..1667

            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

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

                for entry, num in six.iteritems(subject.nid):
                    if entry in kwargs:
                        setattr(subject, entry, kwargs[entry])
            Severity: Major
            Found in salt/modules/x509.py and 1 other location - About 1 hr to fix
            salt/modules/x509.py on lines 1495..1497

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

                        try:
                            _dhparams = get_pem_entry(_filecontents, 'DH PARAMETERS')
                        except salt.exceptions.SaltInvocationError as err:
                            log.debug("Error when getting DH PARAMETERS: %s", err)
                            log.trace(err, exc_info=err)
            Severity: Major
            Found in salt/modules/x509.py and 1 other location - About 1 hr to fix
            salt/modules/x509.py on lines 779..783

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

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

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

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

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

            Refactorings

            Further Reading

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

                        try:
                            _private_key = get_pem_entry(_filecontents, '(?:RSA )?PRIVATE KEY')
                        except salt.exceptions.SaltInvocationError as err:
                            log.debug("Error when getting PRIVATE KEY: %s", err)
                            log.trace(err, exc_info=err)
            Severity: Major
            Found in salt/modules/x509.py and 1 other location - About 1 hr to fix
            salt/modules/x509.py on lines 774..778

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

            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 'public_key' not in kwargs and 'csr' not in kwargs:
                    kwargs['public_key'] = kwargs['signing_private_key']
                    if 'signing_private_key_passphrase' in kwargs:
                        kwargs['public_key_passphrase'] = kwargs[
            Severity: Minor
            Found in salt/modules/x509.py and 1 other location - About 55 mins to fix
            salt/cloud/clouds/ec2.py on lines 4224..4227

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

                if kwargs['private_key_passphrase'] and not kwargs['public_key_passphrase']:
                    kwargs['public_key_passphrase'] = kwargs['private_key_passphrase']
            Severity: Major
            Found in salt/modules/x509.py and 3 other locations - About 40 mins to fix
            salt/auth/ldap.py on lines 269..270
            salt/auth/ldap.py on lines 236..272
            salt/modules/x509.py on lines 1656..1657

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

                if kwargs['public_key_passphrase'] and not kwargs['private_key_passphrase']:
                    kwargs['private_key_passphrase'] = kwargs['public_key_passphrase']
            Severity: Major
            Found in salt/modules/x509.py and 3 other locations - About 40 mins to fix
            salt/auth/ldap.py on lines 269..270
            salt/auth/ldap.py on lines 236..272
            salt/modules/x509.py on lines 1658..1659

            Duplicated Code

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

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

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

            Tuning

            This issue has a mass of 42.

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

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

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

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

            Refactorings

            Further Reading

            There are no issues that match your filters.

            Category
            Status