mrDoctorWho/vk4xmpp

View on GitHub

Showing 227 of 283 total issues

Function statusfromvk_prs02 has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

def statusfromvk_prs02(prs, destination, source):
    if source != TransportID and destination in Users:
        user = Users[destination]
        if user.settings.status_from_vk and not prs.getType():
            id = vk2xmpp(source)
Severity: Minor
Found in extensions/status.py - About 25 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 getError has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def getError(self):
        """
        Return the error-condition (if present) or the textual description of the error (otherwise).
        """
        errtag = self.getTag("error")
Severity: Minor
Found in library/xmpp/protocol.py - About 25 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 _muc_getSubTagDataAttr has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def _muc_getSubTagDataAttr(self, tag, attr):
        for xtag in self.getTags("x", namespace=NS_MUC_USER):
            for child in xtag.getTags("item"):
                for cchild in child.getTags(tag):
                    return cchild.getData(), cchild.getAttr(attr)
Severity: Minor
Found in library/xmpp/protocol.py - About 25 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 parseXHTML has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

def parseXHTML(user, html, source, destination, mType="user_id"):
    body = html.getTag("body")
    if body:
        # TODO: Maybe would be better if we use regular expressions?
        src = body.getTagAttr("img", "src")
Severity: Minor
Found in modules/mod_xhtml.py - About 25 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 initializeUser has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

def initializeUser(source, resource, prs):
    """
    Initializes user for the first time after they connected
    """
    logger.debug("Got a presence. Searching jid in the database. (jid: %s)", source)
Severity: Minor
Found in modules/mod_prs_main.py - About 25 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 initialize has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def initialize(self, force=False, send=True, resource=None, first=False):
        """
        Initializes user after the connection has been completed
        Args:
            force: force sending subscription presence
Severity: Minor
Found in gateway.py - About 25 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 acceptCaptcha has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

def acceptCaptcha(key, source, destination):
    """
    Accepts the captcha value in 2 possible ways:
        1. User sent a message
        2. User sent an IQ with the captcha value
Severity: Minor
Found in modules/mod_msg_main.py - About 25 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