julienmalard/Tinamit

View on GitHub
tinamit0/unids/trads.py

Summary

Maintainability
C
1 day
Test Coverage

Function trad_unid has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring.
Open

def trad_unid(unid, leng_final, leng_orig=None, falla_silencio=True):
    """
    Traduce una unidad sencilla (no compuesta).

    Parameters
Severity: Minor
Found in tinamit0/unids/trads.py - About 4 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 _buscar_d_unid has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
Open

def _buscar_d_unid(unid, leng=None):
    """
    Busca el diccionario de una unidad.

    Parameters
Severity: Minor
Found in tinamit0/unids/trads.py - About 3 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 act_arch_trads has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

def act_arch_trads(l_d_t):
    """
    Actualiza el fuente de traducciones.

    Parameters
Severity: Minor
Found in tinamit0/unids/trads.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

Consider simplifying this complex logical expression.
Open

    if leng_orig is None:
        # Si no conocemos la lengua original, buscar todas.
        for u in l_u:
            unid_t = next((x[leng_final] for x in l_dic_trads
                           if (any([u == d['pr'] for d in x.values()]) or  # si `u` igual a la unidad principal
Severity: Major
Found in tinamit0/unids/trads.py - About 40 mins to fix

    Consider simplifying this complex logical expression.
    Open

        if unid_t is None and (leng_orig == 'en' or leng_orig is None):
            for u in l_u:
                try:
                    u_base = regu.get_name(u)
    
    
    Severity: Major
    Found in tinamit0/unids/trads.py - About 40 mins to fix

      Function agregar_trad has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

      def agregar_trad(unid, trad, leng_trad, leng_orig=None, guardar=True):
      Severity: Minor
      Found in tinamit0/unids/trads.py - About 35 mins to fix

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

        def agregar_trad(unid, trad, leng_trad, leng_orig=None, guardar=True):
            """
            Agregar una traducción a una unidad.
        
            Parameters
        Severity: Minor
        Found in tinamit0/unids/trads.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

        There are no issues that match your filters.

        Category
        Status