knipknap/exscript

View on GitHub

Showing 153 of 245 total issues

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

    def read_until(self, match, timeout=None):
        """Read until a given string is encountered or until timeout.
        When no match is found, return whatever is available instead,
        possibly the empty string.  Raise EOFError if the connection
        is closed and no cooked data is available.
Severity: Minor
Found in Exscript/protocols/telnetlib.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 any_match has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

def any_match(string, regex, flags=re.M):
    """
    Matches the given string against the given regex.

      - If no match is found, this function returns an empty list.
Severity: Minor
Found in Exscript/util/match.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 __init__ has 12 arguments (exceeds 4 allowed). Consider refactoring.
Open

    def __init__(self,
Severity: Major
Found in Exscript/protocols/protocol.py - About 1 hr to fix

    Function _handle_request has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
    Open

        def _handle_request(self, request):
            try:
                command, arg = request
                if command == 'acquire-account-for-host':
                    account = self.accm.acquire_account_for(arg, self)
    Severity: Minor
    Found in Exscript/queue.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 __init__ has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
    Open

        def __init__(self, lexer, parser, parent):
            Token.__init__(self, 'Term', lexer, parser, parent)
            self.term = None
            self.lft = None
            self.rgt = None
    Severity: Minor
    Found in Exscript/interpreter/term.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 set_from_template_string has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
    Open

        def set_from_template_string(self, string):
            """
            Reads the given template (SMTP formatted) and sets all fields
            accordingly.
    
    
    Severity: Minor
    Found in Exscript/util/mail.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 __init__ has 33 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        def __init__(self,
                     driver=None,
                     stdout=None,
                     stderr=None,
                     debug=0,
    Severity: Minor
    Found in Exscript/protocols/protocol.py - About 1 hr to fix

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

          def __init__(self, lexer, parser, parent):
              Token.__init__(self, 'Extract', lexer, parser, parent)
              self.varnames = []
              self.variables = {}
              self.append = False
      Severity: Minor
      Found in Exscript/interpreter/extract.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 format has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Open

      def format(logger,
                 show_successful=True,
                 show_errors=True,
                 show_traceback=True):
          """
      Severity: Minor
      Found in Exscript/util/report.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 extract has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Open

          def extract(self, context):
              # Re-initialize the variable content, because this method
              # might be called multiple times.
              for varname in self.varnames:
                  self.variables[varname] = []
      Severity: Minor
      Found in Exscript/interpreter/extract.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 _paramiko_auth has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Open

          def _paramiko_auth(self, username, password):
              # Try authentication using auth_none. This should (almost) always fail,
              # but provides us with info about allowed authentication types.
              try:
                  self.client.auth_none(username)
      Severity: Minor
      Found in Exscript/protocols/ssh2.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 _handle_connection has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Open

          def _handle_connection(self, conn):
              t = paramiko.Transport(conn)
              t.local_version = local_version
              try:
                  t.load_server_moduli()
      Severity: Minor
      Found in Exscript/servers/sshd.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 _domatch has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

          def _domatch(self, prompt, flush):
              if flush:
                  func = self.tn.expect
              else:
                  func = self.tn.waitfor
      Severity: Minor
      Found in Exscript/protocols/telnet.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 priority has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

          def priority(self):
              if self.op is None:
                  return 8
              elif self.op_type == 'arithmetic_operator' and self.op == '%':
                  return 7
      Severity: Minor
      Found in Exscript/interpreter/expression.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 __next__ has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

          def __next__(self):
              with self.condition:
                  while self.running:
                      if self.paused:
                          self.condition.wait()
      Severity: Minor
      Found in Exscript/workqueue/pipeline.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 __init__ has 8 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          def __init__(self,
      Severity: Major
      Found in Exscript/queue.py - About 1 hr to fix

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

            def prioritize(self, start, prio=1):
                # print("Prioritizing from", start.op, "with prio", prio, (start.lft,)
                # start.rgt)
                if prio == 6:
                    return
        Severity: Minor
        Found in Exscript/interpreter/expression.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 from_string has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

            def from_string(url, default_protocol='telnet'):
                """
                Parses the given URL and returns an URL object. There are some
                differences to Python's built-in URL parser:
        
        
        Severity: Minor
        Found in Exscript/util/url.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 variable_sub_cb has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

            def variable_sub_cb(self, match):
                field = match.group(0)
                escape = match.group(1)
                varname = match.group(2)
                value = self.parent.get(varname)
        Severity: Minor
        Found in Exscript/interpreter/string.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 check_channel_pty_request has 7 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            def check_channel_pty_request(self,
        Severity: Major
        Found in Exscript/servers/sshd.py - About 50 mins to fix
          Severity
          Category
          Status
          Source
          Language