mrDoctorWho/vk4xmpp

View on GitHub

Showing 227 of 283 total issues

Function getTags has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
Open

    def getTags(self, name, attrs={}, namespace=None, one=0):
        """
        Filters all child nodes using specified arguments as filter.
        Returns the list of nodes found.
        """
Severity: Minor
Found in library/xmpp/simplexml.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 discoverInfo has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
Open

def discoverInfo(disp, jid, node=None):
    """
    Query remote object about info that it publishes. Returns identities and features lists.
    """
    identities, features = [], []
Severity: Minor
Found in library/xmpp/features.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 auth has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
Open

    def auth(self, user, password, resource="", sasl=1):
        """
        Authenticate connnection and bind resource. If resource is not provided
        random one or library name used.
        """
Severity: Minor
Found in library/xmpp/client.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

VK has 24 functions (exceeds 20 allowed). Consider refactoring.
Open

class VK(object):
    """
    Contains methods to handle the VK stuff
    """
    def __init__(self, token=None, source=None):
Severity: Minor
Found in gateway.py - About 2 hrs to fix

    Function __init__ has a Cognitive Complexity of 19 (exceeds 5 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):
            self.debug_flags = []
            if welcome == -1:
                if active_flags and len(active_flags):
                    welcome = 1
    Severity: Minor
    Found in library/xmpp/debug.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 SASLHandler has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
    Open

        def SASLHandler(self, conn, challenge):
            """
            Perform next SASL auth step. Used internally.
            """
            if challenge.getNamespace() != NS_SASL:
    Severity: Minor
    Found in library/xmpp/auth.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 sendSticker has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
    Open

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

    def buildVcard(data, template=VCARD_TEMPLATE, fields=VCARD_FIELDS, user=None):
        """
        Builds a vcard.
        Uses VCARD_TEMPLATE as the base, then adds values from data.
        Values from data are get with the help of the VCARD_FIELDS dict.
    Severity: Minor
    Found in modules/mod_iq_vcard.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 StreamOpenReplyHandler has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
    Open

        def StreamOpenReplyHandler(self, conn, stanza):
            """
            Handle remote side reply about is it agree or not to receive our datastream.
            Used internally. Raises xmpppy event specfiying if the data transfer is agreed upon.
            """
    Severity: Minor
    Found in library/xmpp/filetransfer.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 connect has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
    Open

        def connect(self, server=None):
            """
            Try to connect to the given host/port.
            Returns non-empty string on success.
            """
    Severity: Minor
    Found in library/xmpp/transports.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 handleOutgoingChatMessage has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
    Open

    def handleOutgoingChatMessage(user, vkChat):
        """
        Handles outging VK messages and sends them to XMPP
        """
        # peer_id for newer APIs
    Severity: Minor
    Found in extensions/groupchats.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 starttag has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
    Open

        def starttag(self, tag, attrs):
            """
            XML Parser callback. Used internally.
            """
            self.check_data_buffer()
    Severity: Minor
    Found in library/xmpp/simplexml.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 updateFriends has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
    Open

        def updateFriends(self, cTime):
            """
            Updates friends list.
            Compares the current friends list to the new list
            Takes a corresponding action if any difference found
    Severity: Minor
    Found in gateway.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

    File debug.py has 260 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    ##   debug.py
    ##
    ##   Copyright (C) 2003 Jacob Lundqvist
    ##
    ##   This program is free software; you can redistribute it and/or modify
    Severity: Minor
    Found in library/xmpp/debug.py - About 2 hrs to fix

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

      def typingreader_watch(msg):
          jidFrom = msg.getFrom()
          source = jidFrom.getStripped()
          destination = msg.getTo().getStripped()
          if msg.getType() == "chat" and source in Users:
      Severity: Minor
      Found in extensions/message_reader.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 connect has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
      Open

          def connect(self, server=None, proxy=None, ssl=None, use_srv=False):
              """
              Make a tcp/ip connection, protect it with tls/ssl if possible and start XMPP stream.
              Returns None or "tcp" or "tls", depending on the result.
              """
      Severity: Minor
      Found in library/xmpp/client.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 repeat has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
      Open

      def repeat(maxRetries, resultType, *errors):
          """
          Tries to execute function ignoring specified errors specified number of
          times and returns specified result type on try limit.
          """
      Severity: Minor
      Found in library/vkapi.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 iterTags has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
      Open

          def iterTags(self, name, attrs={}, namespace=None):
              """
              Iterate over all children using specified arguments as filter.
              """
              for node in self.kids:
      Severity: Minor
      Found in library/xmpp/simplexml.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 getMessagesBulk has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
      Open

          def getMessagesBulk(self, peers, count=20, mid=0):
              """
              Receives messages for all the conversations' peers
              25 is the maximum number of conversations we can receive in a single request
              The sky is the limit!
      Severity: Minor
      Found in gateway.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 checkPID has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
      Open

      def checkPID():
          """
          Gets a new PID and kills the previous PID
          by signal 15 and then by 9
          """
      Severity: Minor
      Found in gateway.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