julienmalard/Tinamit

View on GitHub
tinamit0/mod/extern.py

Summary

Maintainability
A
2 hrs
Test Coverage

Function relativizar_eje has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

def relativizar_eje(ref, otro):
    índ_ref = _obt_índ(ref)
    if isinstance(otro, TiempoCalendario):
        índ_otro = pd.to_datetime([otro.fecha()]) if isinstance(índ_ref, pd.DatetimeIndex) else pd.Index([otro.í])
    elif isinstance(otro, Tiempo):
Severity: Minor
Found in tinamit0/mod/extern.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 too many return statements within this function.
Open

        return pd.Index(dts)
Severity: Major
Found in tinamit0/mod/extern.py - About 30 mins to fix

    Avoid too many return statements within this function.
    Open

            return pd.to_datetime([dts])
    Severity: Major
    Found in tinamit0/mod/extern.py - About 30 mins to fix

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

          def _obt_a_t(m_xr, t, interpol):
              m_xr = m_xr.unstack()
              t_rel = relativizar_eje(m_xr, t)
              # para hacer: arreglar de forma corecta
              if m_xr['fecha'].values[0] == 0:
      Severity: Minor
      Found in tinamit0/mod/extern.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

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

      def _obt_índ(dts):
          if isinstance(dts, pd.Index):
              return dts
          if isinstance(dts, pd.DataFrame):
              return dts.index
      Severity: Minor
      Found in tinamit0/mod/extern.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