julienmalard/Tinamit

View on GitHub

Showing 188 of 188 total issues

Avoid deeply nested control flow statements.
Open

                    while not _fin_sección(f):
                        vrs = _extraer_vars(f)
                        for var, val in vrs:
                            if var not in dic_datos:
                                dic_datos[var] = np.full((n_años, n_est, n_polí), np.nan)
Severity: Major
Found in tinamit0/envolt/bf/sahysmod/_arch_egr.py - About 45 mins to fix

    Avoid deeply nested control flow statements.
    Open

                        for i in range(len(dims)):
                            try:
                                dims[i] = int(dims[i])
                            except ValueError:
                                dims[i] = int(dic_paráms[dims[i]])
    Severity: Major
    Found in tinamit0/envolt/bf/sahysmod/_arch_ingr/_anlzd_sntct.py - About 45 mins to fix

      Avoid deeply nested control flow statements.
      Open

                          for indices in itertools.product(*iterdims):
                              dic_temp = {}
                              for especLínea in línea_espec_tuple:
                                  for nombre_parám in especLínea[1]:
                                      nombre_parám = nombre_parám.strip('*')
      Severity: Major
      Found in tinamit0/envolt/bf/sahysmod/_arch_ingr/_anlzd_sntct.py - About 45 mins to fix

        Function escribir_archivo has 6 arguments (exceeds 4 allowed). Consider refactoring.
        Open

        def escribir_archivo(dic_paráms, nombre_arch_contenido, nombre_arch_plantilla, paráms_ent=None):
        Severity: Minor
        Found in tinamit0/envolt/bf/sahysmod/_arch_ingr/_anlzd_sntct.py - About 45 mins to fix

          Avoid deeply nested control flow statements.
          Open

                              for indices in itertools.product(*iterdims):
                                  dic_temp = {}
                                  for especLínea in tuple_espec_línea:
                                      línea_contenido = archContenido.readline().strip('\n')
                                      anal_línea(línea_contenido, especLínea[1], especLínea[0], dic_temp)
          Severity: Major
          Found in tinamit0/envolt/bf/sahysmod/_arch_ingr/_anlzd_sntct.py - About 45 mins to fix

            Function _act_vals_clima has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

                def _act_vals_clima(símismo, f_0, f_1, vars_clima=None):
            
                    vars_clima = vars_clima or símismo.vars_clima
            
                    # Actualizar datos de clima
            Severity: Minor
            Found in tinamit0/envolt/bf/_bloq.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

            Avoid deeply nested control flow statements.
            Open

                                for i in range(len(dims)):
                                    try:
                                        dims[i] = int(dims[i])
                                    except ValueError:
                                        dims[i] = int(dic_paráms[dims[i]])
            Severity: Major
            Found in tinamit0/envolt/bf/sahysmod/_arch_ingr/_anlzd_sntct.py - About 45 mins to fix

              Avoid deeply nested control flow statements.
              Open

                                  for especLínea in tuple_espec_línea:
              
                                      for nombre_parám in especLínea[1]:
                                          nombre_parám = nombre_parám.strip('*')
                                          dic_paráms[nombre_parám] = _crear_matriz_de_zeros(*dims)
              Severity: Major
              Found in tinamit0/envolt/bf/sahysmod/_arch_ingr/_anlzd_sntct.py - About 45 mins to fix

                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

                    Similar blocks of code found in 2 locations. Consider refactoring.
                    Open

                                        if u in unids_pres_a:
                                            a = re.sub(r'%s(?![\p{l}\p{m}])' % u, repl=u_t, string=a)
                    Severity: Minor
                    Found in tinamit0/unids/conv.py and 1 other location - About 40 mins to fix
                    tinamit0/unids/conv.py on lines 71..72

                    Duplicated Code

                    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                    Tuning

                    This issue has a mass of 34.

                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                    Refactorings

                    Further Reading

                    Similar blocks of code found in 2 locations. Consider refactoring.
                    Open

                                        if u in unids_pres_de:
                                            de = re.sub(r'%s(?![\p{l}\p{m}])' % u, repl=u_t, string=de)
                    Severity: Minor
                    Found in tinamit0/unids/conv.py and 1 other location - About 40 mins to fix
                    tinamit0/unids/conv.py on lines 73..74

                    Duplicated Code

                    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                    Tuning

                    This issue has a mass of 34.

                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                    Refactorings

                    Further Reading

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

                        def __init__(símismo, obj, nombre, lugares=None, fechas=None):
                    Severity: Minor
                    Found in tinamit0/datos/fuente.py - About 35 mins to fix

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

                      def obt_atrib_var(mod, var, cód_attrib, mns_error=None):
                      Severity: Minor
                      Found in tinamit0/envolt/mds/vensim_dll/_funcs.py - About 35 mins to fix

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

                            def __init__(
                        Severity: Minor
                        Found in src/tinamit/envolt/enchufes.py - About 35 mins to fix

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

                              def __init__(símismo, dic, nombre, lugares=None, fechas=None):
                          Severity: Minor
                          Found in tinamit0/datos/fuente.py - About 35 mins to fix

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

                                def __init__(símismo, archivo, llenar, alpha, **argsll):
                            Severity: Minor
                            Found in tinamit0/geog/mapa.py - About 35 mins to fix

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

                                  def __init__(símismo, nombre, t, vars_interés):
                              Severity: Minor
                              Found in tinamit0/mod/res.py - About 35 mins to fix

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

                                    def desconectar_vars(símismo, var_fuente, modelo_fuente, modelo_recip=None, var_recip=None):
                                Severity: Minor
                                Found in tinamit0/conect/_mod.py - About 35 mins to fix

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

                                      def __init__(símismo, obj, nombre, lugares=None, fechas=None):
                                  Severity: Minor
                                  Found in tinamit0/datos/fuente.py - About 35 mins to fix
                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language