hSaria/cPing

View on GitHub
cping/layouts/legacy.py

Summary

Maintainability
A
0 mins
Test Coverage

Function format_host has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Wontfix

def format_host(host, host_padding, line_width):
    '''Returns a line representing a summary of the host's results.'''
    # line_width - host - min (8) - avg (8) - max (8) - stdev (8) - loss (8)
    host.set_results_length(line_width - host_padding - 8 * 5)
    line = str(host).ljust(host_padding)
Severity: Minor
Found in cping/layouts/legacy.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 get_histogram has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Wontfix

def get_histogram(host, length):
    '''Returns an ANSI-colored string representing the host's results.'''
    # Output optimization by only including color markers when the color changes
    line = ''
    length = max(length, HISTOGRAM_LENGTH_MINIMUM)
Severity: Minor
Found in cping/layouts/legacy.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