KarrLab/wc_utils

View on GitHub
wc_utils/util/misc.py

Summary

Maintainability
C
1 day
Test Coverage
C
73%

File misc.py has 364 lines of code (exceeds 250 allowed). Consider refactoring.
Open

""" Miscellaneous utilities.

:Author: Jonathan Karr <karr@mssm.edu>
:Author: Arthur Goldberg <Arthur.Goldberg@mssm.edu>
:Date: 2016-11-05
Severity: Minor
Found in wc_utils/util/misc.py - About 4 hrs to fix

    Function validate_dataclass_type has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
    Open

        def validate_dataclass_type(self, attr_name):
            """ Validate the type of an attribute in a dataclass instance
    
            Args:
                attr_name (:obj:`str`): the name of the attribute to validate
    Severity: Minor
    Found in wc_utils/util/misc.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 isclass_by_name has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

    def isclass_by_name(cls_name, cls_info):
        """Compares a class name with the names of the classes in `cls_info`.
    
        Args:
            cls_name (:obj:`str`): class name
    Severity: Minor
    Found in wc_utils/util/misc.py - About 55 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 __init__ has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        def __init__(self, start_state, accepting_state, transitions):
            """
            Args:
                start_state (:obj:`object`): a DFSM's start state
                accepting_state (:obj:`object`): a DFSM must be in this state to accept a message sequence
    Severity: Minor
    Found in wc_utils/util/misc.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 as_dict has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

    def as_dict(obj):
        """ Provide a dictionary representation of `obj`
    
        `obj` must define an attribute called `ATTRIBUTES` which iterates over the attributes that
        should be included in the representation.
    Severity: Minor
    Found in wc_utils/util/misc.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