KarrLab/wc_utils

View on GitHub

Showing 93 of 115 total issues

Avoid too many return statements within this function.
Open

                return units1_expr.check(units2_expr)
Severity: Major
Found in wc_utils/util/units.py - About 30 mins to fix

    Avoid too many return statements within this function.
    Open

                        return units1_expr.compare(units2_expr, operator.eq) or \
    Severity: Major
    Found in wc_utils/util/units.py - About 30 mins to fix

      Avoid too many return statements within this function.
      Open

                          return False
      Severity: Major
      Found in wc_utils/util/units.py - About 30 mins to fix

        Function weighted_percentile has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

        def weighted_percentile(values, weights, percentile, ignore_nan=True):
            """ Calculate percentile of a list of values, weighted by :obj:`weights`
        
            Args:
                values (:obj:`list` of :obj:`float`): values
        Severity: Minor
        Found in wc_utils/util/stats.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 __str__ has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            def __str__(self):
                """ Generate a string representation of the formula """
                vals = []
                for element, coefficient in self.items():
                    if coefficient == 0.:
        Severity: Minor
        Found in wc_utils/util/chem/core.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 get_sheet_names has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            def get_sheet_names(self):
                """ Get names of files contained within path glob
        
                Returns:
                    obj:`list` of `str`: list of file names
        Severity: Minor
        Found in wc_utils/workbook/io.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 weighted_median has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

        def weighted_median(values, weights, ignore_nan=True):
            """ Calculate the median of a list of values, weighted by :obj:`weights`
        
            Args:
                values (:obj:`list` of :obj:`float`): values
        Severity: Minor
        Found in wc_utils/util/stats.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

        Function transpose has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

        def transpose(lst):
            """ Swaps the first two dimensions of a two (or more) dimensional list
        
            Args:
                lst (:obj:`list` of :obj:`list`): two-dimensional list
        Severity: Minor
        Found in wc_utils/util/list.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 set_value has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            def set_value(d, target_key, new_value, match_type=True):
                """ Set values of target keys in a nested dictionary
        
                Consider every `key`-`value` pair in nested dictionary `d`. If `value` is not a `dict`,
                and `key` is equal to `target_key` then replace `value` with `new_value`. However, if
        Severity: Minor
        Found in wc_utils/util/dict.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 __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 none_to_empty has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

        def none_to_empty( param, value ):
            ''' If value is None, return an empty data structure whose type is indicated by param
        
            Args:
                param (:obj:`str`): a variable name whose prefix or suffix indicates its data type
        Severity: Minor
        Found in wc_utils/util/decorate_default_data_struct.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 cell_difference has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            def cell_difference(self, cell_self, cell_other):
                """ Get difference between cells
        
                Args:
                    cell_self (:obj:`object`): self cell
        Severity: Minor
        Found in wc_utils/workbook/core.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

        Severity
        Category
        Status
        Source
        Language