poliastro/poliastro

View on GitHub

Showing 47 of 116 total issues

File orbit.py has 1220 lines of code (exceeds 350 allowed). Consider refactoring.
Open

from typing import List, Union
from warnings import warn

import numpy as np
from astropy import time, units as u
Severity: Major
Found in src/poliastro/twobody/orbit.py - About 2 days to fix

    File test_orbit.py has 960 lines of code (exceeds 350 allowed). Consider refactoring.
    Open

    import pickle
    from collections import OrderedDict
    from functools import partial
    from unittest import mock
    
    
    Severity: Major
    Found in tests/tests_twobody/test_orbit.py - About 2 days to fix

      File test_czml.py has 778 lines of code (exceeds 350 allowed). Consider refactoring.
      Open

      import sys
      
      # TODO: Should we have way to handle this configuration without importing numba?
      import pytest
      from astropy import units as u
      Severity: Major
      Found in tests/test_czml.py - About 1 day to fix

        File __init__.py has 728 lines of code (exceeds 350 allowed). Consider refactoring.
        Open

        """ Low level propagation algorithms """
        
        import numpy as np
        
        from .._jit import jit
        Severity: Major
        Found in src/poliastro/core/propagation/__init__.py - About 1 day to fix

          File general.py has 558 lines of code (exceeds 350 allowed). Consider refactoring.
          Open

          """Astronomical and physics constants.
          
          This module complements constants defined in `astropy.constants`,
          with gravitational paremeters and radii.
          
          
          Severity: Major
          Found in src/poliastro/constants/general.py - About 7 hrs to fix

            File extract_czml.py has 522 lines of code (exceeds 350 allowed). Consider refactoring.
            Open

            from datetime import timezone
            from typing import Any, List
            
            import numpy as np
            from astropy import units as u
            Severity: Major
            Found in src/poliastro/czml/extract_czml.py - About 6 hrs to fix

              File dastcom5.py has 521 lines of code (exceeds 350 allowed). Consider refactoring.
              Open

              """NEOs orbit from DASTCOM5 database.
              
              """
              import os
              import re
              Severity: Major
              Found in src/poliastro/neos/dastcom5.py - About 6 hrs to fix

                File test_perturbations.py has 521 lines of code (exceeds 350 allowed). Consider refactoring.
                Open

                import functools
                
                import numpy as np
                import pytest
                from astropy import units as u
                Severity: Major
                Found in tests/tests_twobody/test_perturbations.py - About 6 hrs to fix

                  Orbit has 33 functions (exceeds 20 allowed). Consider refactoring.
                  Open

                  class Orbit:
                      """Position and velocity of a body with respect to an attractor
                      at a given time (epoch).
                  
                      Regardless of how the Orbit is created, the implicit
                  Severity: Minor
                  Found in src/poliastro/twobody/orbit.py - About 4 hrs to fix

                    File propagation.py has 426 lines of code (exceeds 350 allowed). Consider refactoring.
                    Open

                    """The following script holds the different high level functions for the
                    different propagators available at poliastro:
                    
                    +-------------+------------+-----------------+-----------------+
                    |  Propagator | Elliptical |    Parabolic    |    Hyperbolic   |
                    Severity: Minor
                    Found in src/poliastro/twobody/propagation.py - About 3 hrs to fix

                      Function pimienta has 95 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      def pimienta(k, r0, v0, tof):
                          """ Raw algorithm for Adonis' Pimienta and John L. Crassidis 15th order
                          polynomial Kepler solver.
                      
                          Parameters
                      Severity: Major
                      Found in src/poliastro/core/propagation/__init__.py - About 3 hrs to fix

                        File elements.py has 362 lines of code (exceeds 350 allowed). Consider refactoring.
                        Open

                        """This module contains a set of functions that can be used
                            to convert between different elements that define the orbit
                            of a body.
                            """
                        
                        
                        Severity: Minor
                        Found in src/poliastro/core/elements.py - About 2 hrs to fix

                          Function add_orbit has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
                          Open

                              def add_orbit(
                                  self,
                                  orbit,
                                  rtol=1e-10,
                                  N=None,
                          Severity: Minor
                          Found in src/poliastro/czml/extract_czml.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

                          File angles.py has 351 lines of code (exceeds 350 allowed). Consider refactoring.
                          Open

                          import numpy as np
                          
                          from ._jit import jit
                          
                          
                          
                          Severity: Minor
                          Found in src/poliastro/core/angles.py - About 2 hrs to fix

                            Function heliosynchronous has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                            Open

                                def heliosynchronous(
                                    cls,
                                    attractor,
                                    a=None,
                                    ecc=None,
                            Severity: Minor
                            Found in src/poliastro/twobody/orbit.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 danby has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                            Open

                            def danby(k, r0, v0, tof, numiter=20, rtol=1e-8):
                                """ Kepler solver for both elliptic and parabolic orbits based on Danby's
                                algorithm.
                            
                                Parameters
                            Severity: Minor
                            Found in src/poliastro/core/propagation/__init__.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

                            Consider simplifying this complex logical expression.
                            Open

                                            if (a is None) and (ecc is None) and (inc is None):
                                                # We check sufficient number of parameters
                                                raise ValueError(
                                                    "At least two parameters of the set {a, ecc, inc} are required."
                                                )
                            Severity: Critical
                            Found in src/poliastro/twobody/orbit.py - About 1 hr to fix

                              Function add_orbit has 18 arguments (exceeds 9 allowed). Consider refactoring.
                              Open

                                  def add_orbit(
                              Severity: Major
                              Found in src/poliastro/czml/extract_czml.py - About 1 hr to fix

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

                                def delta_t_from_nu(nu, ecc, k=1.0, q=1.0, delta=1e-2):
                                    """Time elapsed since periapsis for given true anomaly.
                                
                                    Parameters
                                    ----------
                                Severity: Minor
                                Found in src/poliastro/core/propagation/farnocchia.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 mikkola has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                                Open

                                def mikkola(k, r0, v0, tof, rtol=None):
                                    """ Raw algorithm for Mikkola's Kepler solver.
                                
                                    Parameters
                                    ----------
                                Severity: Minor
                                Found in src/poliastro/core/propagation/__init__.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

                                Severity
                                Category
                                Status
                                Source
                                Language