mrDoctorWho/vk4xmpp

View on GitHub

Showing 227 of 283 total issues

Function connect has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

    def connect(self, server=None, proxy=None, secure=None, use_srv=True):
        """
        Connect to jabber server. If you want to specify different ip/port to connect to you can
        pass it as tuple as first parameter. If there is HTTP proxy between you and server
        specify it's address and credentials (if needed) in the second argument.
Severity: Minor
Found in library/xmpp/client.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 11 arguments (exceeds 4 allowed). Consider refactoring.
Open

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

    Function reconnectAndReauth has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

        def reconnectAndReauth(self, handlerssave=None):
            """
            Example of reconnection method. In fact, it can be used to batch connection and auth as well.
            """
            Dispatcher_ = False
    Severity: Minor
    Found in library/xmpp/client.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 _ has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

    def _(what):
        if what:
            name = "%s/locales/locale.%s" % (path, locale)
            what = what.replace("\n", "\\n")
            if locale != "en" and os.path.exists(name):
    Severity: Minor
    Found in library/stext.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 manageRoster has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

        def manageRoster(cls, user, jid, dist={}, action="add"):
            def answer(cl, stanza):
                if xmpp.isResultNode(stanza):
                    logger.debug("Roster has been successfully set (jid: %s)", jid)
                    user.markRosterSet()
    Severity: Minor
    Found in library/rostermanager.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 update has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

        def update(self, userObject):
            """
            Updates chat users and sends messages
            Uses two user lists to prevent losing of any of them
            """
    Severity: Minor
    Found in extensions/groupchats.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 10 arguments (exceeds 4 allowed). Consider refactoring.
    Open

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

      Function user_activity_remove has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Open

      def user_activity_remove():
          users = runDatabaseQuery("select * from last_activity", many=True)
          LA = utils.TimeMachine(USER_LIFETIME_LIMIT)
          for (jid, date) in users:
              if (time.time() - date) >= LA:
      Severity: Minor
      Found in extensions/user_activity.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 Process has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Open

          def Process(self, timeout=8):
              """
              Check incoming stream for data waiting. If "timeout" is positive - block for as max. this time.
              Returns:
              1) length of processed data if some data were processed;
      Severity: Minor
      Found in library/xmpp/dispatcher.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 captcha_handler has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Open

      def captcha_handler(cl, iq):
          if iq.getTagAttr("captcha", "xmlns") == xmpp.NS_CAPTCHA:
              source = iq.getFrom().getStripped()
              result = iq.buildReply("result")
              if source in Users:
      Severity: Minor
      Found in modules/mod_iq_captcha.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 xhtml_handler has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Open

      def xhtml_handler(cl, msg):
          destination = msg.getTo().getStripped()
          source = msg.getFrom()
          if isinstance(source, (str, unicode)):
              logger.warning("Received message did not contain a valid jid: %s", msg)
      Severity: Minor
      Found in modules/mod_msg_xhtml.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 9 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          def __init__(self, transport, port=5347, typ=None, debug=["always", "nodebuilder"], domains=None, sasl=0, bind=0, route=0, xcp=0):
      Severity: Major
      Found in library/xmpp/client.py - About 1 hr to fix

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

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

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

          def addPresenceHash(prs, destination, source):
              if destination in Users and not prs.getType():
                  user = Users[destination]
                  if user.settings.avatar_hash:
                      x = prs.setTag("x", namespace=xmpp.NS_VCARD_UPDATE)
          Severity: Minor
          Found in extensions/avatar_hash.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 a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
          Open

              def __init__(self, jid=None, node="", domain="", resource=""):
                  """
                  Constructor. JID can be specified as string (jid argument) or as separate parts.
                  Examples:
                  JID("node@domain/resource")
          Severity: Minor
          Found in library/xmpp/protocol.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 send has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
          Open

              def send(self, stanza):
                  """
                  Serialize stanza and put it on the wire. Assign an unique ID to it before send.
                  Returns assigned ID.
                  """
          Severity: Minor
          Found in library/xmpp/dispatcher.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 attachments_msg03 has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
          Open

          def attachments_msg03(msg, destination, source):
              body = msg.getBody()
              if body:
                  if msg.getType() == "groupchat":
                      user = Chat.getUserObject(destination)
          Severity: Minor
          Found in extensions/attachments.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 Bind has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
          Open

              def Bind(self, resource=None):
                  """
                  Perform binding. Use provided resource name or random (if not provided).
                  """
                  while self.bound is None and self._owner.Process(1):
          Severity: Minor
          Found in library/xmpp/auth.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 auth has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
          Open

              def auth(self, name, password, dup=None):
                  """
                  Authenticate component "name" with password "password".
                  """
                  self._User, self._Password, self._Resource = name, password, ""
          Severity: Minor
          Found in library/xmpp/client.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 plugin has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
          Open

              def plugin(self, owner):
                  """
                  Determine the best auth method (digest/0k/plain) and use it for auth.
                  Returns used method name on success. Used internally.
                  """
          Severity: Minor
          Found in library/xmpp/auth.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

          Severity
          Category
          Status
          Source
          Language