errbotio/errbot

View on GitHub

Showing 224 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

Similar blocks of code found in 2 locations. Consider refactoring.
Open

            var d = b.current, e = b.getViewport(), c = d.margin, f = b.wrap.width() + c[1] + c[3], g = b.wrap.height() + c[0] + c[2], c = {position: "absolute", top: c[0], left: c[3]};
Severity: Major
Found in docs/_static/fancybox/jquery.fancybox.pack.js and 1 other location - About 4 hrs to fix
docs/_static/fancybox/jquery.fancybox.js on lines 1397..1406

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 125.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

            var current = F.current,
                viewport = F.getViewport(),
                margin = current.margin,
                width = F.wrap.width() + margin[1] + margin[3],
                height = F.wrap.height() + margin[0] + margin[2],
Severity: Major
Found in docs/_static/fancybox/jquery.fancybox.js and 1 other location - About 4 hrs to fix
docs/_static/fancybox/jquery.fancybox.pack.js on lines 306..306

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 125.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

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

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

                  a.onload = function () {
                      this.onload = this.onerror = null;
                      b.coming.width = this.width / b.opts.pixelRatio;
                      b.coming.height = this.height / b.opts.pixelRatio;
                      b._afterLoad()
      Severity: Major
      Found in docs/_static/fancybox/jquery.fancybox.pack.js and 1 other location - About 3 hrs to fix
      docs/_static/fancybox/jquery.fancybox.js on lines 942..949

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 107.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

                  img.onload = function () {
                      this.onload = this.onerror = null;
      
                      F.coming.width = this.width / F.opts.pixelRatio;
                      F.coming.height = this.height / F.opts.pixelRatio;
      Severity: Major
      Found in docs/_static/fancybox/jquery.fancybox.js and 1 other location - About 3 hrs to fix
      docs/_static/fancybox/jquery.fancybox.pack.js on lines 178..183

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 107.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      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

                Severity
                Category
                Status
                Source
                Language