bel/db/arangodb.py

Summary

Maintainability
C
1 day
Test Coverage

File arangodb.py has 298 lines of code (exceeds 250 allowed). Consider refactoring.
Open

# Standard Library
import re
from dataclasses import dataclass
from typing import List, Mapping, Optional

Severity: Minor
Found in bel/db/arangodb.py - About 3 hrs to fix

    Function get_resources_handles has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
    Open

    def get_resources_handles(client, username=None, password=None):
        """Get BEL Resources arangodb handle"""
    
        (username, password) = get_user_credentials(username, password)
    
    
    Severity: Minor
    Found in bel/db/arangodb.py - About 2 hrs 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 batch_load_docs has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
    Open

    def batch_load_docs(db, doc_iterator, on_duplicate: str = "replace"):
        """Batch load documents
    
        Args:
            db: ArangoDB client database handle
    Severity: Minor
    Found in bel/db/arangodb.py - About 2 hrs 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_bel_handles has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
    Open

    def get_bel_handles(client, username=None, password=None):
        """Get BEL API arango db handle"""
    
        (username, password) = get_user_credentials(username, password)
    
    
    Severity: Minor
    Found in bel/db/arangodb.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 update_index_state has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

    def update_index_state(collection, desired_indexes: List[IndexDefinition]):
        """Update index state
    
        desired_indexes keys = f"{index_type}_{'_'.join(sorted(fields))}", e.g. persistent_firstname_lastname
    
    
    Severity: Minor
    Found in bel/db/arangodb.py - About 35 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