tlsfuzzer/tlslite-ng

View on GitHub
tlslite/recordlayer.py

Summary

Maintainability
F
1 wk
Test Coverage
A
96%

File recordlayer.py has 1047 lines of code (exceeds 250 allowed). Consider refactoring.
Open

# Copyright (c) 2014, Hubert Kario
#
# See the LICENSE file for legal information regarding use of this file.

"""Implementation of the TLS Record Layer protocol"""
Severity: Major
Found in tlslite/recordlayer.py - About 2 days to fix

    RecordLayer has 45 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class RecordLayer(object):
    
        """
        Implementation of TLS record layer protocol
    
    
    Severity: Minor
    Found in tlslite/recordlayer.py - About 6 hrs to fix

      Cyclomatic complexity is too high in method recvRecord. (37)
      Open

          def recvRecord(self):
              """
              Read, decrypt and check integrity of a single record
      
              :rtype: tuple
      Severity: Minor
      Found in tlslite/recordlayer.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 recvRecord has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring.
      Open

          def recvRecord(self):
              """
              Read, decrypt and check integrity of a single record
      
              :rtype: tuple
      Severity: Minor
      Found in tlslite/recordlayer.py - About 5 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 _recvHeader has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
      Open

          def _recvHeader(self):
              """Read a single record header from socket"""
              #Read the next record header
              buf = bytearray(0)
              ssl2 = False
      Severity: Minor
      Found in tlslite/recordlayer.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 _macThenDecrypt has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
      Open

          def _macThenDecrypt(self, recordType, buf):
              """
              Check MAC of data, then decrypt and remove padding
      
              :raises TLSBadRecordMAC: when the mac value is invalid
      Severity: Minor
      Found in tlslite/recordlayer.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

      Consider simplifying this complex logical expression.
      Open

                      if isinstance(header, RecordHeader2):
                          data = self._decryptSSL2(data, header.padding)
                          if self.handshake_finished:
                              header.type = ContentType.application_data
                      # in TLS 1.3, the other party may send an unprotected CCS
      Severity: Critical
      Found in tlslite/recordlayer.py - About 2 hrs to fix

        Cyclomatic complexity is too high in method _recvHeader. (16)
        Open

            def _recvHeader(self):
                """Read a single record header from socket"""
                #Read the next record header
                buf = bytearray(0)
                ssl2 = False
        Severity: Minor
        Found in tlslite/recordlayer.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

        Cyclomatic complexity is too high in method _getCipherSettings. (14)
        Open

            @staticmethod
            def _getCipherSettings(cipherSuite):
                """Get the settings for cipher suite used"""
                if cipherSuite in CipherSuite.aes256GcmSuites:
                    keyLength = 32
        Severity: Minor
        Found in tlslite/recordlayer.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

        Cyclomatic complexity is too high in method _macThenDecrypt. (13)
        Open

            def _macThenDecrypt(self, recordType, buf):
                """
                Check MAC of data, then decrypt and remove padding
        
                :raises TLSBadRecordMAC: when the mac value is invalid
        Severity: Minor
        Found in tlslite/recordlayer.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

        Cyclomatic complexity is too high in method sendRecord. (12)
        Open

            def sendRecord(self, msg):
                """
                Encrypt, MAC and send arbitrary message as-is through socket.
        
                Note that if the message was not fragmented to below 2**14 bytes
        Severity: Minor
        Found in tlslite/recordlayer.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 _getCipherSettings has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
        Open

            def _getCipherSettings(cipherSuite):
                """Get the settings for cipher suite used"""
                if cipherSuite in CipherSuite.aes256GcmSuites:
                    keyLength = 32
                    ivLength = 4
        Severity: Minor
        Found in tlslite/recordlayer.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 _decryptAndUnseal has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
        Open

            def _decryptAndUnseal(self, header, buf):
                """Decrypt AEAD encrypted data"""
                seqnumBytes = self._readState.getSeqNumBytes()
                # AES-GCM has an explicit variable nonce in TLS 1.2
                if "aes" in self._readState.encContext.name and \
        Severity: Minor
        Found in tlslite/recordlayer.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 _sockRecvAll has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
        Open

            def _sockRecvAll(self, length):
                """
                Read exactly the amount of bytes specified in L{length} from raw socket.
        
                :rtype: generator
        Severity: Minor
        Found in tlslite/recordlayer.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 calcSSL2PendingStates has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
        Open

            def calcSSL2PendingStates(self, cipherSuite, masterSecret, clientRandom,
                                      serverRandom, implementations):
                """
                Create the keys for encryption and decryption in SSLv2
        
        
        Severity: Minor
        Found in tlslite/recordlayer.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 _decryptSSL2 has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
        Open

            def _decryptSSL2(self, data, padding):
                """Decrypt SSL2 encrypted data"""
                # sequence numbers are incremented for plaintext records too
                seqnumBytes = self._readState.getSeqNumBytes()
        
        
        Severity: Minor
        Found in tlslite/recordlayer.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 recv has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
        Open

            def recv(self):
                """
                Read a single record from socket, handle SSLv2 and SSLv3 record layer
        
                :rtype: generator
        Severity: Minor
        Found in tlslite/recordlayer.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 _decryptStreamThenMAC has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
        Open

            def _decryptStreamThenMAC(self, recordType, data):
                """Decrypt a stream cipher and check MAC"""
                if self._readState.encContext:
                    assert self.version in ((3, 0), (3, 1), (3, 2), (3, 3))
        
        
        Severity: Minor
        Found in tlslite/recordlayer.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 calcPendingStates has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
        Open

            def calcPendingStates(self, cipherSuite, masterSecret, clientRandom,
                                  serverRandom, implementations):
                """Create pending states for encryption and decryption."""
                keyLength, ivLength, createCipherFunc = \
                        self._getCipherSettings(cipherSuite)
        Severity: Minor
        Found in tlslite/recordlayer.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 sendRecord has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

            def sendRecord(self, msg):
                """
                Encrypt, MAC and send arbitrary message as-is through socket.
        
                Note that if the message was not fragmented to below 2**14 bytes
        Severity: Minor
        Found in tlslite/recordlayer.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 _sockSendAll has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

            def _sockSendAll(self, data):
                """
                Send all data through socket
        
                :type data: bytearray
        Severity: Minor
        Found in tlslite/recordlayer.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 calcSSL2PendingStates has 5 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            def calcSSL2PendingStates(self, cipherSuite, masterSecret, clientRandom,
        Severity: Minor
        Found in tlslite/recordlayer.py - About 35 mins to fix

          Function calcPendingStates has 5 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              def calcPendingStates(self, cipherSuite, masterSecret, clientRandom,
          Severity: Minor
          Found in tlslite/recordlayer.py - About 35 mins to fix

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

                def _decryptThenMAC(self, recordType, data):
                    """Decrypt data, check padding and MAC"""
                    if self._readState.encContext:
                        assert self.version in ((3, 0), (3, 1), (3, 2), (3, 3))
                        assert self._readState.encContext.isBlockCipher
            Severity: Minor
            Found in tlslite/recordlayer.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 _macThenEncrypt has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

                def _macThenEncrypt(self, data, contentType):
                    """MAC, pad then encrypt data"""
                    if self._writeState.macContext:
                        seqnumBytes = self._writeState.getSeqNumBytes()
                        mac = self._writeState.macContext.copy()
            Severity: Minor
            Found in tlslite/recordlayer.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 _getMacSettings has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

                def _getMacSettings(cipherSuite):
                    """Get settings for HMAC used"""
                    if cipherSuite in CipherSuite.aeadSuites:
                        macLength = 0
                        digestmod = None
            Severity: Minor
            Found in tlslite/recordlayer.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 calcTLS1_3KeyUpdate_sender(self, cipherSuite, cl_app_secret,
                                               sr_app_secret):
                    if self.client:
                        new_sr_app_secret, server_state = self._calcTLS1_3KeyUpdate(
                            cipherSuite, sr_app_secret)
            Severity: Major
            Found in tlslite/recordlayer.py and 1 other location - About 3 hrs to fix
            tlslite/recordlayer.py on lines 1364..1375

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

            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 calcTLS1_3KeyUpdate_reciever(self, cipherSuite, cl_app_secret,
                                                 sr_app_secret):
                    if self.client:
                        new_cl_app_secret, client_state = self._calcTLS1_3KeyUpdate(
                            cipherSuite, cl_app_secret)
            Severity: Major
            Found in tlslite/recordlayer.py and 1 other location - About 3 hrs to fix
            tlslite/recordlayer.py on lines 1351..1362

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

            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 changeReadState(self):
                    """
                    Change the cipher state to the pending one for read operations.
            
                    This should be done only once after a call to
            Severity: Major
            Found in tlslite/recordlayer.py and 1 other location - About 2 hrs to fix
            tlslite/recordlayer.py on lines 989..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 61.

            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 changeWriteState(self):
                    """
                    Change the cipher state to the pending one for write operations.
            
                    This should be done only once after a call to
            Severity: Major
            Found in tlslite/recordlayer.py and 1 other location - About 2 hrs to fix
            tlslite/recordlayer.py on lines 1005..1019

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

            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 self._writeState.macContext:
                        seqnumBytes = self._writeState.getSeqNumBytes()
                        mac = self._writeState.macContext.copy()
                        macBytes = self.calculateMAC(mac, seqnumBytes, contentType, data)
                        data += macBytes
            Severity: Major
            Found in tlslite/recordlayer.py and 1 other location - About 2 hrs to fix
            tlslite/recordlayer.py on lines 512..518

            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

                    if self._writeState.macContext:
                        seqnumBytes = self._writeState.getSeqNumBytes()
                        mac = self._writeState.macContext.copy()
            
                        # append MAC
            Severity: Major
            Found in tlslite/recordlayer.py and 1 other location - About 2 hrs to fix
            tlslite/recordlayer.py on lines 478..482

            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

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

                    if self.client:
                        self._pendingWriteState = clientPendingState
                        self._pendingReadState = serverPendingState
                    else:
                        self._pendingWriteState = serverPendingState
            Severity: Minor
            Found in tlslite/recordlayer.py and 1 other location - About 30 mins to fix
            tlslite/recordlayer.py on lines 1318..1323

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

            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 self.client:
                        self._pendingWriteState = clientPendingState
                        self._pendingReadState = serverPendingState
                    else:
                        self._pendingWriteState = serverPendingState
            Severity: Minor
            Found in tlslite/recordlayer.py and 1 other location - About 30 mins to fix
            tlslite/recordlayer.py on lines 1180..1185

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

            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 getCipherName(self):
                    """
                    Return the name of the bulk cipher used by this connection
            
                    :rtype: str
            Severity: Minor
            Found in tlslite/recordlayer.py and 1 other location - About 30 mins to fix
            tlslite/recordlayer.py on lines 422..433

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

            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 getCipherImplementation(self):
                    """
                    Return the name of the implementation used for the connection
            
                    'python' for tlslite internal implementation, 'openssl' for M2crypto
            Severity: Minor
            Found in tlslite/recordlayer.py and 1 other location - About 30 mins to fix
            tlslite/recordlayer.py on lines 411..420

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

            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

            Block comment should start with '# '
            Open

                            #Add TLS 1.1 fixed block
            Severity: Minor
            Found in tlslite/recordlayer.py by pep8

            Separate inline comments by at least two spaces.

            An inline comment is a comment on the same line as a statement.
            Inline comments should be separated by at least two spaces from the
            statement. They should start with a # and a single space.
            
            Each line of a block comment starts with a # and a single space
            (unless it is indented text inside the comment).
            
            Okay: x = x + 1  # Increment x
            Okay: x = x + 1    # Increment x
            Okay: # Block comment
            E261: x = x + 1 # Increment x
            E262: x = x + 1  #Increment x
            E262: x = x + 1  #  Increment x
            E265: #Block comment
            E266: ### Block comment

            Block comment should start with '# '
            Open

                        #residue to create the IV for each sent block)
            Severity: Minor
            Found in tlslite/recordlayer.py by pep8

            Separate inline comments by at least two spaces.

            An inline comment is a comment on the same line as a statement.
            Inline comments should be separated by at least two spaces from the
            statement. They should start with a # and a single space.
            
            Each line of a block comment starts with a # and a single space
            (unless it is indented text inside the comment).
            
            Okay: x = x + 1  # Increment x
            Okay: x = x + 1    # Increment x
            Okay: # Block comment
            E261: x = x + 1 # Increment x
            E262: x = x + 1  #Increment x
            E262: x = x + 1  #  Increment x
            E265: #Block comment
            E266: ### Block comment

            The backslash is redundant between brackets
            Open

                            raise TLSIllegalParameterException(\
            Severity: Minor
            Found in tlslite/recordlayer.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  # \\

            Too many blank lines (2)
            Open

                def _decryptThenMAC(self, recordType, data):
            Severity: Minor
            Found in tlslite/recordlayer.py by pep8

            Separate top-level function and class definitions with two blank lines.

            Method definitions inside a class are separated by a single blank
            line.
            
            Extra blank lines may be used (sparingly) to separate groups of
            related functions.  Blank lines may be omitted between a bunch of
            related one-liners (e.g. a set of dummy implementations).
            
            Use blank lines in functions, sparingly, to indicate logical
            sections.
            
            Okay: def a():\n    pass\n\n\ndef b():\n    pass
            Okay: def a():\n    pass\n\n\nasync def b():\n    pass
            Okay: def a():\n    pass\n\n\n# Foo\n# Bar\n\ndef b():\n    pass
            Okay: default = 1\nfoo = 1
            Okay: classify = 1\nfoo = 1
            
            E301: class Foo:\n    b = 0\n    def bar():\n        pass
            E302: def a():\n    pass\n\ndef b(n):\n    pass
            E302: def a():\n    pass\n\nasync def b(n):\n    pass
            E303: def a():\n    pass\n\n\n\ndef b(n):\n    pass
            E303: def a():\n\n\n\n    pass
            E304: @decorator\n\ndef a():\n    pass
            E305: def a():\n    pass\na()
            E306: def a():\n    def b():\n        pass\n    def c():\n        pass

            Inline comment should start with '# '
            Open

                        if self.version >= (3, 2): #For TLS 1.1, remove explicit IV
            Severity: Minor
            Found in tlslite/recordlayer.py by pep8

            Separate inline comments by at least two spaces.

            An inline comment is a comment on the same line as a statement.
            Inline comments should be separated by at least two spaces from the
            statement. They should start with a # and a single space.
            
            Each line of a block comment starts with a # and a single space
            (unless it is indented text inside the comment).
            
            Okay: x = x + 1  # Increment x
            Okay: x = x + 1    # Increment x
            Okay: # Block comment
            E261: x = x + 1 # Increment x
            E262: x = x + 1  #Increment x
            E262: x = x + 1  #  Increment x
            E265: #Block comment
            E266: ### Block comment

            Whitespace before ']'
            Open

                            data = data[self._readState.encContext.block_size : ]
            Severity: Minor
            Found in tlslite/recordlayer.py by pep8

            Avoid extraneous whitespace.

            Avoid extraneous whitespace in these situations:
            - Immediately inside parentheses, brackets or braces.
            - Immediately before a comma, semicolon, or colon.
            
            Okay: spam(ham[1], {eggs: 2})
            E201: spam( ham[1], {eggs: 2})
            E201: spam(ham[ 1], {eggs: 2})
            E201: spam(ham[1], { eggs: 2})
            E202: spam(ham[1], {eggs: 2} )
            E202: spam(ham[1 ], {eggs: 2})
            E202: spam(ham[1], {eggs: 2 })
            
            E203: if x == 4: print x, y; x, y = y , x
            E203: if x == 4: print x, y ; x, y = y, x
            E203: if x == 4 : print x, y; x, y = y, x

            Whitespace before ':'
            Open

                            data = data[self._readState.encContext.block_size : ]
            Severity: Minor
            Found in tlslite/recordlayer.py by pep8

            Avoid extraneous whitespace.

            Avoid extraneous whitespace in these situations:
            - Immediately inside parentheses, brackets or braces.
            - Immediately before a comma, semicolon, or colon.
            
            Okay: spam(ham[1], {eggs: 2})
            E201: spam( ham[1], {eggs: 2})
            E201: spam(ham[ 1], {eggs: 2})
            E201: spam(ham[1], { eggs: 2})
            E202: spam(ham[1], {eggs: 2} )
            E202: spam(ham[1 ], {eggs: 2})
            E202: spam(ham[1], {eggs: 2 })
            
            E203: if x == 4: print x, y; x, y = y , x
            E203: if x == 4: print x, y ; x, y = y, x
            E203: if x == 4 : print x, y; x, y = y, x

            Block comment should start with '# '
            Open

                    #Read the next record header
            Severity: Minor
            Found in tlslite/recordlayer.py by pep8

            Separate inline comments by at least two spaces.

            An inline comment is a comment on the same line as a statement.
            Inline comments should be separated by at least two spaces from the
            statement. They should start with a # and a single space.
            
            Each line of a block comment starts with a # and a single space
            (unless it is indented text inside the comment).
            
            Okay: x = x + 1  # Increment x
            Okay: x = x + 1    # Increment x
            Okay: # Block comment
            E261: x = x + 1 # Increment x
            E262: x = x + 1  #Increment x
            E262: x = x + 1  #  Increment x
            E265: #Block comment
            E266: ### Block comment

            Block comment should start with '# '
            Open

                        #Add padding (for Block Cipher):
            Severity: Minor
            Found in tlslite/recordlayer.py by pep8

            Separate inline comments by at least two spaces.

            An inline comment is a comment on the same line as a statement.
            Inline comments should be separated by at least two spaces from the
            statement. They should start with a # and a single space.
            
            Each line of a block comment starts with a # and a single space
            (unless it is indented text inside the comment).
            
            Okay: x = x + 1  # Increment x
            Okay: x = x + 1    # Increment x
            Okay: # Block comment
            E261: x = x + 1 # Increment x
            E262: x = x + 1  #Increment x
            E262: x = x + 1  #  Increment x
            E265: #Block comment
            E266: ### Block comment

            Block comment should start with '# '
            Open

                        #if the connection closed, raise socket error
            Severity: Minor
            Found in tlslite/recordlayer.py by pep8

            Separate inline comments by at least two spaces.

            An inline comment is a comment on the same line as a statement.
            Inline comments should be separated by at least two spaces from the
            statement. They should start with a # and a single space.
            
            Each line of a block comment starts with a # and a single space
            (unless it is indented text inside the comment).
            
            Okay: x = x + 1  # Increment x
            Okay: x = x + 1    # Increment x
            Okay: # Block comment
            E261: x = x + 1 # Increment x
            E262: x = x + 1  #Increment x
            E262: x = x + 1  #  Increment x
            E265: #Block comment
            E266: ### Block comment

            Block comment should start with '# '
            Open

                    #Calculate Keying Material from Master Secret
            Severity: Minor
            Found in tlslite/recordlayer.py by pep8

            Separate inline comments by at least two spaces.

            An inline comment is a comment on the same line as a statement.
            Inline comments should be separated by at least two spaces from the
            statement. They should start with a # and a single space.
            
            Each line of a block comment starts with a # and a single space
            (unless it is indented text inside the comment).
            
            Okay: x = x + 1  # Increment x
            Okay: x = x + 1    # Increment x
            Okay: # Block comment
            E261: x = x + 1 # Increment x
            E262: x = x + 1  #Increment x
            E262: x = x + 1  #  Increment x
            E265: #Block comment
            E266: ### Block comment

            Multiple statements on one line (colon)
            Open

                        else: break
            Severity: Minor
            Found in tlslite/recordlayer.py by pep8

            Compound statements (on the same line) are generally discouraged.

            While sometimes it's okay to put an if/for/while with a small body
            on the same line, never do this for multi-clause statements.
            Also avoid folding such long lines!
            
            Always use a def statement instead of an assignment statement that
            binds a lambda expression directly to a name.
            
            Okay: if foo == 'blah':\n    do_blah_thing()
            Okay: do_one()
            Okay: do_two()
            Okay: do_three()
            
            E701: if foo == 'blah': do_blah_thing()
            E701: for x in lst: total += x
            E701: while t < 10: t = delay()
            E701: if foo == 'blah': do_blah_thing()
            E701: else: do_non_blah_thing()
            E701: try: something()
            E701: finally: cleanup()
            E701: if foo == 'blah': one(); two(); three()
            E702: do_one(); do_two(); do_three()
            E703: do_four();  # useless semicolon
            E704: def f(x): return 2*x
            E731: f = lambda x: 2*x

            Continuation line over-indented for visual indent
            Open

                                                        createCipherFunc(serverKeyBlock,
            Severity: Minor
            Found in tlslite/recordlayer.py by pep8

            Continuation lines indentation.

            Continuation lines should align wrapped elements either vertically
            using Python's implicit line joining inside parentheses, brackets
            and braces, or using a hanging indent.
            
            When using a hanging indent these considerations should be applied:
            - there should be no arguments on the first line, and
            - further indentation should be used to clearly distinguish itself
              as a continuation line.
            
            Okay: a = (\n)
            E123: a = (\n    )
            
            Okay: a = (\n    42)
            E121: a = (\n   42)
            E122: a = (\n42)
            E123: a = (\n    42\n    )
            E124: a = (24,\n     42\n)
            E125: if (\n    b):\n    pass
            E126: a = (\n        42)
            E127: a = (24,\n      42)
            E128: a = (24,\n    42)
            E129: if (a or\n    b):\n    pass
            E131: a = (\n    42\n 24)

            Multiple statements on one line (colon)
            Open

                            else: break
            Severity: Minor
            Found in tlslite/recordlayer.py by pep8

            Compound statements (on the same line) are generally discouraged.

            While sometimes it's okay to put an if/for/while with a small body
            on the same line, never do this for multi-clause statements.
            Also avoid folding such long lines!
            
            Always use a def statement instead of an assignment statement that
            binds a lambda expression directly to a name.
            
            Okay: if foo == 'blah':\n    do_blah_thing()
            Okay: do_one()
            Okay: do_two()
            Okay: do_three()
            
            E701: if foo == 'blah': do_blah_thing()
            E701: for x in lst: total += x
            E701: while t < 10: t = delay()
            E701: if foo == 'blah': do_blah_thing()
            E701: else: do_non_blah_thing()
            E701: try: something()
            E701: finally: cleanup()
            E701: if foo == 'blah': one(); two(); three()
            E702: do_one(); do_two(); do_three()
            E703: do_four();  # useless semicolon
            E704: def f(x): return 2*x
            E731: f = lambda x: 2*x

            Block comment should start with '# '
            Open

                        #Choose fixedIVBlock for TLS 1.1 (this is encrypted with the CBC
            Severity: Minor
            Found in tlslite/recordlayer.py by pep8

            Separate inline comments by at least two spaces.

            An inline comment is a comment on the same line as a statement.
            Inline comments should be separated by at least two spaces from the
            statement. They should start with a # and a single space.
            
            Each line of a block comment starts with a # and a single space
            (unless it is indented text inside the comment).
            
            Okay: x = x + 1  # Increment x
            Okay: x = x + 1    # Increment x
            Okay: # Block comment
            E261: x = x + 1 # Increment x
            E262: x = x + 1  #Increment x
            E262: x = x + 1  #  Increment x
            E265: #Block comment
            E266: ### Block comment

            Multiple statements on one line (colon)
            Open

                            else: break
            Severity: Minor
            Found in tlslite/recordlayer.py by pep8

            Compound statements (on the same line) are generally discouraged.

            While sometimes it's okay to put an if/for/while with a small body
            on the same line, never do this for multi-clause statements.
            Also avoid folding such long lines!
            
            Always use a def statement instead of an assignment statement that
            binds a lambda expression directly to a name.
            
            Okay: if foo == 'blah':\n    do_blah_thing()
            Okay: do_one()
            Okay: do_two()
            Okay: do_three()
            
            E701: if foo == 'blah': do_blah_thing()
            E701: for x in lst: total += x
            E701: while t < 10: t = delay()
            E701: if foo == 'blah': do_blah_thing()
            E701: else: do_non_blah_thing()
            E701: try: something()
            E701: finally: cleanup()
            E701: if foo == 'blah': one(); two(); three()
            E702: do_one(); do_two(); do_three()
            E703: do_four();  # useless semicolon
            E704: def f(x): return 2*x
            E731: f = lambda x: 2*x

            Block comment should start with '# '
            Open

                    #Read the record contents
            Severity: Minor
            Found in tlslite/recordlayer.py by pep8

            Separate inline comments by at least two spaces.

            An inline comment is a comment on the same line as a statement.
            Inline comments should be separated by at least two spaces from the
            statement. They should start with a # and a single space.
            
            Each line of a block comment starts with a # and a single space
            (unless it is indented text inside the comment).
            
            Okay: x = x + 1  # Increment x
            Okay: x = x + 1    # Increment x
            Okay: # Block comment
            E261: x = x + 1 # Increment x
            E262: x = x + 1  #Increment x
            E262: x = x + 1  #  Increment x
            E265: #Block comment
            E266: ### Block comment

            Block comment should start with '# '
            Open

                        #Encrypt
            Severity: Minor
            Found in tlslite/recordlayer.py by pep8

            Separate inline comments by at least two spaces.

            An inline comment is a comment on the same line as a statement.
            Inline comments should be separated by at least two spaces from the
            statement. They should start with a # and a single space.
            
            Each line of a block comment starts with a # and a single space
            (unless it is indented text inside the comment).
            
            Okay: x = x + 1  # Increment x
            Okay: x = x + 1    # Increment x
            Okay: # Block comment
            E261: x = x + 1 # Increment x
            E262: x = x + 1  #Increment x
            E262: x = x + 1  #  Increment x
            E265: #Block comment
            E266: ### Block comment

            Block comment should start with '# '
            Open

                        #Publicly invalid.
            Severity: Minor
            Found in tlslite/recordlayer.py by pep8

            Separate inline comments by at least two spaces.

            An inline comment is a comment on the same line as a statement.
            Inline comments should be separated by at least two spaces from the
            statement. They should start with a # and a single space.
            
            Each line of a block comment starts with a # and a single space
            (unless it is indented text inside the comment).
            
            Okay: x = x + 1  # Increment x
            Okay: x = x + 1    # Increment x
            Okay: # Block comment
            E261: x = x + 1 # Increment x
            E262: x = x + 1  #Increment x
            E262: x = x + 1  #  Increment x
            E265: #Block comment
            E266: ### Block comment

            Continuation line over-indented for visual indent
            Open

                                self._pendingReadState.encryptThenMAC
            Severity: Minor
            Found in tlslite/recordlayer.py by pep8

            Continuation lines indentation.

            Continuation lines should align wrapped elements either vertically
            using Python's implicit line joining inside parentheses, brackets
            and braces, or using a hanging indent.
            
            When using a hanging indent these considerations should be applied:
            - there should be no arguments on the first line, and
            - further indentation should be used to clearly distinguish itself
              as a continuation line.
            
            Okay: a = (\n)
            E123: a = (\n    )
            
            Okay: a = (\n    42)
            E121: a = (\n   42)
            E122: a = (\n42)
            E123: a = (\n    42\n    )
            E124: a = (24,\n     42\n)
            E125: if (\n    b):\n    pass
            E126: a = (\n        42)
            E127: a = (24,\n      42)
            E128: a = (24,\n    42)
            E129: if (a or\n    b):\n    pass
            E131: a = (\n    42\n 24)

            Expected 2 blank lines, found 1
            Open

            class RecordSocket(object):
            Severity: Minor
            Found in tlslite/recordlayer.py by pep8

            Separate top-level function and class definitions with two blank lines.

            Method definitions inside a class are separated by a single blank
            line.
            
            Extra blank lines may be used (sparingly) to separate groups of
            related functions.  Blank lines may be omitted between a bunch of
            related one-liners (e.g. a set of dummy implementations).
            
            Use blank lines in functions, sparingly, to indicate logical
            sections.
            
            Okay: def a():\n    pass\n\n\ndef b():\n    pass
            Okay: def a():\n    pass\n\n\nasync def b():\n    pass
            Okay: def a():\n    pass\n\n\n# Foo\n# Bar\n\ndef b():\n    pass
            Okay: default = 1\nfoo = 1
            Okay: classify = 1\nfoo = 1
            
            E301: class Foo:\n    b = 0\n    def bar():\n        pass
            E302: def a():\n    pass\n\ndef b(n):\n    pass
            E302: def a():\n    pass\n\nasync def b(n):\n    pass
            E303: def a():\n    pass\n\n\n\ndef b(n):\n    pass
            E303: def a():\n\n\n\n    pass
            E304: @decorator\n\ndef a():\n    pass
            E305: def a():\n    pass\na()
            E306: def a():\n    def b():\n        pass\n    def c():\n        pass

            Block comment should start with '# '
            Open

                    #Check the record header fields
            Severity: Minor
            Found in tlslite/recordlayer.py by pep8

            Separate inline comments by at least two spaces.

            An inline comment is a comment on the same line as a statement.
            Inline comments should be separated by at least two spaces from the
            statement. They should start with a # and a single space.
            
            Each line of a block comment starts with a # and a single space
            (unless it is indented text inside the comment).
            
            Okay: x = x + 1  # Increment x
            Okay: x = x + 1    # Increment x
            Okay: # Block comment
            E261: x = x + 1 # Increment x
            E262: x = x + 1  #Increment x
            E262: x = x + 1  #  Increment x
            E265: #Block comment
            E266: ### Block comment

            Missing whitespace around modulo operator
            Open

                                                            len(buf)%256])
            Severity: Minor
            Found in tlslite/recordlayer.py by pep8

            Surround operators with a single space on either side.

            - Always surround these binary operators with a single space on
              either side: assignment (=), augmented assignment (+=, -= etc.),
              comparisons (==, <, >, !=, <=, >=, in, not in, is, is not),
              Booleans (and, or, not).
            
            - If operators with different priorities are used, consider adding
              whitespace around the operators with the lowest priorities.
            
            Okay: i = i + 1
            Okay: submitted += 1
            Okay: x = x * 2 - 1
            Okay: hypot2 = x * x + y * y
            Okay: c = (a + b) * (a - b)
            Okay: foo(bar, key='word', *args, **kwargs)
            Okay: alpha[:-i]
            
            E225: i=i+1
            E225: submitted +=1
            E225: x = x /2 - 1
            E225: z = x **y
            E225: z = 1and 1
            E226: c = (a+b) * (a-b)
            E226: hypot2 = x*x + y*y
            E227: c = a|b
            E228: msg = fmt%(errno, errmsg)

            The backslash is redundant between brackets
            Open

                            raise TLSDecryptionFailed("data length not multiple of "\
            Severity: Minor
            Found in tlslite/recordlayer.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  # \\

            Line too long (80 > 79 characters)
            Open

                    Read exactly the amount of bytes specified in L{length} from raw socket.
            Severity: Minor
            Found in tlslite/recordlayer.py by pep8

            Limit all lines to a maximum of 79 characters.

            There are still many devices around that are limited to 80 character
            lines; plus, limiting windows to 80 characters makes it possible to
            have several windows side-by-side.  The default wrapping on such
            devices looks ugly.  Therefore, please limit all lines to a maximum
            of 79 characters. For flowing long blocks of text (docstrings or
            comments), limiting the length to 72 characters is recommended.
            
            Reports error E501.

            Block comment should start with '# '
            Open

                            #Read MAC
            Severity: Minor
            Found in tlslite/recordlayer.py by pep8

            Separate inline comments by at least two spaces.

            An inline comment is a comment on the same line as a statement.
            Inline comments should be separated by at least two spaces from the
            statement. They should start with a # and a single space.
            
            Each line of a block comment starts with a # and a single space
            (unless it is indented text inside the comment).
            
            Okay: x = x + 1  # Increment x
            Okay: x = x + 1    # Increment x
            Okay: # Block comment
            E261: x = x + 1 # Increment x
            E262: x = x + 1  #Increment x
            E262: x = x + 1  #  Increment x
            E265: #Block comment
            E266: ### Block comment

            Block comment should start with '# '
            Open

                    #Slice up Keying Material
            Severity: Minor
            Found in tlslite/recordlayer.py by pep8

            Separate inline comments by at least two spaces.

            An inline comment is a comment on the same line as a statement.
            Inline comments should be separated by at least two spaces from the
            statement. They should start with a # and a single space.
            
            Each line of a block comment starts with a # and a single space
            (unless it is indented text inside the comment).
            
            Okay: x = x + 1  # Increment x
            Okay: x = x + 1    # Increment x
            Okay: # Block comment
            E261: x = x + 1 # Increment x
            E262: x = x + 1  #Increment x
            E262: x = x + 1  #  Increment x
            E265: #Block comment
            E266: ### Block comment

            Too many blank lines (2)
            Open

                    #Parse the record header
            Severity: Minor
            Found in tlslite/recordlayer.py by pep8

            Separate top-level function and class definitions with two blank lines.

            Method definitions inside a class are separated by a single blank
            line.
            
            Extra blank lines may be used (sparingly) to separate groups of
            related functions.  Blank lines may be omitted between a bunch of
            related one-liners (e.g. a set of dummy implementations).
            
            Use blank lines in functions, sparingly, to indicate logical
            sections.
            
            Okay: def a():\n    pass\n\n\ndef b():\n    pass
            Okay: def a():\n    pass\n\n\nasync def b():\n    pass
            Okay: def a():\n    pass\n\n\n# Foo\n# Bar\n\ndef b():\n    pass
            Okay: default = 1\nfoo = 1
            Okay: classify = 1\nfoo = 1
            
            E301: class Foo:\n    b = 0\n    def bar():\n        pass
            E302: def a():\n    pass\n\ndef b(n):\n    pass
            E302: def a():\n    pass\n\nasync def b(n):\n    pass
            E303: def a():\n    pass\n\n\n\ndef b(n):\n    pass
            E303: def a():\n\n\n\n    pass
            E304: @decorator\n\ndef a():\n    pass
            E305: def a():\n    pass\na()
            E306: def a():\n    def b():\n        pass\n    def c():\n        pass

            Block comment should start with '# '
            Open

                    #elif cipherSuite in CipherSuite.ssl2_64Key:
            Severity: Minor
            Found in tlslite/recordlayer.py by pep8

            Separate inline comments by at least two spaces.

            An inline comment is a comment on the same line as a statement.
            Inline comments should be separated by at least two spaces from the
            statement. They should start with a # and a single space.
            
            Each line of a block comment starts with a # and a single space
            (unless it is indented text inside the comment).
            
            Okay: x = x + 1  # Increment x
            Okay: x = x + 1    # Increment x
            Okay: # Block comment
            E261: x = x + 1 # Increment x
            E262: x = x + 1  #Increment x
            E262: x = x + 1  #  Increment x
            E265: #Block comment
            E266: ### Block comment

            Block comment should start with '# '
            Open

                            #Calculate MAC
            Severity: Minor
            Found in tlslite/recordlayer.py by pep8

            Separate inline comments by at least two spaces.

            An inline comment is a comment on the same line as a statement.
            Inline comments should be separated by at least two spaces from the
            statement. They should start with a # and a single space.
            
            Each line of a block comment starts with a # and a single space
            (unless it is indented text inside the comment).
            
            Okay: x = x + 1  # Increment x
            Okay: x = x + 1    # Increment x
            Okay: # Block comment
            E261: x = x + 1 # Increment x
            E262: x = x + 1  #Increment x
            E262: x = x + 1  #  Increment x
            E265: #Block comment
            E266: ### Block comment

            Multiple statements on one line (colon)
            Open

                        else: break
            Severity: Minor
            Found in tlslite/recordlayer.py by pep8

            Compound statements (on the same line) are generally discouraged.

            While sometimes it's okay to put an if/for/while with a small body
            on the same line, never do this for multi-clause statements.
            Also avoid folding such long lines!
            
            Always use a def statement instead of an assignment statement that
            binds a lambda expression directly to a name.
            
            Okay: if foo == 'blah':\n    do_blah_thing()
            Okay: do_one()
            Okay: do_two()
            Okay: do_three()
            
            E701: if foo == 'blah': do_blah_thing()
            E701: for x in lst: total += x
            E701: while t < 10: t = delay()
            E701: if foo == 'blah': do_blah_thing()
            E701: else: do_non_blah_thing()
            E701: try: something()
            E701: finally: cleanup()
            E701: if foo == 'blah': one(); two(); three()
            E702: do_one(); do_two(); do_three()
            E703: do_four();  # useless semicolon
            E704: def f(x): return 2*x
            E731: f = lambda x: 2*x

            Multiple statements on one line (colon)
            Open

                        else: break
            Severity: Minor
            Found in tlslite/recordlayer.py by pep8

            Compound statements (on the same line) are generally discouraged.

            While sometimes it's okay to put an if/for/while with a small body
            on the same line, never do this for multi-clause statements.
            Also avoid folding such long lines!
            
            Always use a def statement instead of an assignment statement that
            binds a lambda expression directly to a name.
            
            Okay: if foo == 'blah':\n    do_blah_thing()
            Okay: do_one()
            Okay: do_two()
            Okay: do_three()
            
            E701: if foo == 'blah': do_blah_thing()
            E701: for x in lst: total += x
            E701: while t < 10: t = delay()
            E701: if foo == 'blah': do_blah_thing()
            E701: else: do_non_blah_thing()
            E701: try: something()
            E701: finally: cleanup()
            E701: if foo == 'blah': one(); two(); three()
            E702: do_one(); do_two(); do_three()
            E703: do_four();  # useless semicolon
            E704: def f(x): return 2*x
            E731: f = lambda x: 2*x

            Block comment should start with '# '
            Open

                            #Compare MACs
            Severity: Minor
            Found in tlslite/recordlayer.py by pep8

            Separate inline comments by at least two spaces.

            An inline comment is a comment on the same line as a statement.
            Inline comments should be separated by at least two spaces from the
            statement. They should start with a # and a single space.
            
            Each line of a block comment starts with a # and a single space
            (unless it is indented text inside the comment).
            
            Okay: x = x + 1  # Increment x
            Okay: x = x + 1    # Increment x
            Okay: # Block comment
            E261: x = x + 1 # Increment x
            E262: x = x + 1  #Increment x
            E262: x = x + 1  #  Increment x
            E265: #Block comment
            E266: ### Block comment

            Block comment should start with '# '
            Open

                            #Publicly invalid.
            Severity: Minor
            Found in tlslite/recordlayer.py by pep8

            Separate inline comments by at least two spaces.

            An inline comment is a comment on the same line as a statement.
            Inline comments should be separated by at least two spaces from the
            statement. They should start with a # and a single space.
            
            Each line of a block comment starts with a # and a single space
            (unless it is indented text inside the comment).
            
            Okay: x = x + 1  # Increment x
            Okay: x = x + 1    # Increment x
            Okay: # Block comment
            E261: x = x + 1 # Increment x
            E262: x = x + 1  #Increment x
            E262: x = x + 1  #  Increment x
            E265: #Block comment
            E266: ### Block comment

            Continuation line with same indent as next logical line
            Open

                                self._readState.encContext.isAEAD:
            Severity: Minor
            Found in tlslite/recordlayer.py by pep8

            Continuation lines indentation.

            Continuation lines should align wrapped elements either vertically
            using Python's implicit line joining inside parentheses, brackets
            and braces, or using a hanging indent.
            
            When using a hanging indent these considerations should be applied:
            - there should be no arguments on the first line, and
            - further indentation should be used to clearly distinguish itself
              as a continuation line.
            
            Okay: a = (\n)
            E123: a = (\n    )
            
            Okay: a = (\n    42)
            E121: a = (\n   42)
            E122: a = (\n42)
            E123: a = (\n    42\n    )
            E124: a = (24,\n     42\n)
            E125: if (\n    b):\n    pass
            E126: a = (\n        42)
            E127: a = (24,\n      42)
            E128: a = (24,\n    42)
            E129: if (a or\n    b):\n    pass
            E131: a = (\n    42\n 24)

            Continuation line over-indented for visual indent
            Open

                                self._pendingReadState.encryptThenMAC
            Severity: Minor
            Found in tlslite/recordlayer.py by pep8

            Continuation lines indentation.

            Continuation lines should align wrapped elements either vertically
            using Python's implicit line joining inside parentheses, brackets
            and braces, or using a hanging indent.
            
            When using a hanging indent these considerations should be applied:
            - there should be no arguments on the first line, and
            - further indentation should be used to clearly distinguish itself
              as a continuation line.
            
            Okay: a = (\n)
            E123: a = (\n    )
            
            Okay: a = (\n    42)
            E121: a = (\n   42)
            E122: a = (\n42)
            E123: a = (\n    42\n    )
            E124: a = (24,\n     42\n)
            E125: if (\n    b):\n    pass
            E126: a = (\n        42)
            E127: a = (24,\n      42)
            E128: a = (24,\n    42)
            E129: if (a or\n    b):\n    pass
            E131: a = (\n    42\n 24)

            Block comment should start with '# '
            Open

                    #Assemble the authenticated data.
            Severity: Minor
            Found in tlslite/recordlayer.py by pep8

            Separate inline comments by at least two spaces.

            An inline comment is a comment on the same line as a statement.
            Inline comments should be separated by at least two spaces from the
            statement. They should start with a # and a single space.
            
            Each line of a block comment starts with a # and a single space
            (unless it is indented text inside the comment).
            
            Okay: x = x + 1  # Increment x
            Okay: x = x + 1    # Increment x
            Okay: # Block comment
            E261: x = x + 1 # Increment x
            E262: x = x + 1  #Increment x
            E262: x = x + 1  #  Increment x
            E265: #Block comment
            E266: ### Block comment

            Missing whitespace around modulo operator
            Open

                                                            plaintextLen%256])
            Severity: Minor
            Found in tlslite/recordlayer.py by pep8

            Surround operators with a single space on either side.

            - Always surround these binary operators with a single space on
              either side: assignment (=), augmented assignment (+=, -= etc.),
              comparisons (==, <, >, !=, <=, >=, in, not in, is, is not),
              Booleans (and, or, not).
            
            - If operators with different priorities are used, consider adding
              whitespace around the operators with the lowest priorities.
            
            Okay: i = i + 1
            Okay: submitted += 1
            Okay: x = x * 2 - 1
            Okay: hypot2 = x * x + y * y
            Okay: c = (a + b) * (a - b)
            Okay: foo(bar, key='word', *args, **kwargs)
            Okay: alpha[:-i]
            
            E225: i=i+1
            E225: submitted +=1
            E225: x = x /2 - 1
            E225: z = x **y
            E225: z = 1and 1
            E226: c = (a+b) * (a-b)
            E226: hypot2 = x*x + y*y
            E227: c = a|b
            E228: msg = fmt%(errno, errmsg)

            The backslash is redundant between brackets
            Open

                        key_material[pos:pos+md5_output_size] = MD5(\
            Severity: Minor
            Found in tlslite/recordlayer.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  # \\

            Missing whitespace around modulo operator
            Open

                    mac.update(compatHMAC(bytearray([len(data)%256])))
            Severity: Minor
            Found in tlslite/recordlayer.py by pep8

            Surround operators with a single space on either side.

            - Always surround these binary operators with a single space on
              either side: assignment (=), augmented assignment (+=, -= etc.),
              comparisons (==, <, >, !=, <=, >=, in, not in, is, is not),
              Booleans (and, or, not).
            
            - If operators with different priorities are used, consider adding
              whitespace around the operators with the lowest priorities.
            
            Okay: i = i + 1
            Okay: submitted += 1
            Okay: x = x * 2 - 1
            Okay: hypot2 = x * x + y * y
            Okay: c = (a + b) * (a - b)
            Okay: foo(bar, key='word', *args, **kwargs)
            Okay: alpha[:-i]
            
            E225: i=i+1
            E225: submitted +=1
            E225: x = x /2 - 1
            E225: z = x **y
            E225: z = 1and 1
            E226: c = (a+b) * (a-b)
            E226: hypot2 = x*x + y*y
            E227: c = a|b
            E228: msg = fmt%(errno, errmsg)

            Block comment should start with '# '
            Open

                    #Encrypt for Block or Stream Cipher
            Severity: Minor
            Found in tlslite/recordlayer.py by pep8

            Separate inline comments by at least two spaces.

            An inline comment is a comment on the same line as a statement.
            Inline comments should be separated by at least two spaces from the
            statement. They should start with a # and a single space.
            
            Each line of a block comment starts with a # and a single space
            (unless it is indented text inside the comment).
            
            Okay: x = x + 1  # Increment x
            Okay: x = x + 1    # Increment x
            Okay: # Block comment
            E261: x = x + 1 # Increment x
            E262: x = x + 1  #Increment x
            E262: x = x + 1  #  Increment x
            E265: #Block comment
            E266: ### Block comment

            Block comment should start with '# '
            Open

                        #Check MAC
            Severity: Minor
            Found in tlslite/recordlayer.py by pep8

            Separate inline comments by at least two spaces.

            An inline comment is a comment on the same line as a statement.
            Inline comments should be separated by at least two spaces from the
            statement. They should start with a # and a single space.
            
            Each line of a block comment starts with a # and a single space
            (unless it is indented text inside the comment).
            
            Okay: x = x + 1  # Increment x
            Okay: x = x + 1    # Increment x
            Okay: # Block comment
            E261: x = x + 1 # Increment x
            E262: x = x + 1  #Increment x
            E262: x = x + 1  #  Increment x
            E265: #Block comment
            E266: ### Block comment

            At least two spaces before inline comment
            Open

                        if self.version >= (3, 2): #For TLS 1.1, remove explicit IV
            Severity: Minor
            Found in tlslite/recordlayer.py by pep8

            Separate inline comments by at least two spaces.

            An inline comment is a comment on the same line as a statement.
            Inline comments should be separated by at least two spaces from the
            statement. They should start with a # and a single space.
            
            Each line of a block comment starts with a # and a single space
            (unless it is indented text inside the comment).
            
            Okay: x = x + 1  # Increment x
            Okay: x = x + 1    # Increment x
            Okay: # Block comment
            E261: x = x + 1 # Increment x
            E262: x = x + 1  #Increment x
            E262: x = x + 1  #  Increment x
            E265: #Block comment
            E266: ### Block comment

            Too many blank lines (2)
            Open

                def _encryptThenSeal(self, buf, contentType):
            Severity: Minor
            Found in tlslite/recordlayer.py by pep8

            Separate top-level function and class definitions with two blank lines.

            Method definitions inside a class are separated by a single blank
            line.
            
            Extra blank lines may be used (sparingly) to separate groups of
            related functions.  Blank lines may be omitted between a bunch of
            related one-liners (e.g. a set of dummy implementations).
            
            Use blank lines in functions, sparingly, to indicate logical
            sections.
            
            Okay: def a():\n    pass\n\n\ndef b():\n    pass
            Okay: def a():\n    pass\n\n\nasync def b():\n    pass
            Okay: def a():\n    pass\n\n\n# Foo\n# Bar\n\ndef b():\n    pass
            Okay: default = 1\nfoo = 1
            Okay: classify = 1\nfoo = 1
            
            E301: class Foo:\n    b = 0\n    def bar():\n        pass
            E302: def a():\n    pass\n\ndef b(n):\n    pass
            E302: def a():\n    pass\n\nasync def b(n):\n    pass
            E303: def a():\n    pass\n\n\n\ndef b(n):\n    pass
            E303: def a():\n\n\n\n    pass
            E304: @decorator\n\ndef a():\n    pass
            E305: def a():\n    pass\na()
            E306: def a():\n    def b():\n        pass\n    def c():\n        pass

            Block comment should start with '# '
            Open

                    #AES-GCM, has an explicit variable nonce.
            Severity: Minor
            Found in tlslite/recordlayer.py by pep8

            Separate inline comments by at least two spaces.

            An inline comment is a comment on the same line as a statement.
            Inline comments should be separated by at least two spaces from the
            statement. They should start with a # and a single space.
            
            Each line of a block comment starts with a # and a single space
            (unless it is indented text inside the comment).
            
            Okay: x = x + 1  # Increment x
            Okay: x = x + 1    # Increment x
            Okay: # Block comment
            E261: x = x + 1 # Increment x
            E262: x = x + 1  #Increment x
            E262: x = x + 1  #  Increment x
            E265: #Block comment
            E266: ### Block comment

            Multiple statements on one line (colon)
            Open

                            else: break
            Severity: Minor
            Found in tlslite/recordlayer.py by pep8

            Compound statements (on the same line) are generally discouraged.

            While sometimes it's okay to put an if/for/while with a small body
            on the same line, never do this for multi-clause statements.
            Also avoid folding such long lines!
            
            Always use a def statement instead of an assignment statement that
            binds a lambda expression directly to a name.
            
            Okay: if foo == 'blah':\n    do_blah_thing()
            Okay: do_one()
            Okay: do_two()
            Okay: do_three()
            
            E701: if foo == 'blah': do_blah_thing()
            E701: for x in lst: total += x
            E701: while t < 10: t = delay()
            E701: if foo == 'blah': do_blah_thing()
            E701: else: do_non_blah_thing()
            E701: try: something()
            E701: finally: cleanup()
            E701: if foo == 'blah': one(); two(); three()
            E702: do_one(); do_two(); do_three()
            E703: do_four();  # useless semicolon
            E704: def f(x): return 2*x
            E731: f = lambda x: 2*x

            Block comment should start with '# '
            Open

                    #Assign new connection states to pending states
            Severity: Minor
            Found in tlslite/recordlayer.py by pep8

            Separate inline comments by at least two spaces.

            An inline comment is a comment on the same line as a statement.
            Inline comments should be separated by at least two spaces from the
            statement. They should start with a # and a single space.
            
            Each line of a block comment starts with a # and a single space
            (unless it is indented text inside the comment).
            
            Okay: x = x + 1  # Increment x
            Okay: x = x + 1    # Increment x
            Okay: # Block comment
            E261: x = x + 1 # Increment x
            E262: x = x + 1  #Increment x
            E262: x = x + 1  #  Increment x
            E265: #Block comment
            E266: ### Block comment

            Block comment should start with '# '
            Open

                    #Parse the record header
            Severity: Minor
            Found in tlslite/recordlayer.py by pep8

            Separate inline comments by at least two spaces.

            An inline comment is a comment on the same line as a statement.
            Inline comments should be separated by at least two spaces from the
            statement. They should start with a # and a single space.
            
            Each line of a block comment starts with a # and a single space
            (unless it is indented text inside the comment).
            
            Okay: x = x + 1  # Increment x
            Okay: x = x + 1    # Increment x
            Okay: # Block comment
            E261: x = x + 1 # Increment x
            E262: x = x + 1  #Increment x
            E262: x = x + 1  #  Increment x
            E265: #Block comment
            E266: ### Block comment

            Whitespace before ':'
            Open

                            checkBytes = data[startIndex : endIndex]
            Severity: Minor
            Found in tlslite/recordlayer.py by pep8

            Avoid extraneous whitespace.

            Avoid extraneous whitespace in these situations:
            - Immediately inside parentheses, brackets or braces.
            - Immediately before a comma, semicolon, or colon.
            
            Okay: spam(ham[1], {eggs: 2})
            E201: spam( ham[1], {eggs: 2})
            E201: spam(ham[ 1], {eggs: 2})
            E201: spam(ham[1], { eggs: 2})
            E202: spam(ham[1], {eggs: 2} )
            E202: spam(ham[1 ], {eggs: 2})
            E202: spam(ham[1], {eggs: 2 })
            
            E203: if x == 4: print x, y; x, y = y , x
            E203: if x == 4: print x, y ; x, y = y, x
            E203: if x == 4 : print x, y; x, y = y, x

            Continuation line over-indented for visual indent
            Open

                            self._getCipherSettings(cipherSuite)
            Severity: Minor
            Found in tlslite/recordlayer.py by pep8

            Continuation lines indentation.

            Continuation lines should align wrapped elements either vertically
            using Python's implicit line joining inside parentheses, brackets
            and braces, or using a hanging indent.
            
            When using a hanging indent these considerations should be applied:
            - there should be no arguments on the first line, and
            - further indentation should be used to clearly distinguish itself
              as a continuation line.
            
            Okay: a = (\n)
            E123: a = (\n    )
            
            Okay: a = (\n    42)
            E121: a = (\n   42)
            E122: a = (\n42)
            E123: a = (\n    42\n    )
            E124: a = (24,\n     42\n)
            E125: if (\n    b):\n    pass
            E126: a = (\n        42)
            E127: a = (24,\n      42)
            E128: a = (24,\n    42)
            E129: if (a or\n    b):\n    pass
            E131: a = (\n    42\n 24)

            There are no issues that match your filters.

            Category
            Status