rgmining/dataset-io

View on GitHub

Showing 3 of 22 total issues

Function parse_state has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

def parse_state(fp, reviewer_handler=None, product_handler=None, iteration="final"):
    """Parse a state of a graph from an iterable.

    Parse a state outputted from print_state and call callback functions.
    The callback for reviewer must receive two arguments;
Severity: Minor
Found in dataset_io/helper.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 load has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

def load(g, fp, anomalous=None, normalize=normalize_rating):
    """Load a review dataset to a given graph object.

    The graph object must implement the :ref:`graph-interface` i.e.
    it must have the following methods:
Severity: Minor
Found in dataset_io/loader.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 __call__ has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def __call__(self):
        """Create a iterator returns sampled values.

        Yields:
          A normalized uniform random review score.
Severity: Minor
Found in dataset_io/sampler.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