Function add_pgp_key
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def add_pgp_key(armored: str) -> tuple:
"""
Adds a key to the database.
:param armored: The armored key data to add to the keyring.
:return: True and the keyid if the import succeeded, or:
- 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 get_pgp_armor_key
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def get_pgp_armor_key(keyid: str) -> str:
"""
Lookup a PGP key.
:param keyid: The key ID to lookup.
:return: The armored version of the PGP key, or None if the key does not exist in the DB.
- 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 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"