MushroomRL/mushroom-rl

View on GitHub
mushroom_rl/core/_impl/list_dataset.py

Summary

Maintainability
A
3 hrs
Test Coverage
D
63%

ListDataset has 22 functions (exceeds 20 allowed). Consider refactoring.
Open

class ListDataset(Serializable):
    def __init__(self, is_stateful, is_vectorized):
        self._dataset = list()
        self._policy_dataset = list()
        self._is_stateful = is_stateful
Severity: Minor
Found in mushroom_rl/core/_impl/list_dataset.py - About 2 hrs to fix

    Function get_view has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        def get_view(self, index, copy=False):
            view = self.create_new_instance(self)
    
            if isinstance(index, (int, slice)):
                view._dataset = self._dataset[index]
    Severity: Minor
    Found in mushroom_rl/core/_impl/list_dataset.py - About 45 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 from_array has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        def from_array(cls, states, actions, rewards, next_states, absorbings, lasts, policy_states=None,
                       policy_next_states=None):
            is_stateful = (policy_states is not None) and (policy_next_states is not None)
    
            dataset = cls(is_stateful, False)
    Severity: Minor
    Found in mushroom_rl/core/_impl/list_dataset.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