Showing 37 of 42 total issues
Function _discovery
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def _discovery(search_str: str) -> None:
"""
Begin a discovery for new keys in a search.
:param search_str: The string to search for.
:return: None.
- 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 -1
Avoid too many return
statements within this function. Open
return -4
Avoid too many return
statements within this function. Open
return wrap("sig")
Avoid too many return
statements within this function. Open
return redirect(url_for("frontend.getkeyinfo", key=keyinfo.shortid, added=True)), 302
Avoid too many return
statements within this function. Open
return -3
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 ""
Avoid too many return
statements within this function. Open
return json.dumps({"code": 5, "err": "Key exists and unchanged"}), 400, {"Content-Type": "application/json"}
Avoid too many return
statements within this function. Open
return wrap("sig-2")
Avoid too many return
statements within this function. Open
return "Invalid request", 400
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??")
Avoid too many return
statements within this function. Open
return 0
Avoid too many return
statements within this function. Open
return json.dumps({"code": 0, "err": ""}), 200, {"Content-Type": "application/json"}
Function search_through_keys
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def search_through_keys(search_str: str, page: int=1, count: int=10) -> Pagination:
"""
Searches through the keys via ID or UID name.
:param search_str: The string to search for.
Examples: '0xBF864998CDEEC2D390162087EB4084E3BF0192D9' for a fingerprint search
- 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 handle_key_broadcast
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def handle_key_broadcast():
# Recieve a new key broadcast.
if 'key' in request.form:
key = request.form["key"]
else:
- 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"