wafo-project/pywafo

View on GitHub

Showing 153 of 6,500 total issues

Function plot2d has a Cognitive Complexity of 18 (exceeds 15 allowed). Consider refactoring.
Open

def plot2d(axis, wdata, plotflag, *args, **kwds):
    f = wdata
    if isinstance(wdata.args, (list, tuple)):
        args1 = tuple((wdata.args)) + (wdata.data,) + args
    else:
Severity: Minor
Found in src/wafo/containers.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(1, Nx1):
                            J = IJ + i
                            pdf[:i, i, Ntd] = fxind[IJ:J].T  # *CC
                            err[:i, i, Ntd] = err0[IJ:J].T  # *CC
                            terr[:i, i, Ntd] = terr0[IJ:J].T  # *CC
Severity: Major
Found in src/wafo/spectrum/core.py - About 45 mins to fix

    Avoid deeply nested control flow statements.
    Open

                            if (Nx == 1):  # % THEN
                                #  Joint density of (TMd,TMm),(Tdm,TMm) given
                                #  the max and the min.
                                #  Note that the density is not scaled to unity
                                pdf[0, ts, tn] = fxind[0]  # %*CC
    Severity: Major
    Found in src/wafo/spectrum/core.py - About 45 mins to fix

      Function _a_levin has 9 arguments (exceeds 7 allowed). Consider refactoring.
      Open

          def _a_levin(self, omega, ff, gg, dgg, x, s, basis, *args, **kwds):
      Severity: Major
      Found in src/wafo/integrate_oscillating.py - About 45 mins to fix

        Function to_linspec has a Cognitive Complexity of 18 (exceeds 15 allowed). Consider refactoring.
        Open

            def to_linspec(self, ns=None, dt=None, cases=20, iseed=None,
                           fn_limit=sqrt(2), gravity=9.81):
                '''
                Split the linear and non-linear component from the Spectrum
                    according to 2nd order wave theory
        Severity: Minor
        Found in src/wafo/spectrum/core.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(1, Nx1):
                                    J = IJ + Nx1
                                    pdf[1:Nx1, i, 0] += fxind[IJ:J].T * dt  # *CC
                                    err[1:Nx1, i, 0] += err0[IJ:J].T * dt2
                                    terr[1:Nx1, i, 0] += terr0[IJ:J].T * dt
        Severity: Major
        Found in src/wafo/spectrum/core.py - About 45 mins to fix

          Function fit has a Cognitive Complexity of 18 (exceeds 15 allowed). Consider refactoring.
          Open

              def fit(self, data, *args, **kwds):
                  # Override rv_continuous.fit, so we can more efficiently handle the
                  # case where floc and fscale are given.
          
                  floc = kwds.get('floc', None)
          Severity: Minor
          Found in src/wafo/stats/_continuous_distns.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

                              if (row) * nh + col < nfigspertile:
                                  if idx < nfigs:
                                      figlft = int(
                                          screenpos[0] + (col + 1) * hspc + col * figwid)
                                      fighnd = wnds[idx]
          Severity: Major
          Found in src/wafo/fig.py - About 45 mins to fix

            Avoid deeply nested control flow statements.
            Open

                                if len(k6) > 0:
                                    k136 = k13[k6]
                                    bvn[k136] += (a[k6] * _W20[i] * exp(asr[k6]) *
                                                  (exp(-hk[k136] * (1 - rs[k6]) /
                                                       (2 * (1 + rs[k6]))) / rs[k6] -
            Severity: Major
            Found in src/wafo/gaussian.py - About 45 mins to fix

              Avoid deeply nested control flow statements.
              Open

                                  if nA == 1:
                                      fx = NN * (A / (1 - B * A) * e)
                                  else:
                                      rh = np.eye(A.shape[0]) - np.dot(B, A)
                                      # least squares
              Severity: Major
              Found in src/wafo/markov.py - About 45 mins to fix

                Avoid deeply nested control flow statements.
                Open

                                    if nA == 1:
                                        fx = NN / (1 - AA) * e
                                    else:
                                        # TODO CHECK this
                                        fx = NN * np.linalg.solve((I - AA), e)[0]  # (I-AA)\e
                Severity: Major
                Found in src/wafo/markov.py - About 45 mins to fix

                  Function polyint has a Cognitive Complexity of 18 (exceeds 15 allowed). Consider refactoring.
                  Open

                  def polyint(p, m=1, k=None):
                      """
                      Return an antiderivative (indefinite integral) of a polynomial.
                  
                      The returned order `m` antiderivative `P` of polynomial `p` satisfies
                  Severity: Minor
                  Found in src/wafo/polynomial.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

                  Consider simplifying this complex logical expression.
                  Open

                          if ((dcross == -1 and y[i] <= v and v < y[i + 1])
                                  or (dcross == 1 and v <= y[i] and y[i + 1] < v)):
                  
                              ind[ix] = i
                              ix += 1
                  Severity: Major
                  Found in src/wafo/_misc_numba.py - About 40 mins to fix

                    Function __init__ has 8 arguments (exceeds 7 allowed). Consider refactoring.
                    Open

                        def __init__(self, fit_dist, logsf, i=None, pmin=None, pmax=None, n=100,
                    Severity: Major
                    Found in src/wafo/stats/estimation.py - About 35 mins to fix

                      Function __init__ has 8 arguments (exceeds 7 allowed). Consider refactoring.
                      Open

                          def __init__(self, data, hs=None, kernel=None, alpha=0.0,
                      Severity: Major
                      Found in src/wafo/kdetools/kdetools.py - About 35 mins to fix

                        Function tospecdata has 8 arguments (exceeds 7 allowed). Consider refactoring.
                        Open

                            def tospecdata(self, L=None, tr=None, method='cov', detrend=detrend_mean,
                        Severity: Major
                        Found in src/wafo/objects.py - About 35 mins to fix

                          Function reslife has 8 arguments (exceeds 7 allowed). Consider refactoring.
                          Open

                          def reslife(data, u=None, umin=None, umax=None, nu=None, nmin=3, alpha=0.05,
                          Severity: Major
                          Found in src/wafo/stats/core.py - About 35 mins to fix

                            Function osc_weights has 8 arguments (exceeds 7 allowed). Consider refactoring.
                            Open

                            def osc_weights(omega, g, d_g, x, basis, a_b, *args, **kwds):
                            Severity: Major
                            Found in src/wafo/integrate_oscillating.py - About 35 mins to fix

                              Function _quad_osc has 8 arguments (exceeds 7 allowed). Consider refactoring.
                              Open

                                  def _quad_osc(self, f, g, dg, a, b, omega, *args, **kwds):
                              Severity: Major
                              Found in src/wafo/integrate_oscillating.py - About 35 mins to fix

                                Function padefitlsq has 8 arguments (exceeds 7 allowed). Consider refactoring.
                                Open

                                def padefitlsq(fun, m, k, a=-1, b=1, trace=False, x=None, end_points=True):
                                Severity: Major
                                Found in src/wafo/polynomial.py - About 35 mins to fix
                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language