Showing 114 of 114 total issues
File schema.py
has 761 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 crypto.py
has 634 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 contract_job.py
has 431 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 new_from_user_input
has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring. Open
def new_from_user_input(user_input: Dict[str, Any]) -> "BinanceNetwork": # noqa: C901
"""Create a new BinanceNetwork model from user input
Args:
user_input: User dictionary input (assumed already passing create_binance_interchain_schema)
Returns:
- 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 a Cognitive Complexity of 36 (exceeds 5 allowed). Consider refactoring. Open
def verify_request_authorization( # noqa: C901
authorization: str,
http_verb: str,
full_path: str,
dcid: str,
- 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 redisearch.py
has 389 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 new_from_user_input
has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring. Open
def new_from_user_input(user_input: Dict[str, Any]) -> "EthereumNetwork": # noqa: C901
"""Create a new EthereumNetwork model from user input
Args:
user_input: User dictionary input (assumed already passing create_ethereum_interchain_schema)
Returns:
- 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 keys.py
has 357 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 extract_custom_indexes
has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring. Open
def extract_custom_indexes(self, transaction_type_model: "transaction_type_model.TransactionTypeModel") -> None:
"""Extracts and formats custom indexed data paths from payload"""
transaction_index_object: Dict[str, Any] = {}
if transaction_type_model.custom_indexes:
# Make sure the payload is valid json before trying to extract indexes
- 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_transaction_indexes
has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring. Open
def _generate_transaction_indexes() -> None: # noqa: C901
# -- CREATE INDEXES FOR TRANSACTIONS --
client = _get_redisearch_index_client(Indexes.transaction.value)
try:
client.create_index([redisearch.TagField("block_id")]) # Used for reverse-lookup of transactions by id (with no txn_type)
- 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 bnb.py
has 334 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 verify_block
has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring. Open
def verify_block(self, block: "model.BlockModel") -> bool: # noqa: C901
"""Verify a block with this class' keys
Args:
block: BlockModel to verify
Returns:
- 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 new_from_user_input
has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring. Open
def new_from_user_input(user_input: Dict[str, Any]) -> "BitcoinNetwork":
"""Create a new BitcoinNetwork model from user input
Args:
user_input: User dictionary input (assumed already passing create_bitcoin_interchain_schema)
Returns:
- 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 webserver_error_handler
has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring. Open
def webserver_error_handler(exception: Exception) -> Tuple[str, int, Dict[str, str]]: # noqa C901
if isinstance(exception, exceptions.UnauthorizedException):
status_code = 401
surface_error = invalid_auth(exception)
elif isinstance(exception, exceptions.APIRateLimitException):
- 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 authorization.py
has 303 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 matchmaking.py
has 295 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 process_receipt_v1
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
def process_receipt_v1(block_dto: Dict[str, Any]) -> None:
if not block_dto:
raise exceptions.ValidationException("block_dto missing")
_log.info(f"[RECEIPT] Got receipt from L{block_dto['header']['level']}: {block_dto}")
block_model = cast("model.BlockModel", None) # This will always get defined, or it will raise
- 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 broadcast_processor.py
has 288 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 btc.py
has 287 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 send_receipts
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
def send_receipts(l5_block: "l5_block_model.L5BlockModel") -> None:
receipt_path = "/v1/receipt"
get_claim_path = "/v1/claim"
chain_id_set = set()
_log.info(f"l5 block to loop {l5_block.__dict__}")
- 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"