Showing 114 of 114 total issues
Function __init__
has 12 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(
Function check_confirmations
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def check_confirmations() -> None:
last_confirmed_block = get_last_confirmed_block()
last_confirmed_block_number = last_confirmed_block["block_id"]
last_created_block = get_last_block_number()
- 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 convertbits
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def convertbits(data, frombits, tobits, pad=True):
"""General power-of-2 base conversion."""
acc = 0
bits = 0
ret = []
- 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 select_transaction
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def select_transaction(location: str, block_id: str, txn_id: str) -> dict:
"""select_transaction helper function
Args:
location: The S3 bucket to use
block_id: The ID of the block being searched
- 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 10 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(
Function __init__
has 10 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(
Function get_authorization
has 9 arguments (exceeds 4 allowed). Consider refactoring. Open
def get_authorization(
Function generate_authenticated_request
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def generate_authenticated_request(
http_verb: str, dcid: str, full_path: str, json_content: dict = None, hmac_hash_type: str = "SHA256"
) -> Tuple[dict, bytes]:
"""Generate request data (headers and body) for making authenticated http requests to other dragonchains or matchmaking
Args:
- 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 store_full_txns
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def store_full_txns(block_model: "l1_block_model.L1BlockModel") -> None:
"""
Store the transactions object as a single file per block in storage.
Also updates the indexes for each indexed transaction in ES with block information.
"""
- 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 is_key_allowed_v1
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def is_key_allowed_v1(self, api_resource: str, api_operation: str, api_name: str, extra_data: Optional[Dict[str, Any]] = None) -> bool:
"""Checks if a key is allowed with v1 permissions"""
allowed = self.permissions_document["default_allow"]
# Get our per-endpoint validation function now to ensure that api_name is valid before continuing
- 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 main
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def main() -> "ContractJob":
try:
job = ContractJob(task_definition=json.loads(EVENT))
except Exception:
raise exceptions.ContractException("Uncaught error in contract job")
- 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 create_openfaas_secrets
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def create_openfaas_secrets(self) -> None:
"""Creates secrets for openfaas functions
Args:
existing_model (obj, optional): The existing model for this contract if action is update
- 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
Consider simplifying this complex logical expression. Open
if self.update_model.disable_schedule:
schedule_condition = False
unschedule_condition = True
self.model.seconds = None
self.model.cron = None
Function search
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
def search(
Function update
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def update(
self, txn_type: Optional[str] = None, execution_order: Optional[str] = None, cron: Optional[str] = None, seconds: Optional[int] = None
) -> None:
"""Update this event instance
Args:
- 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 docker_login_if_necessary
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def docker_login_if_necessary(self) -> None:
"""Get authorization to pull docker images"""
if self.update_model and self.update_model.image:
auth = self.update_model.auth
registry = self.update_model.image.split("/")[0]
- 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 _decode_dict_response
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def _decode_dict_response(response: Mapping[Any, Any], decode: bool) -> Any:
if decode is True:
new_response = {}
for key, value in response.items():
if isinstance(key, 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"
Further reading
Function get_broadcast_dto
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def get_broadcast_dto(higher_level: int, block_id: str) -> Dict[str, Any]:
"""Get the broadcast dto for a block to a certain level
Args:
higher_level: (2-5)
block_id: block_id used to locate block in storage
- 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
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def search(
index: str,
query_str: str,
only_id: Optional[bool] = None,
verbatim: Optional[bool] = 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
Function get_hmac_message_string
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
def get_hmac_message_string(