Function pgp_dump
has a Cognitive Complexity of 68 (exceeds 5 allowed). Consider refactoring. Open
def pgp_dump(cls, armored: str, packets: list = None):
"""
Generates a key using pgpdump.
:param armored: The armored data to output.
:param packets: Optional: A packets list to use instead of the armored data.
- 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
File keyinfo.py
has 342 lines of code (exceeds 250 allowed). Consider refactoring. Open
import time
import binascii
import base64
from enum import Enum
import pgpdump.packet
Function from_database_object
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
def from_database_object(cls, keyob: db.Key):
k = KeyInfo()
k.uid = keyob.uid
for uid in keyob.uid:
if cfg.cfg.config.features.keybase:
- 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 __init__
has 13 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(self, uid: list = None, keyid: str = None, fingerprint: str = None,
Function jsondes
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def jsondes(obj):
"""Default JSON serializer."""
import calendar, datetime
if isinstance(obj, datetime.datetime):
- 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 translate
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def translate(self, sig):
if sig[2] == 32:
return wrap("revoke")
elif sig[2] == 24:
return wrap("subsig")
- 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 _setup_keybase
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def _setup_keybase(self, username):
if cache.exists("keybase_" + username):
miss = False
# Load it without autofetching.
k = keybaseapi.User(username, autofetch=False)
- 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
Avoid too many return
statements within this function. Open
return wrap("sig")
Avoid too many return
statements within this function. Open
return KeyInfo(uid=uid, keyid=keyid, fingerprint=fingerprint, length=length, algo=algo,
Avoid too many return
statements within this function. Open
return wrap("sig-2")
Avoid too many return
statements within this function. Open
return wrap("sig-1")
Avoid too many return
statements within this function. Open
return wrap("sig??")