errbotio/errbot

View on GitHub

Showing 155 of 224 total issues

Function flows_status has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring.
Open

    def flows_status(self, msg, args):
        """Displays the list of started flows."""
        with io.StringIO() as response:
            if not self._bot.flow_executor.in_flight:
                response.write("No Flow started.\n")
Severity: Minor
Found in errbot/core_plugins/flows.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 execute has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring.
Open

    def execute(self, flow: Flow) -> None:
        """
        This is where the flow execution happens from one of the thread of the pool.
        """
        while True:
Severity: Minor
Found in errbot/flow.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 __str__ has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
Open

    def __str__(self):
        nbcols = max(len(row) for row in chain(self.headers, self.rows))
        maxes = [
            0,
        ] * nbcols
Severity: Minor
Found in errbot/rendering/ansiext.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 serve_forever has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
Open

    def serve_forever(self) -> None:
        self.readline_support()

        if not self._rooms:
            # artificially join a room if None were specified.
Severity: Minor
Found in errbot/backends/text.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 open has 98 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        open: function (group, opts) {
            if (!group) {
                return;
            }

Severity: Major
Found in docs/_static/fancybox/jquery.fancybox.js - About 3 hrs to fix

    Function _start has 98 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

            _start: function (index) {
                var coming = {},
                    obj,
                    href,
                    type,
    Severity: Major
    Found in docs/_static/fancybox/jquery.fancybox.js - About 3 hrs to fix

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

      def bot_config_defaults(config: object) -> None:
          if not hasattr(config, "ACCESS_CONTROLS_DEFAULT"):
              config.ACCESS_CONTROLS_DEFAULT = {}
          if not hasattr(config, "ACCESS_CONTROLS"):
              config.ACCESS_CONTROLS = {}
      Severity: Minor
      Found in errbot/bootstrap.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 setup_bot has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
      Open

      def setup_bot(
          backend_name: str,
          logger: logging.Logger,
          config: object,
          restore: Optional[str] = None,
      Severity: Minor
      Found in errbot/bootstrap.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

      File cli.py has 312 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      #!/usr/bin/env python
      
      # This program is free software; you can redistribute it and/or modify
      # it under the terms of the GNU General Public License as published by
      # the Free Software Foundation; either version 3 of the License, or
      Severity: Minor
      Found in errbot/cli.py - About 3 hrs to fix

        Function _afterLoad has 86 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                _afterLoad: function () {
                    var coming = F.coming,
                        previous = F.current,
                        placeholder = 'fancybox-placeholder',
                        current,
        Severity: Major
        Found in docs/_static/fancybox/jquery.fancybox.js - About 3 hrs to fix

          Function acls has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
          Open

              def acls(self, msg, cmd, args, dry_run):
                  """
                  Check command against ACL rules as defined in the bot configuration.
          
                  :param msg: The original chat message.
          Severity: Minor
          Found in errbot/core_plugins/acls.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

          File plugins.py has 298 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          import logging
          import os
          import shutil
          from ast import literal_eval
          from pprint import pformat
          Severity: Minor
          Found in errbot/core_plugins/plugins.py - About 3 hrs to fix

            Function run has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
            Open

                def run(self):
                    """streams to all the clients synchronously"""
                    nb_clients = len(self.clients)
                    pipes = [
                        (io.open(r, "rb"), io.open(w, "wb"))
            Severity: Minor
            Found in errbot/streaming.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 _tag_botcmd has 23 arguments (exceeds 4 allowed). Consider refactoring.
            Open

            def _tag_botcmd(
            Severity: Major
            Found in errbot/__init__.py - About 2 hrs to fix

              IRCConnection has 25 functions (exceeds 20 allowed). Consider refactoring.
              Open

              class IRCConnection(SingleServerIRCBot):
                  def __init__(
                      self,
                      bot,
                      nickname,
              Severity: Minor
              Found in errbot/backends/irc.py - About 2 hrs to fix

                Function recurse_check_structure has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
                Open

                def recurse_check_structure(sample: Any, to_check: Any) -> None:
                    sample_type = type(sample)
                    to_check_type = type(to_check)
                
                    # Skip this check if the sample is None because it will always be something
                Severity: Minor
                Found in errbot/botplugin.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 _replace_charref has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
                Open

                def _replace_charref(s):
                    s = s.group(1)
                    if s[0] == "#":
                        # numeric charref
                        if s[1] in "xX":
                Severity: Minor
                Found in errbot/rendering/xhtmlim.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

                XMPPBackend has 24 functions (exceeds 20 allowed). Consider refactoring.
                Open

                class XMPPBackend(ErrBot):
                    room_factory = XMPPRoom
                    roomoccupant_factory = XMPPRoomOccupant
                
                    def __init__(self, config):
                Severity: Minor
                Found in errbot/backends/xmpp.py - About 2 hrs to fix

                  Function apropos has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def apropos(self, msg, args):
                          """Returns a help string listing available options.
                  
                          Automatically assigned to the "help" command."""
                          if not args:
                  Severity: Minor
                  Found in errbot/core_plugins/help.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 repos_update has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def repos_update(self, _, args):
                          """update the bot and/or plugins
                          use: !repos update all
                          to update everything
                          or: !repos update repo_name repo_name ...
                  Severity: Minor
                  Found in errbot/core_plugins/plugins.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

                  Severity
                  Category
                  Status
                  Source
                  Language