aburrell/apexpy

View on GitHub

Showing 90 of 90 total issues

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

    return np.cos(np.radians(alat)) / np.sqrt(4 - 3
                                              * np.cos(np.radians(alat))**2)
Severity: Minor
Found in apexpy/helpers.py and 1 other location - About 55 mins to fix
apexpy/helpers.py on lines 55..56

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

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

            np.testing.assert_allclose(aret[0].astype(float),
                                       flats.reshape(arr_shape).astype(float))
Severity: Minor
Found in apexpy/tests/test_Apex.py and 1 other location - About 50 mins to fix
apexpy/tests/test_Apex.py on lines 476..477

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

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

            np.testing.assert_allclose(aret[1].astype(float),
                                       flons.reshape(arr_shape).astype(float))
Severity: Minor
Found in apexpy/tests/test_Apex.py and 1 other location - About 50 mins to fix
apexpy/tests/test_Apex.py on lines 474..475

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

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

    def _map_EV_to_height(self, alat, alon, height, newheight, data, ev_flag):
Severity: Minor
Found in apexpy/apex.py - About 45 mins to fix

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

        def test_fortran_longitude_rollover(self, apex_method, fortran_method,
    Severity: Minor
    Found in apexpy/tests/test_Apex.py - About 45 mins to fix

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

                  assert np.all(self.test_basevec[i][0] == vec[0])
      Severity: Minor
      Found in apexpy/tests/test_Apex.py and 1 other location - About 45 mins to fix
      apexpy/tests/test_Apex.py on lines 1528..1528

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

      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

      Avoid deeply nested control flow statements.
      Open

                              if cval != aval:
                                  # Not equal, as the attribute values differ
                                  bad_attr = True
                          else:
      Severity: Major
      Found in apexpy/apex.py - About 45 mins to fix

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

                    assert np.all(self.test_basevec[i][1] == vec[1])
        Severity: Minor
        Found in apexpy/tests/test_Apex.py and 1 other location - About 45 mins to fix
        apexpy/tests/test_Apex.py on lines 1527..1527

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

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

            def map_to_height(self, glat, glon, height, newheight, conjugate=False,
        Severity: Minor
        Found in apexpy/apex.py - About 45 mins to fix

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

                  np.arange(np.datetime64("1601"), np.datetime64("2100"),
                            np.timedelta64(1, 'Y')).astype('datetime64[s]')])
          Severity: Minor
          Found in apexpy/tests/test_helpers.py and 1 other location - About 40 mins to fix
          apexpy/tests/test_helpers.py on lines 299..300

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

          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

                  np.arange(np.datetime64("2000"), np.datetime64("2001"),
                            np.timedelta64(1, 'M')).astype('datetime64[s]').reshape((3,
          Severity: Minor
          Found in apexpy/tests/test_helpers.py and 1 other location - About 40 mins to fix
          apexpy/tests/test_helpers.py on lines 302..303

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

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

              def basevectors_qd(self, lat, lon, height, coords='geo', precision=1e-10):
          Severity: Minor
          Found in apexpy/apex.py - About 35 mins to fix

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

                def basevectors_apex(self, lat, lon, height, coords='geo', precision=1e-10):
            Severity: Minor
            Found in apexpy/apex.py - About 35 mins to fix

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

                  def test_fortran_scalar_input(self, apex_method, fortran_method, fslice,
              Severity: Minor
              Found in apexpy/tests/test_Apex.py - About 35 mins to fix

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

                    def bvectors_apex(self, lat, lon, height, coords='geo', precision=1e-10):
                Severity: Minor
                Found in apexpy/apex.py - About 35 mins to fix

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

                      def map_V_to_height(self, alat, alon, height, newheight, vdata):
                  Severity: Minor
                  Found in apexpy/apex.py - About 35 mins to fix

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

                        def map_E_to_height(self, alat, alon, height, newheight, edata):
                    Severity: Minor
                    Found in apexpy/apex.py - About 35 mins to fix

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

                      def subsol(datetime):
                          """Finds subsolar geocentric latitude and longitude.
                      
                          Parameters
                          ----------
                      Severity: Minor
                      Found in apexpy/helpers.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

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

                          def map_V_to_height(self, alat, alon, height, newheight, vdata):
                              """Performs mapping of electric drift velocity along the magnetic field.
                      
                              It is assumed that the electric field is perpendicular to B.
                      
                      
                      Severity: Minor
                      Found in apexpy/apex.py and 1 other location - About 35 mins to fix
                      apexpy/apex.py on lines 877..906

                      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

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

                          def test_geo2apexall_array(self, arr_shape):
                              """Test Apex/fortran geo2apexall interface consistency for arrays.
                      
                              Parameters
                              ----------
                      Severity: Minor
                      Found in apexpy/tests/test_Apex.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

                      Severity
                      Category
                      Status
                      Source
                      Language