os3/utils/console.py

Summary

Maintainability
A
2 hrs
Test Coverage

Function pprint_list has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

def pprint_list(input_list):
    # http://stackoverflow.com/questions/25026556/output-list-like-ls
    (term_width, term_height) = get_terminal_size()
    if len( str(input_list) ) <= term_width:
        return '    '.join(input_list)
Severity: Minor
Found in os3/utils/console.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 get_terminal_size has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

def get_terminal_size():
    # http://stackoverflow.com/questions/566746/how-to-get-console-window-width-in-python
    import os
    env = os.environ
    def ioctl_GWINSZ(fd):
Severity: Minor
Found in os3/utils/console.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