mrDoctorWho/vk4xmpp

View on GitHub

Showing 227 of 283 total issues

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

    def getPayload(self):
        """
        Return the payload of node i.e. list of child nodes and CDATA entries.
        F.e. for "<node>text1<nodea/><nodeb/> text2</node>" will be returned list:
        ["text1", <nodea instance>, <nodeb instance>, " text2"].
Severity: Minor
Found in library/xmpp/simplexml.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 send has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def send(self, data):
        """
        Writes raw outgoing data. Blocks until done.
        If supplied data is unicode string, encodes it to utf-8 before send.
        """
Severity: Minor
Found in library/xmpp/transports.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 IqHandler has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def IqHandler(self, conn, stanza):
        """
        Handles streams state change. Used internally.
        """
        typ = stanza.getType()
Severity: Minor
Found in library/xmpp/filetransfer.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

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

Severity
Category
Status
Source
Language