JonathonMSmith/growin

View on GitHub

Showing 21 of 21 total issues

File growth_rate.py has 483 lines of code (exceeds 250 allowed). Consider refactoring.
Open

"""
Calculation of altitude profiles of flux tube integrated growth rates of the
Rayleigh Taylor instability using SAMI2 output for ion densities, and electron
temperatures

Severity: Minor
Found in growin/growth_rate.py - About 7 hrs to fix

    Function get_growth_rates_survey has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
    Open

    def get_growth_rates_survey(start: int, stop: int, clean_level: str,
                                drift_key: str, season_names: list,
                                season_bounds: list, season_days: dict,
                                zone_names: list, zone_bounds: list,
                                zone_lons: dict):
    Severity: Minor
    Found in growin/_core.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 get_drifts has 10 arguments (exceeds 4 allowed). Consider refactoring.
    Open

    def get_drifts(start=2008, stop=2014, clean_level='none', drift_inst=None,
    Severity: Major
    Found in growin/_core.py - About 1 hr to fix

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

              tmp_dev = xr.DataArray(drift_medians[self.drift_key]['avg_abs_dev'],
                                     [coords[0], coords[1]])
      Severity: Major
      Found in growin/fourier_exb.py and 1 other location - About 1 hr to fix
      growin/fourier_exb.py on lines 88..89

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

      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

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

              tmp_drift = xr.DataArray(drift_medians[self.drift_key]['median'],
                                       [coords[0], coords[1]])
      Severity: Major
      Found in growin/fourier_exb.py and 1 other location - About 1 hr to fix
      growin/fourier_exb.py on lines 90..91

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

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

      def run_growth_calc(sami, coefficients=None, ve01=0):
          '''runs the growth rate calculation for a sami2 run. Requires external
             drift information until exb drifts from sami2 are an archived data prod.
      
          Parameters
      Severity: Minor
      Found in growin/growth_rate.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 get_growth_rates_survey has 10 arguments (exceeds 4 allowed). Consider refactoring.
      Open

      def get_growth_rates_survey(start: int, stop: int, clean_level: str,
      Severity: Major
      Found in growin/_core.py - About 1 hr to fix

        Function get_drifts has 9 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            def get_drifts(self, drift_key=None, num_co=10,
        Severity: Major
        Found in growin/fourier_exb.py - About 1 hr to fix

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

                      tube.R += ftc.r_local * ftc.n_e * ftc.len * 10**2
          Severity: Major
          Found in growin/growth_rate.py and 1 other location - About 1 hr to fix
          growin/growth_rate.py on lines 415..415

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

          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

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

                  exb += ((a * np.cos((i+1) * t * np.pi / 12))
                        + (b * np.sin((i+1) * t * np.pi / 12)))
          Severity: Major
          Found in growin/growth_rate.py and 1 other location - About 1 hr to fix
          growin/growth_rate.py on lines 486..486

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

          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

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

                          tube.nu_ef += ftc.nu * ftc.n_e * ftc.len * 10**2
          Severity: Major
          Found in growin/growth_rate.py and 1 other location - About 1 hr to fix
          growin/growth_rate.py on lines 411..411

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

          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 run_models has 8 arguments (exceeds 4 allowed). Consider refactoring.
          Open

          def run_models(sami, lat, lon, alt, cell, flux_tube, d_str, t_step):
          Severity: Major
          Found in growin/growth_rate.py - About 1 hr to fix

            Function get_growth has 7 arguments (exceeds 4 allowed). Consider refactoring.
            Open

            def get_growth(tag, day, year, lon, exb_drifts=None, ve01=0, f10=120.0):
            Severity: Major
            Found in growin/_core.py - About 50 mins to fix

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

              def generate_path(tag, lon=None, year=None, day=None, test=False, 
                                end_year=None):
                  """Creates a path based on run tag, date, and longitude
              
                  Parameters
              Severity: Minor
              Found in growin/utils.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 compile_drifts has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

                  def compile_drifts(self):
                      """Builds larger Dataset containg all of the drifts and fits over the
                         entire user-specified annual range.
                      """
                      year_drift = []
              Severity: Minor
              Found in growin/fourier_exb.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 eval_tubes has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

              def eval_tubes(sami, exb, t_step=0):
                  """calculate the flux tube integrated quantities for each flux tube needed
                     for the growth rate calculation
              
                  Parameters
              Severity: Minor
              Found in growin/growth_rate.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 generate_path has 6 arguments (exceeds 4 allowed). Consider refactoring.
              Open

              def generate_path(tag, lon=None, year=None, day=None, test=False, 
              Severity: Minor
              Found in growin/utils.py - About 45 mins to fix

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

                    def __init__(self, sami_data, ftl, ft, iyd, d_str, t_step):
                Severity: Minor
                Found in growin/growth_rate.py - About 45 mins to fix

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

                  def sigma_tot(denis, n_n, n_e, B, A, T_e):
                  Severity: Minor
                  Found in growin/growth_rate.py - About 45 mins to fix

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

                            if stop_year is None:
                                self.stop_year = self.bounds[1][0].year
                    Severity: Minor
                    Found in growin/fourier_exb.py and 1 other location - About 35 mins to fix
                    growin/fourier_exb.py on lines 180..181

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

                    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

                    Severity
                    Category
                    Status
                    Source
                    Language