Showing 26 of 48 total issues
MailTicket
has 26 functions (exceeds 20 allowed). Consider refactoring. Open
class MailTicket:
""" Classe que encapsula un mail que es convertira en un ticket """
def __init__(self, fitxer):
self.filtrar_attachments_per_nom \
Function modificar_tiquet
has 24 arguments (exceeds 4 allowed). Consider refactoring. Open
def modificar_tiquet(
Function alta_tiquet
has 19 arguments (exceeds 4 allowed). Consider refactoring. Open
def alta_tiquet(
Function obtenir_uid_remot
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def obtenir_uid_remot(self, mail):
try:
# Pot ser que un usuari d'un departament no tingui a identitat
# digital un mail del tipus @upc.edu, aixi que primer comprovem
# si la part esquerra del mail correspon a un usuari UPC real
- 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 obtenir_parametres_addicionals
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def obtenir_parametres_addicionals(self):
defaults = {
"equipResolutor": settings.get("equip_resolutor_nous"),
"enviarMissatgeCreacio": self.enviar_missatge_creacio
}
- 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 cerca_ldap
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def cerca_ldap(self, ldap_srv, mail, base_s):
"""Fa efectiva la cerca a ldap."""
# Scope te tres opcions, SUBTREE cerca a totes les subcarpetes
scope = ldap.SCOPE_SUBTREE
# El filtre consisteix en un cn(common name) y una paraula clau.
- 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 tracta_body
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def tracta_body(self):
if not self.msg.is_multipart():
part = self.msg
self.body = self.codifica(part)
if not part.get_content_type() in ['text/html']:
- 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 filtrar
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def filtrar(self):
logger.info("Aplico filtre...")
body = self.msg.get_body()
subject = self.msg.get_subject()
- 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 aplicar_filtres
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def aplicar_filtres(mail, tickets=None, identitat=None):
"""
Apliquem tots els filtres segons l'ordre definit al settings,
mirant primer si son aplicables i aplicant despres
"""
- 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 consulta_tiquets
has 9 arguments (exceeds 4 allowed). Consider refactoring. Open
def consulta_tiquets(
Function consulta_tiquets_dades
has 9 arguments (exceeds 4 allowed). Consider refactoring. Open
def consulta_tiquets_dades(
Function filtrar
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def filtrar(self):
body = self.msg.get_body()
if self.solicitant == self.solicitant_segons_ticket:
notificat = 'N'
else:
- 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 comprovar_attachment_valid
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def comprovar_attachment_valid(self, attachment):
if attachment.is_multipart():
return False
filename = attachment.get_filename()
- 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 treure_reply_text
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def treure_reply_text(text):
blocs = 0
anterior = False
linies = text.split("<br/>\n")
sensequotes = []
- 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
Avoid deeply nested control flow statements. Open
if header_value and regex.match(header_value):
logger.info("Tinc parametres adicionals via %s"
% header_name)
defaults.update(item['defaults'])
Function get_attachments
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def get_attachments(self):
if self.body is None:
self.tracta_body()
attachments = []
- 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 obtenir_uid_de_patrons
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def obtenir_uid_de_patrons(self, mail):
try:
for k, v in self.patrons_mails_addicionals.items():
patro = re.compile(k)
m = patro.match(mail)
- 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 treure_bloc
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def treure_bloc(text, regex_inici, regex_fi):
pgp = False
cos = []
linies = text.split("\n")
for linia in linies:
- 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 treure_signatura_text
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def treure_signatura_text(text):
blocs = 0
signatura = False
cos = []
linies = text.split(r"<br\s*/?>\n")
- 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
Avoid too many return
statements within this function. Open
return -1