Showing 324 of 1,708 total issues
Function decrypt
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
def decrypt(self, encBytes):
"""Decrypt the passed-in bytes.
This requires the key to have a private component. It performs
PKCS#1 v1.5 decryption operation of the passed-in data.
Function _serverGetClientHello
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def _serverGetClientHello(self, settings, private_key, cert_chain,
verifierDB,
sessionCache, anon, alpn, sni):
# Tentatively set version to most-desirable version, so if an error
# occurs parsing the ClientHello, this will be the version we'll use
Function __init__
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(self,
Function calcVerifyBytes
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
def calcVerifyBytes(version, handshakeHashes, signatureAlg,
Function __init__
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(self, use_datetime=0,
Function create
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
def create(self, version, random, session_id, cipher_suite,
Function _serverGetClientHello
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
def _serverGetClientHello(self, settings, private_key, cert_chain,
Function __init__
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(self, cipherSuite, clientHello, serverHello, privateKey,
Consider simplifying this complex logical expression. Open
if (psk and
PskKeyExchangeMode.psk_dhe_ke in psk_types.modes and
"psk_dhe_ke" in settings.psk_modes) or\
(psk is None and privateKey):
self.ecdhCurve = selected_group
Function __init__
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(self, host = '', port = IMAP4_TLS_PORT,
Function handshakeClientSRP
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
def handshakeClientSRP(self, username, password, session=None,
Function calc_key
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
def calc_key(version, secret, cipher_suite, label, handshake_hashes=None,
Function encrypt
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def encrypt(self, plaintext):
"""Encrypt a single block of plaintext."""
if len(plaintext) != self.block_size:
raise ValueError('wrong block length, expected {0} got {1}'
.format(self.block_size, len(plaintext)))
- Read upRead up
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 EMSA_PSS_verify
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def EMSA_PSS_verify(self, mHash, EM, emBits, hAlg, sLen=0):
"""Verify signature in passed in encoded message
This verifies the signature in encoded message
- Read upRead up
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 password_callback
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def password_callback(v, prompt1='Enter private key passphrase:',
prompt2='Verify passphrase:'):
from getpass import getpass
while 1:
try:
- Read upRead up
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 _parseKeyHelper
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def _parseKeyHelper(key, private, public):
if private and not key.hasPrivateKey():
raise SyntaxError("Not a private key!")
if public:
- Read upRead up
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 add_dynamic_size
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def add_dynamic_size(self, msg_type, size_offset, size_of_size):
"""Add a message type which has a dynamic size set in a header"""
if msg_type in self.priorities:
raise ValueError("Message type already defined")
if size_of_size < 1:
- Read upRead up
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 ct_check_cbc_mac_and_pad
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def ct_check_cbc_mac_and_pad(data, mac, seqnumBytes, contentType, version,
block_size=16):
"""
Check CBC cipher HMAC and padding. Close to constant time.
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function decrypt
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def decrypt(self, ciphertext):
"""Decrypt a block of ciphertext."""
if len(ciphertext) != self.block_size:
raise ValueError('wrong block length, expected {0} got {1}'
.format(self.block_size, len(ciphertext)))
- Read upRead up
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 _guard_against_unicode
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def _guard_against_unicode(self, data):
"""Check the data for valid datatype and return them.
Only accept byte strings or ascii unicode values.
Otherwise there is no way to correctly decode the data into bytes.
- Read upRead up
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"