tlsfuzzer/tlslite-ng

View on GitHub
tlslite/checker.py

Summary

Maintainability
A
3 hrs
Test Coverage
C
72%

Function __call__ has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
Open

    def __call__(self, connection):
        """Check a TLSConnection.

        When a Checker is passed to a handshake function, this will
        be called at the end of the function.
Severity: Minor
Found in tlslite/checker.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

Avoid deeply nested control flow statements.
Open

                        if chain.getFingerprint() != self.x509Fingerprint:
                            raise TLSFingerprintError(\
                                "X.509 fingerprint mismatch: %s, %s" % \
                                (chain.getFingerprint(), self.x509Fingerprint))
                elif chain:
Severity: Major
Found in tlslite/checker.py - About 45 mins to fix

    The backslash is redundant between brackets
    Open

                                raise TLSFingerprintError(\
    Severity: Minor
    Found in tlslite/checker.py by pep8

    Avoid explicit line join between brackets.

    The preferred way of wrapping long lines is by using Python's
    implied line continuation inside parentheses, brackets and braces.
    Long lines can be broken over multiple lines by wrapping expressions
    in parentheses.  These should be used in preference to using a
    backslash for line continuation.
    
    E502: aaa = [123, \\n       123]
    E502: aaa = ("bbb " \\n       "ccc")
    
    Okay: aaa = [123,\n       123]
    Okay: aaa = ("bbb "\n       "ccc")
    Okay: aaa = "bbb " \\n    "ccc"
    Okay: aaa = 123  # \\

    The backslash is redundant between brackets
    Open

                                    "X.509 fingerprint mismatch: %s, %s" % \
    Severity: Minor
    Found in tlslite/checker.py by pep8

    Avoid explicit line join between brackets.

    The preferred way of wrapping long lines is by using Python's
    implied line continuation inside parentheses, brackets and braces.
    Long lines can be broken over multiple lines by wrapping expressions
    in parentheses.  These should be used in preference to using a
    backslash for line continuation.
    
    E502: aaa = [123, \\n       123]
    E502: aaa = ("bbb " \\n       "ccc")
    
    Okay: aaa = [123,\n       123]
    Okay: aaa = ("bbb "\n       "ccc")
    Okay: aaa = "bbb " \\n    "ccc"
    Okay: aaa = 123  # \\

    There are no issues that match your filters.

    Category
    Status