hSaria/cPing

View on GitHub
cping/layouts/modern.py

Summary

Maintainability
A
0 mins
Test Coverage

Function render has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring.
Wontfix

    def render(self, window):
        '''Start rendering the layout. Blocking function meant to be called with
        `curses.wrapper(self.render)`.'''
        # pylint: disable=too-many-branches,not-an-iterable  # linter bug
        Layout.initialize_colors()
Severity: Minor
Found in cping/layouts/modern.py - About 4 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 get_table has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Wontfix

def get_table(hosts, sort_key=0, show_address=False):
    '''Returns a list of dictionaries, one for each row.

    Args:
        hosts (list): The hosts upon which the table is based.
Severity: Minor
Found in cping/layouts/modern.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 render_sparkline has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Wontfix

    def render_sparkline(window, line, column, host, length):
        '''Render a sparkline at the requested position.

        Args:
            window (curses.window): Window to which the sparkline is rendered.
Severity: Minor
Found in cping/layouts/modern.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 render_table has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Wontfix

    def render_table(window, table, selection):
        '''Calls `window.addnstr` to render the table based on the selection.

        Args:
            window (curses.window): Window to which the table is rendered.
Severity: Minor
Found in cping/layouts/modern.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_host_columns has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Wontfix

def get_host_columns(host, show_address=False):
    '''Returns a list of strings containing host, min, avg, max, stdev, loss.

    Args:
        host (cping.protocols.Host): Host from which to get the details.
Severity: Minor
Found in cping/layouts/modern.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

There are no issues that match your filters.

Category
Status