jason-neal/eniric

View on GitHub

Showing 22 of 105 total issues

Function barycenter_broaden has a Cognitive Complexity of 37 (exceeds 10 allowed). Consider refactoring.
Open

    def barycenter_broaden(self, rv: float = 30.0, consecutive_test: bool = False):
        """Sweep telluric mask symmetrically by +/- a velocity.

        Updates the objects mask.

Severity: Minor
Found in eniric/atmosphere.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 phoenix_precision.py has 514 lines of code (exceeds 400 allowed). Consider refactoring.
Open

#!/usr/bin/env python
"""
phoenix_precision.py
--------------------
Script to generate RV precision of synthetic spectra, see :ref:`Calculating-Precisions`.
Severity: Major
Found in scripts/phoenix_precision.py - About 4 hrs to fix

    File precision_four_panel.py has 465 lines of code (exceeds 400 allowed). Consider refactoring.
    Open

    """
    precision_four_panel.py
    -----------------------
    Plot a Figueira et al. (2016) Figure 1 like plot.
    
    
    Severity: Minor
    Found in scripts/precision_four_panel.py - About 3 hrs to fix

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

      class TestConfig:
          @pytest.fixture
          def test_config(self):
              """Config file for testing."""
              filename = test_filename
      Severity: Minor
      Found in tests/test_config.py - About 2 hrs to fix

        Function main has a Cognitive Complexity of 22 (exceeds 10 allowed). Consider refactoring.
        Open

        def main(
            model: str = atmmodel,
            bands: Optional[List[str]] = None,
            new_name: Optional[str] = None,
            data_dir: Optional[str] = None,
        Severity: Minor
        Found in scripts/split_atmmodel.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 __getattr__ has a Cognitive Complexity of 17 (exceeds 10 allowed). Consider refactoring.
        Open

            def __getattr__(self, key):
                if key in self:
                    if key == "paths":
                        paths = self["paths"]
                        for k, value in paths.items():
        Severity: Minor
        Found in eniric/_config.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 cumulative_plot has a Cognitive Complexity of 16 (exceeds 10 allowed). Consider refactoring.
        Open

        def cumulative_plot(
            precision_file,
            teffs=None,
            logg=4.5,
            fe_h=0.0,
        Severity: Minor
        Found in scripts/precision_four_panel.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 do_analysis has 12 arguments (exceeds 6 allowed). Consider refactoring.
        Open

        def do_analysis(
        Severity: Major
        Found in scripts/phoenix_precision.py - About 1 hr to fix

          Function convolution has 11 arguments (exceeds 6 allowed). Consider refactoring.
          Open

          def convolution(
          Severity: Major
          Found in eniric/broaden.py - About 1 hr to fix

            Function rotational_convolution has a Cognitive Complexity of 14 (exceeds 10 allowed). Consider refactoring.
            Open

            def rotational_convolution(
                wavelength: ndarray,
                extended_wav: ndarray,
                extended_flux: ndarray,
                vsini: float,
            Severity: Minor
            Found in eniric/broaden.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 rotational_convolution has 9 arguments (exceeds 6 allowed). Consider refactoring.
            Open

            def rotational_convolution(
            Severity: Major
            Found in eniric/broaden.py - About 50 mins to fix

              Function resolution_convolution has 9 arguments (exceeds 6 allowed). Consider refactoring.
              Open

              def resolution_convolution(
              Severity: Major
              Found in eniric/broaden.py - About 50 mins to fix

                Avoid deeply nested control flow statements.
                Open

                                        if np.sum(~mask_slice) > 3:
                                            if self.verbose:
                                                print(
                                                    (
                                                        "There were {0}/{1} zeros in this "
                Severity: Major
                Found in eniric/atmosphere.py - About 45 mins to fix

                  Avoid deeply nested control flow statements.
                  Open

                                  if args.add_rv:
                                      output_template = (
                                          "{0:5d},{1:3.01f},{2:4.01f},{3:3.01f},{4:s},{5:3d}k,"
                                          "{6:4.01f},{7:3.01f},{8:3.01f},{9:1d},{10:6d},{11:5.01f},"
                                          "{12:5.01f},{13:5.01f}\n"
                  Severity: Major
                  Found in scripts/phoenix_precision.py - About 45 mins to fix

                    Avoid deeply nested control flow statements.
                    Open

                                    if args.correct:
                                        # Apply Artigau 2018 Corrections
                                        corr_value = correct_artigau_2018(band)
                                        for ii, res in enumerate(result):
                                            if (ii > 0) and (result[ii] is not None):  # Not the quality
                    Severity: Major
                    Found in scripts/phoenix_precision.py - About 45 mins to fix

                      Function main has a Cognitive Complexity of 13 (exceeds 10 allowed). Consider refactoring.
                      Open

                      def main(bands: Optional[List[str]] = None, verbose: bool = False) -> None:
                          """Preform the barycentric shifting of atmosphere masks and saves result.
                      
                          This saves time in the precision determination code.
                      
                      
                      Severity: Minor
                      Found in scripts/barycenter_broaden_atmmodel.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

                                      with open(args.output, "a") as f:
                                          f.write(strip_whitespace(linetowite) + "\n")  # Make csv only
                      
                      
                      Severity: Major
                      Found in scripts/phoenix_precision.py - About 45 mins to fix

                        Function convolve_and_resample has 7 arguments (exceeds 6 allowed). Consider refactoring.
                        Open

                        def convolve_and_resample(
                        Severity: Major
                        Found in scripts/phoenix_precision.py - About 35 mins to fix

                          Function cumulative_plot has 7 arguments (exceeds 6 allowed). Consider refactoring.
                          Open

                          def cumulative_plot(
                          Severity: Major
                          Found in scripts/precision_four_panel.py - About 35 mins to fix

                            Function main has 7 arguments (exceeds 6 allowed). Consider refactoring.
                            Open

                            def main(
                            Severity: Major
                            Found in scripts/split_atmmodel.py - About 35 mins to fix
                              Severity
                              Category
                              Status
                              Source
                              Language