mrDoctorWho/vk4xmpp

View on GitHub

Showing 227 of 283 total issues

Function watchdog has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    def watchdog(cls):
        while cls.watchdog:
            for sock, (user, opener) in cls.__list.items():
                if (time.time() - opener.created) > OPENER_LIFETIME:
                    with cls.__lock:
Severity: Minor
Found in library/longpoll.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 buildDataForm has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

def buildDataForm(form=None, type="form", fields=[], title=None, data=[]):
    """
    Provides easier method to build data forms using dict for each form object
    Parameters:
        form: xmpp.DataForm object
Severity: Minor
Found in library/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 connect has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    def connect(self, username=None, password=None, token=None):
        """
        Initializes a VK() object and tries to make an authorization if no token provided
        Args:
            username: the user's phone number or e-mail for password authentication
Severity: Minor
Found in gateway.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, name=None, value=None, typ=None, required=0, label=None, desc=None, options=[], node=None):
Severity: Major
Found in library/xmpp/protocol.py - About 1 hr to fix

    Function __init__ has 8 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        def __init__(self, typ=None, queryNS=None, attrs={}, to=None, frm=None, payload=[], xmlns=NS_CLIENT, node=None):
    Severity: Major
    Found in library/xmpp/protocol.py - About 1 hr to fix

      Function __init__ has 8 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          def __init__(self, active_flags=None, log_file=sys.stderr, prefix="DEBUG: ", sufix="\n", time_stamp=0, flag_show=None, validate_flags=False, welcome=-1):
      Severity: Major
      Found in library/xmpp/debug.py - About 1 hr to fix

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

            def asDict(self):
                """
                Represent dataitem as simple dictionary mapping of datafield names to their values.
                """
                ret = {}
        Severity: Minor
        Found in library/xmpp/protocol.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 _as_one_list has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

            def _as_one_list(self, items):
                """
                Init param might contain nested lists, typically from group flags.
                This code organises lst and remves dupes.
                """
        Severity: Minor
        Found in library/xmpp/debug.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 Show has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

            def Show(self, flag, msg, prefix=""):
                msg = msg.replace("\r", "\\r").replace("\n", "\\n").replace("><", ">\n  <")
                if not colors_enabled:
                    pass
                elif prefix in self.colors:
        Severity: Minor
        Found in library/xmpp/debug.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 streamErrorHandler has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

            def streamErrorHandler(self, conn, error):
                name, text = "error", error.getData()
                for tag in error.getChildren():
                    if tag.getNamespace() == NS_XMPP_STREAMS:
                        if tag.getName() == "text":
        Severity: Minor
        Found in library/xmpp/dispatcher.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 __init__ has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

            def __init__(self, name, code=None, typ=None, text=None):
                """
                Create new error node object.
                Mandatory parameter: name - name of error condition.
                Optional parameters: code, typ, text. Used for backwards compartibility with older jabber protocol.
        Severity: Minor
        Found in library/xmpp/protocol.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 dobind has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

            def dobind(self, sasl):
                # This has to be done before binding, because we can receive a route stanza before binding finishes
                self._route = self.route
                if self.bind:
                    for domain in self.domains:
        Severity: Minor
        Found in library/xmpp/client.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 _getResourceData has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

            def _getResourceData(self, jid, dataname):
                """
                Return specific jid's resource representation in internal format. Used internally.
                """
                if jid.find("/") + 1:
        Severity: Minor
        Found in library/xmpp/roster.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 add has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

            def add(cls, some_user):
                """
                Adds the User class object to poll
                """
                debug("longpoll: adding user to poll (jid: %s)", some_user.source)
        Severity: Minor
        Found in library/longpoll.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 vcard_handler has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

        def vcard_handler(cl, iq):
            # Vcard feature makes transport hang (especially the photo part)
            # Many clients love to query vcards so much, so the solution was in adding a semaphore here and sleep() at the bottom
            # This is probably not a good idea, but for now this is the best one
            with VCARD_SEMAPHORE:
        Severity: Minor
        Found in modules/mod_iq_vcard.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 RegisterHandler has 7 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            def RegisterHandler(self, name, handler, typ="", ns="", xmlns=None, makefirst=0, system=0):
        Severity: Major
        Found in library/xmpp/dispatcher.py - About 50 mins to fix

          Function RegisterHandlerOnce has 7 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              def RegisterHandlerOnce(self, name, handler, typ="", ns="", xmlns=None, makefirst=0, system=0):
          Severity: Major
          Found in library/xmpp/dispatcher.py - About 50 mins to fix

            Function __init__ has 7 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                def __init__(self, tag=None, attrs={}, payload=[], parent=None, nsp=None, node_built=False, node=None):
            Severity: Major
            Found in library/xmpp/simplexml.py - About 50 mins to fix

              Function sendMessage has 7 arguments (exceeds 4 allowed). Consider refactoring.
              Open

              def sendMessage(destination, source, body=None, timestamp=0, typ="active", mtype="chat", mid=0):
              Severity: Major
              Found in gateway.py - About 50 mins to fix

                Function sendPresence has 7 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                def sendPresence(destination, source, pType=None, nick=None,
                Severity: Major
                Found in gateway.py - About 50 mins to fix
                  Severity
                  Category
                  Status
                  Source
                  Language