julienmalard/Tinamit

View on GitHub

Showing 184 of 188 total issues

Function gen_mod_bayes has a Cognitive Complexity of 106 (exceeds 5 allowed). Consider refactoring.
Open

    def gen_mod_bayes(
            símismo, líms_paráms, obs_x, obs_y, aprioris=None, binario=False, nv_jerarquía=None, í_datos=None,
            trsld_sub=False
    ):

Severity: Minor
Found in tinamit0/calibs/sintx/ec.py - About 2 days 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 leer_archivo has a Cognitive Complexity of 56 (exceeds 5 allowed). Consider refactoring.
Open

def leer_archivo(nombre_arch_contenido, nombre_arch_plantilla, paráms_ent=None):
    if paráms_ent is None:
        paráms_ent = []

    dic_paráms = {'#': []}
Severity: Minor
Found in tinamit0/envolt/bf/sahysmod/_arch_ingr/_anlzd_sntct.py - About 1 day 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 escribir_archivo has a Cognitive Complexity of 39 (exceeds 5 allowed). Consider refactoring.
Open

def escribir_archivo(dic_paráms, nombre_arch_contenido, nombre_arch_plantilla, paráms_ent=None):
    # k=1
    dic_config = {}
    with open(nombre_arch_contenido, 'w') as archContenido, open(nombre_arch_plantilla, 'r') as arch_plantilla:
        for templatelínea in arch_plantilla:
Severity: Minor
Found in tinamit0/envolt/bf/sahysmod/_arch_ingr/_anlzd_sntct.py - About 5 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 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

File mapa.py has 353 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import os

import matplotlib.pyplot as dib
import numpy as np
import shapefifile as sf
Severity: Minor
Found in tinamit0/geog/mapa.py - About 4 hrs to fix

    Function _buscar_forma has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
    Open

    def _buscar_forma(arch):
        n_est = n_polí = 0
        # para hacer: más elegante
        with open(arch, 'r') as d:
            f = d.readline()
    Severity: Minor
    Found in tinamit0/envolt/bf/sahysmod/_arch_egr.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 leer_arch_egr has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
    Open

    def leer_arch_egr(archivo, años=None, procesar=True):
        años = [años] if isinstance(años, int) else años
    
        dic_datos = {}
    
    
    Severity: Minor
    Found in tinamit0/envolt/bf/sahysmod/_arch_egr.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 gen_lugares has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
    Open

    def gen_lugares(archivo, nivel_base, nombre=None, col_cód='Código'):
        """
        Genera un lugar con todos los niveles y sublugares asociados desde un archivo ``.csv``.
    
        Cada columna en el ``.csv`` debe empezar con el nombre de un nivel, con la excepción de la columna ``col_cód``,
    Severity: Minor
    Found in tinamit0/geog/región.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

    File modelo.py has 321 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import datetime as ft
    import pickle
    from multiprocessing import Pool as Reserva
    from warnings import warn as avisar
    
    
    Severity: Minor
    Found in tinamit0/mod/modelo.py - About 3 hrs to fix

      Function calibrar has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
      Open

          def calibrar(
                  símismo, bd, lugar=None, líms_paráms=None, ops=None, corresp_vars=None, ord_niveles=None, jerárquico=True
          ):
              """
              Efectua una calibración bayesiana para cada lugar en ``Lugar`` según los datos en ``bd``.
      Severity: Minor
      Found in tinamit0/calibs/ec/_bayes.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 _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 cambiar_vals has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
      Open

          def cambiar_vals(símismo, valores):
              super().cambiar_vals(valores)
      
              # En Vensim, tenemos que incializar los valores de variables no editables antes de empezar la simulación.
              editables = [str(v) for v in símismo.variables.editables()]
      Severity: Minor
      Found in tinamit0/envolt/mds/vensim_dll/_envolt.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 convertir has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
      Open

      def convertir(de, a, val=1, lengua=None):
          """
          Esta función convierte un valor de una unidad a otra.
      
          Parameters
      Severity: Minor
      Found in tinamit0/unids/conv.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 _optimizar has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
      Open

      def _optimizar(func, líms_paráms, obs_x, obs_y, inic=None, **ops):
          """
          Optimiza una función basándose en observaciones.
      
          Parameters
      Severity: Minor
      Found in tinamit0/calibs/ec/_opt.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

      TestAnalizarEc has 24 functions (exceeds 20 allowed). Consider refactoring.
      Open

      class TestAnalizarEc(unittest.TestCase):
          @classmethod
          def setUpClass(cls):
              cls.ecs = {
                  'neg': ('y=-x', 2, -2),
      Severity: Minor
      Found in tinamit0/pruebas/test_sintaxis.py - About 2 hrs to fix

        Function _gen_vars has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
        Open

        def _gen_vars(mod):
            l_vars = []
        
            vars_y_tipos = {v: f.obt_atrib_var(mod, v, cód_attrib=14).lower() for v in f.obt_vars(mod)}
        
        
        Severity: Minor
        Found in tinamit0/envolt/mds/vensim_dll/_envolt.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 _dibujar_frm has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
        Open

            def _dibujar_frm(símismo, ejes, color):
                for i, frm in enumerate(símismo.forma.shapes()):
                    puntos = frm.points
                    partes = frm.parts
        
        
        Severity: Minor
        Found in tinamit0/geog/mapa.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 prod has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
        Open

            def prod(símismo, x):
                coef = None
                op = x.children[1].children[0]
                args = [x.children[0], x.children[2]]
                for i, a in enumerate(args):
        Severity: Minor
        Found in tinamit0/calibs/sintx/_vstr.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 _gen_vars has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
        Open

        def _gen_vars(mod):
            l_vars = []
        
            internos = ['FINAL TIME', 'TIME STEP', 'SAVEPER', 'INITIAL TIME']
            for i, f in mod.doc().iterrows():
        Severity: Minor
        Found in tinamit0/envolt/mds/pysd/_envolt.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 _coef_de_ec has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
        Open

        def _coef_de_ec(árbol, l_vars=None):
            if l_vars is None:
                l_vars = []
            if árbol.data == 'prod':
                arg1 = árbol.children[0]
        Severity: Minor
        Found in tinamit0/calibs/sintx/ec.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

        Severity
        Category
        Status
        Source
        Language