mrDoctorWho/vk4xmpp

View on GitHub

Showing 227 of 283 total issues

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

def gateway_handler(cl, iq):
    jidTo = iq.getTo()
    itype = iq.getType()
    destination = jidTo.getStripped()
    iqChildren = iq.getQueryChildren()
Severity: Minor
Found in modules/mod_iq_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 proxy has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

def proxy(func):
    def wrapper(type, *args):
        if type:
            for (handler, typ, ns, makefirst) in args:
                if isinstance(ns, list):
Severity: Minor
Found in library/modulemanager.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 exterminateChats has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

def exterminateChats(user=None, chats=[]):
    """
    Calls a Dalek for exterminate the chat
    The chats argument must be a list of tuples
    """
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 RosterIqHandler has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

    def RosterIqHandler(self, dis, stanza):
        """
        Subscription tracker. Used internally for setting items state in
        internal roster representation.
        """
Severity: Minor
Found in library/xmpp/roster.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 _traversePath has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

    def _traversePath(self, node, jid, set=0):
        """
        Returns dictionary and key or None,None
        None - root node (w/o "node" attribute)
        /a/b/c - node
Severity: Minor
Found in library/xmpp/browser.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 cache has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

def cache(func):
    """
    Caches user/group ids for future usage
    """
    def wrapper(self, uid, fields=None):
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 removeUser has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

def removeUser(user, roster=False, notify=True):
    """
    Removes user from the database
    Args:
        user: User class object or jid without resource
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 uhtml has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

def uhtml(data):
    """
    Unescapes escaped html characters
    """
    if "&" in data:
Severity: Minor
Found in library/webtools.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

Consider simplifying this complex logical expression.
Open

        if key == KEY_PHOTO:
            photo = vcard.setTag(KEY_PHOTO)
            photo.setTagData(KEY_BINVAL, utils.getLinkData(value))

        elif key in (KEY_CTRY, KEY_LOCALITY) and value:
Severity: Critical
Found in modules/mod_iq_vcard.py - About 1 hr to fix

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

        def is_active(self, flag):
            """
            If given flag(s) should generate output.
            """
            # try to abort early to quicken code
    Severity: Minor
    Found in library/xmpp/debug.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 Execute has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
    Open

        def Execute(self, conn, request):
            """
            The method that handles all the commands, and routes them to the correct method for that stage.
            """
            # New request or old?
    Severity: Minor
    Found in library/xmpp/commands.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 13 (exceeds 5 allowed). Consider refactoring.
    Open

        def __init__(self, name=None, to=None, typ=None, frm=None, attrs={}, payload=[], timestamp=None, xmlns=None, node=None):
            """
            Constructor, name is the name of the stanza i.e. "message" or "presence" or "iq".
            to is the value of "to" attribure, "typ" - "type" attribute
            frn - from attribure, attrs - other attributes mapping, payload - same meaning as for simplexml payload definition
    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 receive has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
    Open

        def receive(self):
            """
            Reads all pending incoming data.
            In case of disconnection calls owner's disconnected() method and then raises IOError exception.
            """
    Severity: Minor
    Found in library/xmpp/transports.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 dictToDataForm has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
    Open

    def dictToDataForm(_dict, _fields=None):
        """
        Makes a buildForm()-compatible dict from a random key-value dict
        converts boolean types to a boolean field,
        converts multiline string to a text-multi field and so on.
    Severity: Minor
    Found in modules/mod_iq_disco.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 sendPhoto has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
    Open

    def sendPhoto(user, data, type, address, mType):
        mask = user.vk.permissions
        if mType == "chat_id":
            address = address.split("@")[0].split("#")[1]
            send = False
    Severity: Minor
    Found in modules/mod_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 SendHandler has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
    Open

        def SendHandler(self, conn):
            """
            Send next portion of data if it is time to do it. Used internally.
            """
            self.DEBUG("SendHandler called", "info")
    Severity: Minor
    Found in library/xmpp/filetransfer.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 makeHashes has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
    Open

        def makeHashes(self, user, uids=None):
            uids = uids or user.friends.keys()
            local = self.getLocalHashes(uids)
            if len(local) > 1:
                for uid in uids:
    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 active_set has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
    Open

        def active_set(self, active_flags=None):
            """
            Returns 1 if any flags where actually set, otherwise 0.
            """
            r = 0
    Severity: Minor
    Found in library/xmpp/debug.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 confirm has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
    Open

        def confirm(self):
            """
            Confirms the application and receives the token
            """
            url = "https://oauth.vk.com/authorize/"
    Severity: Minor
    Found in library/vkapi.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 PresenceHandler has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
    Open

        def PresenceHandler(self, dis, pres):
            """
            Presence tracker. Used internally for setting items' resources state in
            internal roster representation.
            """
    Severity: Minor
    Found in library/xmpp/roster.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