MediaMath/t1-python

View on GitHub
terminalone/t1types.py

Summary

Maintainability
A
1 hr
Test Coverage

Function float_or_none has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

def float_or_none(value, null_on_none=False):
    if value is not None:
        if isinstance(value, int):
            value = float(value)
        if not isinstance(value, float):
Severity: Minor
Found in terminalone/t1types.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 int_or_none has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

def int_or_none(value, null_on_none=False):
    if value is not None:
        if not isinstance(value, int):
            raise TypeError('must supply int')
        return value
Severity: Minor
Found in terminalone/t1types.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

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

def strpt(dt_string):
    """Convert ISO string time to datetime.datetime. No-op on datetimes"""
    # 2016-11-07T09:07:57
    # 2016-11-07T09:07:57+0000
    # 2016-11-16T12:31:10+00:00
Severity: Minor
Found in terminalone/t1types.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