dragonchain/dragonchain

View on GitHub
dragonchain/transaction_processor/level_5_actions.py

Summary

Maintainability
B
4 hrs
Test Coverage
A
99%

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:
Severity: Minor
Found in dragonchain/transaction_processor/level_5_actions.py - About 2 hrs to fix

    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()
    
    
    Severity: Minor
    Found in dragonchain/transaction_processor/level_5_actions.py - About 1 hr to fix

    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_pending_l4_blocks has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

    def get_pending_l4_blocks(block_id: str) -> List[str]:
        all_waiting_verification_keys = storage.list_objects(f"BROADCAST/TO_BROADCAST/{block_id}")
    
        l4_blocks = []
        for key in all_waiting_verification_keys:
    Severity: Minor
    Found in dragonchain/transaction_processor/level_5_actions.py - About 25 mins to fix

    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 execute has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

    def execute() -> None:
        """
        * Pops Level 4 records off the queue and Sets them to storage in directory called toBroadcast-${block_id}
        * Publishes to public nodes when required
        * Locates confirmations from public nodes when required
    Severity: Minor
    Found in dragonchain/transaction_processor/level_5_actions.py - About 25 mins to fix

    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

    There are no issues that match your filters.

    Category
    Status