KarrLab/obj_tables

View on GitHub
examples/decode_json_data.py

Summary

Maintainability
A
3 hrs
Test Coverage

Function decode_data has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
Open

def decode_data(encoded_data):
    """ Decode a data structure (arbitrary combination of list and dictionaries) that contains
    dictionaries that represent encoded objects and their relationships, preserving the high-level
    structure of the data structure. Objects and their relationships should be encoded into the
    data structure as follows:
Severity: Minor
Found in examples/decode_json_data.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 _decode_instance has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

def _decode_instance(encoded_data, decoded_objects, data_to_decode):
    """ Decode a data structure

    Args:
        encoded_data (:obj:`dict`, :obj:`list`, or scalar): data structure with
Severity: Minor
Found in examples/decode_json_data.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