johejo/ppping

View on GitHub

Showing 7 of 7 total issues

Function __init__ has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
Open

    def __init__(self, args, *, timeout=1, rtt_scale=10, res_width=5, space=1,
                 duration=sys.maxsize, interval=0.8, step=0.05, closed=False,
                 config=None, no_host=False, only_ipv4=False, only_ipv6=False,
                 mode=curses.A_BOLD):
        self.args = args
Severity: Minor
Found in ppping/ppping.py - About 3 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 __init__ has 15 arguments (exceeds 4 allowed). Consider refactoring.
Open

    def __init__(self, args, *, timeout=1, rtt_scale=10, res_width=5, space=1,
Severity: Major
Found in ppping/ppping.py - About 1 hr to fix

    Function __init__ has 27 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        def __init__(self, args, *, timeout=1, rtt_scale=10, res_width=5, space=1,
                     duration=sys.maxsize, interval=0.8, step=0.05, closed=False,
                     config=None, no_host=False, only_ipv4=False, only_ipv6=False,
                     mode=curses.A_BOLD):
            self.args = args
    Severity: Minor
    Found in ppping/ppping.py - About 1 hr to fix

      Function get_line has 7 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          def get_line(self, head_char, no_host,
      Severity: Major
      Found in ppping/line.py - About 50 mins to fix

        Function scale_char has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

            def scale_char(self, rtt):
                if rtt < self.rtt_scale:
                    char = '▁'
                elif rtt < self.rtt_scale * 2:
                    char = '▂'
        Severity: Minor
        Found in ppping/ppping.py - About 45 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_line has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            def get_line(self, head_char, no_host,
                         arg_len, name_len, host_len, address_len, rtt_len):
        
                arg = self._ljust(self.arg, arg_len)
                name = self._ljust(self.name, name_len)
        Severity: Minor
        Found in ppping/line.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

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

            def _display_title(self):
                version = '{} v{}'.format(__title__, __version__)
        
                self.stdscr.addstr(0, 1, version, self.mode)
                self.stdscr.addstr(1, self.space, self.info, self.mode)
        Severity: Minor
        Found in ppping/ppping.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

        Severity
        Category
        Status
        Source
        Language