errbotio/errbot

View on GitHub

Showing 155 of 224 total issues

Backend has 22 functions (exceeds 20 allowed). Consider refactoring.
Open

class Backend(ABC):
    """
    Implements the basic Bot logic (logic independent from the backend) and leaves
    you to implement the missing parts.
    """
Severity: Minor
Found in errbot/backends/base.py - About 2 hrs to fix

    File repo_manager.py has 263 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import json
    import logging
    import os
    import re
    import shutil
    Severity: Minor
    Found in errbot/repo_manager.py - About 2 hrs to fix

      Function bindEvents has 54 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

              bindEvents: function () {
                  var current = F.current,
                      keys;
      
                  if (!current) {
      Severity: Major
      Found in docs/_static/fancybox/jquery.fancybox.js - About 2 hrs to fix

        Function find_roots has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
        Open

        def find_roots(path: str, file_sig: str = "*.plug") -> List:
            """Collects all the paths from path recursively that contains files of type `file_sig`.
        
            :param path:
                 a base path to walk from
        Severity: Minor
        Found in errbot/utils.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 recurse_node has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
        Open

            def recurse_node(
                self, response: io.StringIO, stack, f: FlowNode, flow: Flow = None
            ):
                if f in stack:
                    response.write(f'{"&emsp;&nbsp;" * (len(stack))}↺<br>')
        Severity: Minor
        Found in errbot/core_plugins/flows.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 47 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                init: function (opts, obj) {
                    var that = this,
                        list,
                        thumbWidth = opts.width,
                        thumbHeight = opts.height,
        Severity: Minor
        Found in docs/_static/fancybox/helpers/jquery.fancybox-thumbs.js - About 1 hr to fix

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

                  }, _afterLoad: function () {
                      var a = b.coming, d = b.current, e, c, k, g, h;
                      b.hideLoading();
                      if (a && !1 !== b.isActive)if (!1 === b.trigger("afterLoad", a, d))a.wrap.stop(!0).trigger("onReset").remove(), b.coming = null; else {
                          d && (b.trigger("beforeChange", d), d.wrap.stop(!0).removeClass("fancybox-opened").find(".fancybox-item, .fancybox-nav").remove());
          Severity: Minor
          Found in docs/_static/fancybox/jquery.fancybox.pack.js - About 1 hr to fix

            Function dispatch_request has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
            Open

                def dispatch_request(self, *args, **kwargs):
                    if self.raw:  # override and gives the request directly
                        response = self.func(request, **kwargs)
                    elif self.form_param:
                        content = request.form.get(self.form_param)
            Severity: Minor
            Found in errbot/core_plugins/wsview.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 check_repo has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
            Open

            def check_repo(repo):
                repo_name = repo.get("full_name", None)
                if repo_name is None:
                    log.error("No name in %s", repo)
                log.debug("Checking %s...", repo_name)
            Severity: Minor
            Found in tools/plugin-gen.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 __call__ has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
            Open

                def __call__(self, old):
                    @wraps(old)
                    def wrapper(*args, **kwds):
                        frame = inspect.getframeinfo(inspect.currentframe().f_back)
                        msg = f"{frame.filename}: {frame.lineno}: "
            Severity: Minor
            Found in errbot/utils.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 14 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                def __init__(
            Severity: Major
            Found in errbot/backends/irc.py - About 1 hr to fix

              Function _setDimension has 40 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                      }, _setDimension: function () {
                          var a = b.getViewport(), d = 0, e = !1, c = !1, e = b.wrap, k = b.skin, g = b.inner, h = b.current, c = h.width, j = h.height, m = h.minWidth, u = h.minHeight, n = h.maxWidth, p = h.maxHeight, s = h.scrolling, q = h.scrollOutside ?
                              h.scrollbarWidth : 0, x = h.margin, y = l(x[1] + x[3]), r = l(x[0] + x[2]), v, z, t, C, A, F, B, D, H;
                          e.add(k).add(g).width("auto").height("auto").removeClass("fancybox-tmp");
                          x = l(k.outerWidth(!0) - k.width());
              Severity: Minor
              Found in docs/_static/fancybox/jquery.fancybox.pack.js - About 1 hr to fix

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

                    def parse(config: ConfigParser) -> "PluginInfo":
                        """
                        Throws ConfigParserError with a meaningful message if the ConfigParser doesn't contain the minimal
                         information required.
                        """
                Severity: Minor
                Found in errbot/plugin_info.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 serve_forever has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                Open

                    def serve_forever(self) -> None:
                        self.connect_callback()  # notify that the connection occured
                        try:
                            while True:
                                log.debug("waiting on queue")
                Severity: Minor
                Found in errbot/backends/test.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 find_plugins has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                Open

                def find_plugins(query):
                    url = (
                        "https://api.github.com/search/repositories?q=%s+in:name+language:python&sort=stars&order=desc"
                        % query
                    )
                Severity: Minor
                Found in tools/plugin-gen.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 callback_message has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                Open

                    def callback_message(self, msg):
                        try:
                            if msg.is_direct:
                                username = msg.frm.person
                                if username in self.bot_config.CHATROOM_RELAY:
                Severity: Minor
                Found in errbot/core_plugins/chatRoom.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 serve_once has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                Open

                    def serve_once(self) -> None:
                        log.info("Initializing connection")
                        try:
                            self.telegram = telegram.Bot(token=self.token)
                            me = self.telegram.getMe()
                Severity: Minor
                Found in errbot/backends/telegram_messenger.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 re_botcmd has 12 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                def re_botcmd(
                Severity: Major
                Found in errbot/__init__.py - About 1 hr to fix

                  Function _afterZoomIn has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                          _afterZoomIn: function () {
                              var current = F.current;
                  
                              if (!current) {
                                  return;
                  Severity: Minor
                  Found in docs/_static/fancybox/jquery.fancybox.js - About 1 hr to fix

                    Function getOrigPosition has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                            getOrigPosition: function () {
                                var current = F.current,
                                    element = current.element,
                                    orig = current.orig,
                                    pos = {},
                    Severity: Minor
                    Found in docs/_static/fancybox/jquery.fancybox.js - About 1 hr to fix
                      Severity
                      Category
                      Status
                      Source
                      Language