knipknap/exscript

View on GitHub

Showing 153 of 245 total issues

Function _prepare_connection has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

def _prepare_connection(func):
    """
    A decorator that unpacks the host and connection from the job argument
    and passes them as separate arguments to the wrapped function.
    """
Severity: Minor
Found in Exscript/queue.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 _update_verbosity has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def _update_verbosity(self):
        if self.verbose < 0:
            self.channel_map['status_bar'] = self.devnull
            self.channel_map['connection'] = self.devnull
            self.channel_map['errors'] = self.devnull
Severity: Minor
Found in Exscript/queue.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 _next has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

        def _next(self):
            # Make sure that the end is not yet reached.
            if len(self.path) == 0:
                raise StopIteration()

Severity: Minor
Found in Exscript/parselib/token.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 set_from_match has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def set_from_match(self, key, regex_list, string):
        """
        Given a list of functions or three-tuples (regex, value, confidence),
        this function walks through them and checks whether any of the
        items in the list matches the given string.
Severity: Minor
Found in Exscript/protocols/osguesser.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 append has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def append(self, data):
        """
        Appends the given data to the buffer, and triggers all connected
        monitors, if any of them match the buffer content.

Severity: Minor
Found in Exscript/util/buffer.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 _recvline has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def _recvline(self, channel):
        while not b'\n' in self.buf:
            if not self.running:
                return None
            try:
Severity: Minor
Found in Exscript/servers/sshd.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_account has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def _get_account(self, account):
        if isinstance(account, Context) or isinstance(account, _Context):
            return account.context()
        if account is None:
            account = self.last_account
Severity: Minor
Found in Exscript/protocols/protocol.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 _expect_any has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def _expect_any(self, prompt_list, flush=True):
        self._doinit()

        # Cancelled by a callback during self._say().
        if self.cancel:
Severity: Minor
Found in Exscript/protocols/dummy.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

Avoid too many return statements within this function.
Open

        return match.groups()
Severity: Major
Found in Exscript/util/match.py - About 30 mins to fix

    Avoid too many return statements within this function.
    Open

            return msg % (total, aborted, succeeded)
    Severity: Major
    Found in Exscript/util/report.py - About 30 mins to fix

      Avoid too many return statements within this function.
      Open

              return func(self)
      Severity: Major
      Found in Exscript/servers/httpd.py - About 30 mins to fix

        Avoid too many return statements within this function.
        Open

                    return 4
        Severity: Major
        Found in Exscript/interpreter/expression.py - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

                      return 1
          Severity: Major
          Found in Exscript/interpreter/expression.py - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

                        return [str(lft) + str(rgt)]
            Severity: Major
            Found in Exscript/interpreter/expression.py - About 30 mins to fix

              Avoid too many return statements within this function.
              Open

                          return [int(lft) <= int(rgt)]
              Severity: Major
              Found in Exscript/interpreter/expression.py - About 30 mins to fix

                Avoid too many return statements within this function.
                Open

                            return [int(lft) + int(rgt)]
                Severity: Major
                Found in Exscript/interpreter/expression.py - About 30 mins to fix

                  Avoid too many return statements within this function.
                  Open

                              return _error_401(self, 'qop with missing nc or cnonce')
                  Severity: Major
                  Found in Exscript/servers/httpd.py - About 30 mins to fix

                    Avoid too many return statements within this function.
                    Open

                                return 2
                    Severity: Major
                    Found in Exscript/interpreter/expression.py - About 30 mins to fix

                      Avoid too many return statements within this function.
                      Open

                                  return [lft or rgt]
                      Severity: Major
                      Found in Exscript/interpreter/expression.py - About 30 mins to fix

                        Avoid too many return statements within this function.
                        Open

                                    return _error_401(self, 'Invalid username or password')
                        Severity: Major
                        Found in Exscript/servers/httpd.py - About 30 mins to fix
                          Severity
                          Category
                          Status
                          Source
                          Language