Showing 114 of 114 total issues
Function _generate_l5_verification_indexes
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
def _generate_l5_verification_indexes() -> None:
client = _get_redisearch_index_client(Indexes.verification.value)
try:
client.create_index(
[
- 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 level_5_actions.py
has 281 lines of code (exceeds 250 allowed). Consider refactoring. Open
# Copyright 2020 Dragonchain, Inc.
# Licensed under the Apache License, Version 2.0 (the "Apache License")
# with the following modification; you may not use this file except in
# compliance with the Apache License and the following modification to it:
# Section 6. Trademarks. is deleted and replaced with:
Function _check_create_transaction_permission
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
def _check_create_transaction_permission(api_name_permissions: Dict[str, Any], extra_data: Optional[Dict[str, Any]]) -> Optional[bool]:
"""Method to check if creating a transaction is allowed
Args:
api_name_permissions: The specific section of the self.permissions_document for create_transaction
extra_data: Dictionary with the key "requested_types" which is an iterable of strings of the transaction types to check if allowed
- 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 update
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
def update(self) -> None:
"""Get the current version of the smart contract this job represents and update all data"""
_log.info("Fetching original contract model")
self.model = smart_contract_dao.get_contract_by_txn_type(self.update_model.txn_type)
self.old_model = copy.deepcopy(self.model)
- 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 smart_contract_model.py
has 270 lines of code (exceeds 250 allowed). Consider refactoring. Open
# Copyright 2020 Dragonchain, Inc.
# Licensed under the Apache License, Version 2.0 (the "Apache License")
# with the following modification; you may not use this file except in
# compliance with the Apache License and the following modification to it:
# Section 6. Trademarks. is deleted and replaced with:
File redis.py
has 269 lines of code (exceeds 250 allowed). Consider refactoring. Open
# Copyright 2020 Dragonchain, Inc.
# Licensed under the Apache License, Version 2.0 (the "Apache License")
# with the following modification; you may not use this file except in
# compliance with the Apache License and the following modification to it:
# Section 6. Trademarks. is deleted and replaced with:
Function make_matchmaking_request
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
def make_matchmaking_request(
http_verb: str, path: str, json_content: dict = None, retry: bool = True, authenticated: bool = True
) -> requests.Response:
"""Make an authenticated request to matchmaking and return the response
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 _generate_block_indexes
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
def _generate_block_indexes() -> None:
client = _get_redisearch_index_client(Indexes.block.value)
try:
client.create_index(
[
- 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 19 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(
File broadcast_functions.py
has 258 lines of code (exceeds 250 allowed). Consider refactoring. Open
# Copyright 2020 Dragonchain, Inc.
# Licensed under the Apache License, Version 2.0 (the "Apache License")
# with the following modification; you may not use this file except in
# compliance with the Apache License and the following modification to it:
# Section 6. Trademarks. is deleted and replaced with:
ContractJob
has 21 functions (exceeds 20 allowed). Consider refactoring. Open
class ContractJob(object):
"""Construct a new ContractJob instance
Args:
task_definition (dict): The task that triggered this contract job
Returns:
File api_key_model.py
has 255 lines of code (exceeds 250 allowed). Consider refactoring. Open
# Copyright 2020 Dragonchain, Inc.
# Licensed under the Apache License, Version 2.0 (the "Apache License")
# with the following modification; you may not use this file except in
# compliance with the Apache License and the following modification to it:
# Section 6. Trademarks. is deleted and replaced with:
Function __init__
has 16 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(
Function _get_custom_field_from_input
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def _get_custom_field_from_input(custom_index_input: "custom_index") -> redisearch.client.Field:
input_type = custom_index_input["type"]
field_name = custom_index_input["field_name"]
options = custom_index_input.get("options")
if input_type == "text":
- 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__(
Function __init__
has 13 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(
Function select_transaction
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def select_transaction(location: str, block_id: str, txn_id: str) -> dict:
block_id = process_key(block_id)
# Unfortunately, we can't cache this get due to recursive imports
# If it is possible, this should be revisited
obj = get(location, os.path.join("TRANSACTION", block_id)).decode("utf8")
- 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 parse_query_parameters
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def parse_query_parameters(params: Dict[str, str]) -> Dict[str, Any]:
query_params: Dict[str, Any] = {}
if not params.get("q"):
raise exceptions.ValidationException("User must specify a redisearch query string.")
query_params["q"] = params["q"]
- 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 query_transactions_v1
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def query_transactions_v1(params: Dict[str, Any], parse: bool = True) -> "RSearch":
"""invoke queries on redisearch indexes
Args:
params: Dictionary of redisearch query options
parse: If true, parse the transaction payload before returning
- 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 verify_request_authorization
has 12 arguments (exceeds 4 allowed). Consider refactoring. Open
def verify_request_authorization( # noqa: C901