jason-neal/spectrum_overload

View on GitHub

Showing 13 of 13 total issues

File spectrum.py has 707 lines of code (exceeds 250 allowed). Consider refactoring.
Open

#!/usr/bin/python
# -*- coding: utf-8 -*-
"""Spectrum class to represent and manipulate astronomical spectra."""


Severity: Major
Found in spectrum_overload/spectrum.py - About 1 day to fix

    Spectrum has 35 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class Spectrum(object):
        """Spectrum class to represent and manipulate astronomical spectra.
    
        Attributes
        ----------
    Severity: Minor
    Found in spectrum_overload/spectrum.py - About 4 hrs to fix

      Function _operation_wrapper has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
      Open

          def _operation_wrapper(operation):
              """
              Perform an operation (addition, subtraction, multiplication, division,
              etc.) after checking for shape matching.
              """
      Severity: Minor
      Found in spectrum_overload/spectrum.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 __init__ has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
      Open

          def __init__(
              self,
              *,
              xaxis: Optional[Union[ndarray, List[Union[int, float]]]] = None,
              flux: Optional[Union[ndarray, List[Union[int, float]]]] = None,
      Severity: Minor
      Found in spectrum_overload/spectrum.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 xaxis has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

          def xaxis(self, value):
              """Setter for xaxis attribute.
      
              Turns value into a numpy array if it is not.
      
      
      Severity: Minor
      Found in spectrum_overload/spectrum.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 spline_interpolate_to has 7 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          def spline_interpolate_to(
      Severity: Major
      Found in spectrum_overload/spectrum.py - About 50 mins to fix

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

            def __pow__(
                self, other: Union[ndarray, "Spectrum", int, Tuple[int], List[int]]
            ) -> "Spectrum":
                """Exponential magic method."""
                if isinstance(other, Spectrum):
        Severity: Minor
        Found in spectrum_overload/spectrum.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 spline_interpolate_to has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

            def spline_interpolate_to(
                self,
                reference: Union[ndarray, str, "Spectrum", List[int], List[float]],
                w: None = None,
                bbox: Optional[Any] = None,
        Severity: Minor
        Found in spectrum_overload/spectrum.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 __init__ has 6 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            def __init__(
        Severity: Minor
        Found in spectrum_overload/spectrum.py - About 45 mins to fix

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

          def continuum(
          Severity: Minor
          Found in spectrum_overload/norm.py - About 45 mins to fix

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

            def continuum(
                wave: ndarray,
                flux: ndarray,
                method: str = "scalar",
                degree: Optional[int] = None,
            Severity: Minor
            Found in spectrum_overload/norm.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 crosscorr_rv has 5 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                def crosscorr_rv(
            Severity: Minor
            Found in spectrum_overload/spectrum.py - About 35 mins to fix

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

                  def doppler_shift(self, rv: float) -> None:
                      r"""Doppler shift wavelength by a given Radial Velocity.
              
                      Apply Doppler shift to the wavelength values of the spectrum
                      using the radial velocity value provided and the relation
              Severity: Minor
              Found in spectrum_overload/spectrum.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