aburrell/apexpy

View on GitHub

Showing 28 of 90 total issues

File test_Apex.py has 1419 lines of code (exceeds 250 allowed). Consider refactoring.
Open

# -*- coding: utf-8 -*-
"""Test the apexpy.Apex class

Notes
-----
Severity: Major
Found in apexpy/tests/test_Apex.py - About 3 days to fix

    File apex.py has 997 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    # -*- coding: utf-8 -*-
    """Classes that make up the core of apexpy."""
    
    import datetime as dt
    import numpy as np
    Severity: Major
    Found in apexpy/apex.py - About 2 days to fix

      Function convert has a Cognitive Complexity of 36 (exceeds 5 allowed). Consider refactoring.
      Open

          def convert(self, lat, lon, source, dest, height=0, datetime=None,
                      precision=1e-10, ssheight=50 * 6371):
              """Converts between geodetic, modified apex, quasi-dipole and MLT.
      
              Parameters
      Severity: Minor
      Found in apexpy/apex.py - About 5 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 __eq__ has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
      Open

          def __eq__(self, comp_obj):
              """Performs equivalency evaluation.
      
              Parameters
              ----------
      Severity: Minor
      Found in apexpy/apex.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

      Apex has 28 functions (exceeds 20 allowed). Consider refactoring.
      Open

      class Apex(object):
          """Calculates coordinate conversions, field-line mapping, and base vectors.
      
          Parameters
          ----------
      Severity: Minor
      Found in apexpy/apex.py - About 3 hrs to fix

        File test_helpers.py has 271 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        # -*- coding: utf-8 -*-
        """Test the apexpy.helper submodule
        
        Notes
        -----
        Severity: Minor
        Found in apexpy/tests/test_helpers.py - About 2 hrs to fix

          TestApexMethod has 22 functions (exceeds 20 allowed). Consider refactoring.
          Open

          class TestApexMethod(object):
              """Test the Apex methods."""
              def setup_method(self):
                  """Initialize all tests."""
                  self.apex_out = apexpy.Apex(date=2000, refh=300)
          Severity: Minor
          Found in apexpy/tests/test_Apex.py - About 2 hrs to fix

            Function basevectors_apex has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
            Open

                def basevectors_apex(self, lat, lon, height, coords='geo', precision=1e-10):
                    """Returns base vectors in quasi-dipole and apex coordinates.
            
                    Parameters
                    ----------
            Severity: Minor
            Found in apexpy/apex.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 _map_EV_to_height has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
            Open

                def _map_EV_to_height(self, alat, alon, height, newheight, data, ev_flag):
                    """Maps electric field related values to a desired height
            
                    Parameters
                    ----------
            Severity: Minor
            Found in apexpy/apex.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 setup_method has 27 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                def setup_method(self):
                    """Initialize each test."""
                    fa.loadapxsh(os.path.join(os.path.dirname(apexpy.__file__),
                                              'apexsh.dat'), 2000)
            
            
            Severity: Minor
            Found in apexpy/tests/test_fortranapex.py - About 1 hr to fix

              Function convert has 8 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                  def convert(self, lat, lon, source, dest, height=0, datetime=None,
              Severity: Major
              Found in apexpy/apex.py - About 1 hr to fix

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

                    def __init__(self, date=None, refh=0, datafile=None, fortranlib=None):
                
                        if datafile is None:
                            datafile = os.path.join(os.path.dirname(__file__), 'apexsh.dat')
                
                
                Severity: Minor
                Found in apexpy/apex.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 get_comparison_results has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                Open

                    def get_comparison_results(self, bv_coord, coords, precision):
                        """Get the base vector results using the hidden function for comparison.
                
                        Parameters
                        ----------
                Severity: Minor
                Found in apexpy/tests/test_Apex.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 _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

                    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

                      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

                        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
                              Severity
                              Category
                              Status
                              Source
                              Language