mrDoctorWho/vk4xmpp

View on GitHub

Showing 283 of 283 total issues

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

          Avoid deeply nested control flow statements.
          Open

                              for size in sizes:
                                  if size.get("type") == key:
                                      body += "Photo: %s" % size.get("url")  # No new line needed if we have just one photo and no text
                                      found = True
                                      break
          Severity: Major
          Found in extensions/attachments.py - About 45 mins to fix

            Function publishInstance has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

            def publishInstance():
                """
                That's such a weird function just makes a post request
                to the vk4xmpp monitor which is located on http://xmppserv.ru/xmpp-monitor
                You can check out the source of The VK4XMPP Monitor utilty
            Severity: Minor
            Found in extensions/monitor.py - About 45 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

            Avoid deeply nested control flow statements.
            Open

                                if current.get("attachments"):
                                    body += spacer + parseAttachments(self, current, spacer)[1] + "\n" + spacer + "\n"
                            body += spacer + ("Wall: %s" % WALL_LINK % current)
            Severity: Major
            Found in extensions/attachments.py - About 45 mins to fix

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

                  def connect(self, dupe=None):
                      """
                      Starts connection. Connects to proxy, supplies login and password to it
                      (if were specified while creating instance). Instructs proxy to make
                      connection to the target server. Returns non-empty sting on success.
              Severity: Minor
              Found in library/xmpp/transports.py - About 45 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 RegisterNamespaceHandler has 6 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                  def RegisterNamespaceHandler(self, xmlns, handler, typ="", ns="", makefirst=0, system=0):
              Severity: Minor
              Found in library/xmpp/dispatcher.py - About 45 mins to fix

                Avoid deeply nested control flow statements.
                Open

                                    if isdef("ENABLE_RGB_CONVERSION") and ENABLE_RGB_CONVERSION:
                                        data = convertImage(data)
                                        mime = "jpeg"
                                    data = base64.b64encode(data)
                Severity: Major
                Found in extensions/sticker.py - About 45 mins to fix

                  Function init has 6 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                      def init(self, owner, id, jid, subject, date, users=[]):
                  Severity: Minor
                  Found in extensions/groupchats.py - About 45 mins to fix

                    Avoid deeply nested control flow statements.
                    Open

                                        if found:
                                            break
                    
                    
                    Severity: Major
                    Found in extensions/attachments.py - About 45 mins to fix

                      Avoid deeply nested control flow statements.
                      Open

                                          for image in images:
                                              if image.get("width") == size or image.get("height") == size:
                                                  body += "Sticker: %s" % image["url"]
                                                  found = True
                                                  break
                      Severity: Major
                      Found in extensions/attachments.py - About 45 mins to fix

                        Function handleMessage has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                        Open

                            def handleMessage(self, user, vkChat, retry=True):
                                """
                                Handle incoming (VK -> XMPP) messages
                                """
                                if self.created:
                        Severity: Minor
                        Found in extensions/groupchats.py - About 45 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 _discover has 6 arguments (exceeds 4 allowed). Consider refactoring.
                        Open

                        def _discover(disp, ns, jid, node=None, fb2b=0, fb2a=1):
                        Severity: Minor
                        Found in library/xmpp/features.py - About 45 mins to fix

                          Avoid deeply nested control flow statements.
                          Open

                                                  for each in stanza.getChildren():
                                                      self.dispatch(each, session, direct=1)
                                                  return None
                          Severity: Major
                          Found in library/xmpp/dispatcher.py - About 45 mins to fix

                            Avoid deeply nested control flow statements.
                            Open

                                                if not getattr(user, "last_status", None) or user.last_status != status:
                                                    if mask & 1024 == 1024:
                                                        if not status:
                                                            user.vk.method("status.set", {"text": ""})
                                                        else:
                            Severity: Major
                            Found in extensions/status.py - About 45 mins to fix

                              Avoid deeply nested control flow statements.
                              Open

                                                  if current.get("text") or current.get("copy_text"):
                                                      body += spacer + uhtml(compile_eol.sub("\n" + spacer, current["text"] or current.get("copy_text"))) + "\n"
                                                  if current.get("attachments"):
                              Severity: Major
                              Found in extensions/attachments.py - About 45 mins to fix

                                Function asDict has a Cognitive Complexity of 8 (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 45 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 8 (exceeds 5 allowed). Consider refactoring.
                                Open

                                    def __init__(self, name=None, value=None, typ=None, required=0, label=None, desc=None, options=[], node=None):
                                        """
                                        Create new data field of specified name,value and type. Also "required", "desc" and "options" fields can be set.
                                        Alternatively other XML object can be passed in as the "node" parameted to replicate it as a new datafiled.
                                        """
                                Severity: Minor
                                Found in library/xmpp/protocol.py - About 45 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

                                Severity
                                Category
                                Status
                                Source
                                Language