luk036/ellpy

View on GitHub

Showing 20 of 20 total issues

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

def to_csdfixed(dec_val, nnz=4, debug=False):
    """Convert the argument to CSD Format."""

    if debug:
        print(
Severity: Minor
Found in src/pycsd/csd/csd.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 to_csd has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

def to_csd(dec_val, places=0, debug=False):
    """
    Convert the argument `dec_val` to a string in CSD Format.
    Parameters
    ----------
Severity: Minor
Found in src/pycsd/csd/csd.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 __call__ has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

    def __call__(self, x: Arr, Spsq: float):
        """[summary]

        Arguments:
            x (Arr): coefficients of autocorrelation
Severity: Minor
Found in src/ellpy/oracles/lowpass_oracle.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 cutting_plane_q has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

def cutting_plane_q(Omega, S, t, options=Options()):
    """Cutting-plane method for solving convex discrete optimization problem

    Arguments:
        Omega ([type]): perform assessment on x0
Severity: Minor
Found in src/ellpy/cutting_plane.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

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

def to_decimal(csd_str, debug=False):
    """Convert the CSD string to a decimal"""

    if debug:
        print("Converting: ", csd_str)
Severity: Minor
Found in src/pycsd/csd/csd.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

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

    def factor(self, getA: Callable[[int, int], float]) -> bool:
        """Perform Cholesky Factorization (square-root free version)

        Arguments:
            getA (callable): function to access symmetric matrix
Severity: Minor
Found in src/ellpy/oracles/chol_ext.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

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

def cycle_bits(i):
    global indent_

    indent_ += 2

Severity: Minor
Found in src/pycsd/dev/csd_numbers.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

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

def corr_bspline(Y, s, m, oracle, corr_core):
Severity: Minor
Found in src/ellpy/oracles/corr_bspline_oracle.py - About 35 mins to fix

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

        def __init__(self, Ap: Arr, As: Arr, Anr: Arr, Lpsq, Upsq):
    Severity: Minor
    Found in src/ellpy/oracles/lowpass_oracle.py - About 35 mins to fix

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

      def corr_poly(Y, s, m, oracle, corr_core):
      Severity: Minor
      Found in src/ellpy/oracles/corr_oracle.py - About 35 mins to fix

        Function cutting_plane_feas has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

        def cutting_plane_feas(Omega: Callable[[Any], Any], S, options=Options()) -> CInfo:
            """Find a point in a convex set (defined through a cutting-plane oracle).
        
            Description:
                A function f(x) is *convex* if there always exist a g(x)
        Severity: Minor
        Found in src/ellpy/cutting_plane.py - About 35 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 cutting_plane_dc has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

        def cutting_plane_dc(
            Omega: Callable[[Any, Any], Any], S, t, options=Options()
        ) -> Tuple[Any, Any, CInfo]:
            """Cutting-plane method for solving convex optimization problem
        
        Severity: Minor
        Found in src/ellpy/cutting_plane.py - About 35 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 update has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

            def update(self, cut):
                """Update ellipsoid core function using the cut
                        g' * (x - xc) + beta <= 0
        
                Arguments:
        Severity: Minor
        Found in src/ellpy/ell.py - About 35 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 CUTStatus.success
        Severity: Major
        Found in src/ellpy/ell.py - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

                  return (g, f), Spsq
          Severity: Major
          Found in src/ellpy/oracles/lowpass_oracle.py - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

                        return (g, f), None
            Severity: Major
            Found in src/ellpy/oracles/lowpass_oracle.py - About 30 mins to fix

              Avoid too many return statements within this function.
              Open

                              return (g, f), None
              Severity: Major
              Found in src/ellpy/oracles/lowpass_oracle.py - About 30 mins to fix

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

                    n = 0 if absnum < 1.0 else ceil(log(absnum * 1.5, 2))
                Severity: Minor
                Found in src/pycsd/csd/csd.py and 1 other location - About 30 mins to fix
                src/pycsd/csd/csd.py on lines 50..50

                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 32.

                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

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

                    n = 0 if absnum < 1.0 else ceil(log(absnum * 1.5, 2))
                Severity: Minor
                Found in src/pycsd/csd/csd.py and 1 other location - About 30 mins to fix
                src/pycsd/csd/csd.py on lines 157..157

                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 32.

                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 bsearch has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                def bsearch(
                    Omega: Callable[[Any], bool], Interval: Tuple, options=Options()
                ) -> Tuple[Any, CInfo]:
                    """[summary]
                
                Severity: Minor
                Found in src/ellpy/cutting_plane.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

                Severity
                Category
                Status
                Source
                Language