Showing 227 of 283 total issues
Function commands_handler
has a Cognitive Complexity of 210 (exceeds 5 allowed). Consider refactoring. Open
def commands_handler(cl, iq):
source = iq.getFrom().getStripped()
cmd = iq.getTag("command", namespace=xmpp.NS_COMMANDS)
if cmd:
result = iq.buildReply("result")
- Read upRead up
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 protocol.py
has 1259 lines of code (exceeds 250 allowed). Consider refactoring. Open
## protocol.py
##
## Copyright (C) 2003-2005 Alexey "Snake" Nezhdanov
##
## This program is free software; you can redistribute it and/or modify
File gateway.py
has 1112 lines of code (exceeds 250 allowed). Consider refactoring. Open
#!/usr/bin/env python2
# coding: utf-8
# vk4xmpp gateway, v3.6
# © simpleApps, 2013 — 2018.
Function parseAttachments
has a Cognitive Complexity of 90 (exceeds 5 allowed). Consider refactoring. Open
def parseAttachments(self, msg, spacer=""):
"""
“parses” attachments from the json to a string
"""
result = (MSG_APPEND, "")
- Read upRead up
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 simplexml.py
has 620 lines of code (exceeds 250 allowed). Consider refactoring. Open
## simplexml.py based on Mattew Allum's xmlstream.py
##
## Copyright (C) 2003-2005 Alexey "Snake" Nezhdanov
##
## This program is free software; you can redistribute it and/or modify
Function presence_handler
has a Cognitive Complexity of 57 (exceeds 5 allowed). Consider refactoring. Open
def presence_handler(cl, prs):
pType = prs.getType()
jidFrom = prs.getFrom()
source = jidFrom.getStripped()
resource = jidFrom.getResource()
- Read upRead up
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 dispatch
has a Cognitive Complexity of 55 (exceeds 5 allowed). Consider refactoring. Open
def dispatch(self, stanza, session=None, direct=0):
"""
Main procedure that performs XMPP stanza recognition and calling apppropriate handlers for it.
Called internally.
"""
- Read upRead up
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 register_handler
has a Cognitive Complexity of 54 (exceeds 5 allowed). Consider refactoring. Open
def register_handler(cl, iq):
source = iq.getFrom().getStripped()
destination = iq.getTo().getStripped()
result = iq.buildReply("result")
if USER_LIMIT:
- Read upRead up
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 groupchats.py
has 493 lines of code (exceeds 250 allowed). Consider refactoring. Open
# coding: utf-8
# This file is a part of VK4XMPP transport
# © simpleApps, 2013 — 2018.
# Installation:
Function method
has a Cognitive Complexity of 45 (exceeds 5 allowed). Consider refactoring. Open
def method(self, method, values=None, notoken=False):
"""
Executes a VK method
Args:
method: vk method
- Read upRead up
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 dispatcher.py
has 433 lines of code (exceeds 250 allowed). Consider refactoring. Open
## transports.py
##
## Copyright (C) 2003-2005 Alexey "Snake" Nezhdanov
##
## This program is free software; you can redistribute it and/or modify
File vkapi.py
has 427 lines of code (exceeds 250 allowed). Consider refactoring. Open
# coding: utf-8
# © simpleApps, 2013 — 2016.
"""
Manages VK API requests
Function incoming_message_handler
has a Cognitive Complexity of 40 (exceeds 5 allowed). Consider refactoring. Open
def incoming_message_handler(cl, msg):
"""
Handles incoming (xmpp) messages and sends them to VK
"""
if msg.getType() == "groupchat":
- Read upRead up
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 handleChatPresences
has a Cognitive Complexity of 39 (exceeds 5 allowed). Consider refactoring. Open
def handleChatPresences(source, prs):
"""
Makes the old users leave
Args:
source: stanza source
- Read upRead up
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 transports.py
has 409 lines of code (exceeds 250 allowed). Consider refactoring. Open
## transports.py
##
## Copyright (C) 2003-2004 Alexey "Snake" Nezhdanov
##
## This program is free software; you can redistribute it and/or modify
Function statustovk_prs01
has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring. Open
def statustovk_prs01(source, prs, retry=3):
if source in Users and prs.getType() in ("available", None):
if prs.getTo() == TransportID:
user = Users[source]
if user.settings.status_to_vk:
- Read upRead up
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 38 (exceeds 5 allowed). Consider refactoring. Open
def __init__(self, tag=None, attrs={}, payload=[], parent=None, nsp=None, node_built=False, node=None):
"""
Takes "tag" argument as the name of node (prepended by namespace, if needed and separated from it
by a space), attrs dictionary as the set of arguments, payload list as the set of textual strings
and child nodes that this node carries within itself and "parent" argument that is another node
- Read upRead up
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 processPollResult
has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring. Open
def processPollResult(user, data):
"""
Processes a poll result
Decides whether to send a chat/groupchat message or presence or just pass the iteration
Args:
- Read upRead up
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 message_handler
has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring. Open
def message_handler(cl, msg):
body = msg.getBody()
jidTo = msg.getTo()
destination = jidTo.getStripped()
jidFrom = msg.getFrom()
- Read upRead up
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 __str__
has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring. Open
def __str__(self, fancy=0):
"""
Method used to dump node into textual representation.
if "fancy" argument is set to True produces indented output for readability.
"""
- Read upRead up
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"