UPC/mailtoticket

View on GitHub

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 \
Severity: Minor
Found in mailticket.py - About 3 hrs to fix

    Function modificar_tiquet has 24 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        def modificar_tiquet(
    Severity: Major
    Found in soa/tiquets.py - About 3 hrs to fix

      Function alta_tiquet has 19 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          def alta_tiquet(
      Severity: Major
      Found in soa/tiquets.py - About 2 hrs to fix

        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
        Severity: Minor
        Found in soa/identitat.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 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
                }
        Severity: Minor
        Found in filtres/nou.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 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.
        Severity: Minor
        Found in ldaphelper.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 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']:
        Severity: Minor
        Found in mailticket.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 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()
        Severity: Minor
        Found in filtres/nou.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 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
            """
        Severity: Minor
        Found in filtres/__init__.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 consulta_tiquets has 9 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            def consulta_tiquets(
        Severity: Major
        Found in soa/tiquets.py - About 1 hr to fix

          Function consulta_tiquets_dades has 9 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              def consulta_tiquets_dades(
          Severity: Major
          Found in soa/tiquets.py - About 1 hr to fix

            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:
            Severity: Minor
            Found in filtres/reply.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 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()
            Severity: Minor
            Found in mailticket.py - About 55 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 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 = []
            Severity: Minor
            Found in netejahtml.py - About 55 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

            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'])
            
            
            Severity: Major
            Found in filtres/nou.py - About 45 mins to fix

              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 = []
              Severity: Minor
              Found in mailticket.py - About 45 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 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)
              Severity: Minor
              Found in soa/identitat.py - About 35 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 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:
              Severity: Minor
              Found in netejahtml.py - About 35 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 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")
              Severity: Minor
              Found in netejahtml.py - About 35 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

              Avoid too many return statements within this function.
              Open

                  return -1
              Severity: Major
              Found in mailtoticket.py - About 30 mins to fix
                Severity
                Category
                Status
                Source
                Language