poliastro/poliastro

View on GitHub

Showing 126 of 126 total issues

File orbit.py has 1191 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 941 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 814 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 758 lines of code (exceeds 350 allowed). Consider refactoring.
        Open

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

          File test_perturbations.py has 558 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 7 hrs 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 529 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

                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

                  Cyclomatic complexity is too high in function _altitude_profile. (20)
                  Open

                  @jit
                  def _altitude_profile(alt, Texo, x, y, E5M, E6P):
                      # Raise Value Error if alt < 90 km or alt > 2500 km.
                      if alt < 90 or 2500 < alt:
                          raise ValueError("Jacchia77 has been implemented in range 90km - 2500km.")

                  Cyclomatic Complexity

                  Cyclomatic Complexity corresponds to the number of decisions a block of code contains plus 1. This number (also called McCabe number) is equal to the number of linearly independent paths through the code. This number can be used as a guide when testing conditional logic in blocks.

                  Radon analyzes the AST tree of a Python program to compute Cyclomatic Complexity. Statements have the following effects on Cyclomatic Complexity:

                  Construct Effect on CC Reasoning
                  if +1 An if statement is a single decision.
                  elif +1 The elif statement adds another decision.
                  else +0 The else statement does not cause a new decision. The decision is at the if.
                  for +1 There is a decision at the start of the loop.
                  while +1 There is a decision at the while statement.
                  except +1 Each except branch adds a new conditional path of execution.
                  finally +0 The finally block is unconditionally executed.
                  with +1 The with statement roughly corresponds to a try/except block (see PEP 343 for details).
                  assert +1 The assert statement internally roughly equals a conditional statement.
                  Comprehension +1 A list/set/dict comprehension of generator expression is equivalent to a for loop.
                  Boolean Operator +1 Every boolean operator (and, or) adds a decision point.

                  Source: http://radon.readthedocs.org/en/latest/intro.html

                  File propagation.py has 422 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_coe has 92 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    def pimienta_coe(k, p, ecc, inc, raan, argp, nu, tof):
                    
                        q = p / (1 + ecc)
                    
                        # TODO: Do something to increase parabolic accuracy?
                    Severity: Major
                    Found in src/poliastro/core/propagation/__init__.py - About 3 hrs to fix

                      Cyclomatic complexity is too high in method heliosynchronous. (15)
                      Open

                          @classmethod
                          def heliosynchronous(
                              cls,
                              attractor,
                              a=None,
                      Severity: Minor
                      Found in src/poliastro/twobody/orbit.py by radon

                      Cyclomatic Complexity

                      Cyclomatic Complexity corresponds to the number of decisions a block of code contains plus 1. This number (also called McCabe number) is equal to the number of linearly independent paths through the code. This number can be used as a guide when testing conditional logic in blocks.

                      Radon analyzes the AST tree of a Python program to compute Cyclomatic Complexity. Statements have the following effects on Cyclomatic Complexity:

                      Construct Effect on CC Reasoning
                      if +1 An if statement is a single decision.
                      elif +1 The elif statement adds another decision.
                      else +0 The else statement does not cause a new decision. The decision is at the if.
                      for +1 There is a decision at the start of the loop.
                      while +1 There is a decision at the while statement.
                      except +1 Each except branch adds a new conditional path of execution.
                      finally +0 The finally block is unconditionally executed.
                      with +1 The with statement roughly corresponds to a try/except block (see PEP 343 for details).
                      assert +1 The assert statement internally roughly equals a conditional statement.
                      Comprehension +1 A list/set/dict comprehension of generator expression is equivalent to a for loop.
                      Boolean Operator +1 Every boolean operator (and, or) adds a decision point.

                      Source: http://radon.readthedocs.org/en/latest/intro.html

                      Cyclomatic complexity is too high in method add_orbit. (14)
                      Open

                          def add_orbit(
                              self,
                              orbit,
                              rtol=1e-10,
                              N=None,
                      Severity: Minor
                      Found in src/poliastro/czml/extract_czml.py by radon

                      Cyclomatic Complexity

                      Cyclomatic Complexity corresponds to the number of decisions a block of code contains plus 1. This number (also called McCabe number) is equal to the number of linearly independent paths through the code. This number can be used as a guide when testing conditional logic in blocks.

                      Radon analyzes the AST tree of a Python program to compute Cyclomatic Complexity. Statements have the following effects on Cyclomatic Complexity:

                      Construct Effect on CC Reasoning
                      if +1 An if statement is a single decision.
                      elif +1 The elif statement adds another decision.
                      else +0 The else statement does not cause a new decision. The decision is at the if.
                      for +1 There is a decision at the start of the loop.
                      while +1 There is a decision at the while statement.
                      except +1 Each except branch adds a new conditional path of execution.
                      finally +0 The finally block is unconditionally executed.
                      with +1 The with statement roughly corresponds to a try/except block (see PEP 343 for details).
                      assert +1 The assert statement internally roughly equals a conditional statement.
                      Comprehension +1 A list/set/dict comprehension of generator expression is equivalent to a for loop.
                      Boolean Operator +1 Every boolean operator (and, or) adds a decision point.

                      Source: http://radon.readthedocs.org/en/latest/intro.html

                      Cyclomatic complexity is too high in method frozen. (13)
                      Open

                          @classmethod
                          @u.quantity_input(
                              alt=u.m, inc=u.rad, argp=u.rad, raan=u.rad, arglat=u.rad, ecc=u.one
                          )
                          def frozen(
                      Severity: Minor
                      Found in src/poliastro/twobody/orbit.py by radon

                      Cyclomatic Complexity

                      Cyclomatic Complexity corresponds to the number of decisions a block of code contains plus 1. This number (also called McCabe number) is equal to the number of linearly independent paths through the code. This number can be used as a guide when testing conditional logic in blocks.

                      Radon analyzes the AST tree of a Python program to compute Cyclomatic Complexity. Statements have the following effects on Cyclomatic Complexity:

                      Construct Effect on CC Reasoning
                      if +1 An if statement is a single decision.
                      elif +1 The elif statement adds another decision.
                      else +0 The else statement does not cause a new decision. The decision is at the if.
                      for +1 There is a decision at the start of the loop.
                      while +1 There is a decision at the while statement.
                      except +1 Each except branch adds a new conditional path of execution.
                      finally +0 The finally block is unconditionally executed.
                      with +1 The with statement roughly corresponds to a try/except block (see PEP 343 for details).
                      assert +1 The assert statement internally roughly equals a conditional statement.
                      Comprehension +1 A list/set/dict comprehension of generator expression is equivalent to a for loop.
                      Boolean Operator +1 Every boolean operator (and, or) adds a decision point.

                      Source: http://radon.readthedocs.org/en/latest/intro.html

                      Cyclomatic complexity is too high in method porkchop. (13)
                      Open

                          def porkchop(self):
                              """Plots porkchop between two bodies.
                      
                              Returns
                              -------
                      Severity: Minor
                      Found in src/poliastro/plotting/porkchop.py by radon

                      Cyclomatic Complexity

                      Cyclomatic Complexity corresponds to the number of decisions a block of code contains plus 1. This number (also called McCabe number) is equal to the number of linearly independent paths through the code. This number can be used as a guide when testing conditional logic in blocks.

                      Radon analyzes the AST tree of a Python program to compute Cyclomatic Complexity. Statements have the following effects on Cyclomatic Complexity:

                      Construct Effect on CC Reasoning
                      if +1 An if statement is a single decision.
                      elif +1 The elif statement adds another decision.
                      else +0 The else statement does not cause a new decision. The decision is at the if.
                      for +1 There is a decision at the start of the loop.
                      while +1 There is a decision at the while statement.
                      except +1 Each except branch adds a new conditional path of execution.
                      finally +0 The finally block is unconditionally executed.
                      with +1 The with statement roughly corresponds to a try/except block (see PEP 343 for details).
                      assert +1 The assert statement internally roughly equals a conditional statement.
                      Comprehension +1 A list/set/dict comprehension of generator expression is equivalent to a for loop.
                      Boolean Operator +1 Every boolean operator (and, or) adds a decision point.

                      Source: http://radon.readthedocs.org/en/latest/intro.html

                      Cyclomatic complexity is too high in function rvel. (12)
                      Open

                      def rvel(r, v):
                          """
                          Convert state vector to mean orbital elements
                          """
                      
                      
                      Severity: Minor
                      Found in contrib/rv2tle.py by radon

                      Cyclomatic Complexity

                      Cyclomatic Complexity corresponds to the number of decisions a block of code contains plus 1. This number (also called McCabe number) is equal to the number of linearly independent paths through the code. This number can be used as a guide when testing conditional logic in blocks.

                      Radon analyzes the AST tree of a Python program to compute Cyclomatic Complexity. Statements have the following effects on Cyclomatic Complexity:

                      Construct Effect on CC Reasoning
                      if +1 An if statement is a single decision.
                      elif +1 The elif statement adds another decision.
                      else +0 The else statement does not cause a new decision. The decision is at the if.
                      for +1 There is a decision at the start of the loop.
                      while +1 There is a decision at the while statement.
                      except +1 Each except branch adds a new conditional path of execution.
                      finally +0 The finally block is unconditionally executed.
                      with +1 The with statement roughly corresponds to a try/except block (see PEP 343 for details).
                      assert +1 The assert statement internally roughly equals a conditional statement.
                      Comprehension +1 A list/set/dict comprehension of generator expression is equivalent to a for loop.
                      Boolean Operator +1 Every boolean operator (and, or) adds a decision point.

                      Source: http://radon.readthedocs.org/en/latest/intro.html

                      Function _altitude_profile has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
                      Open

                      def _altitude_profile(alt, Texo, x, y, E5M, E6P):
                          # Raise Value Error if alt < 90 km or alt > 2500 km.
                          if alt < 90 or 2500 < alt:
                              raise ValueError("Jacchia77 has been implemented in range 90km - 2500km.")
                      
                      
                      Severity: Minor
                      Found in src/poliastro/core/earth_atmosphere/jacchia.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

                      Cyclomatic complexity is too high in function delta_t_from_nu. (10)
                      Open

                      @jit
                      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

                      Cyclomatic Complexity

                      Cyclomatic Complexity corresponds to the number of decisions a block of code contains plus 1. This number (also called McCabe number) is equal to the number of linearly independent paths through the code. This number can be used as a guide when testing conditional logic in blocks.

                      Radon analyzes the AST tree of a Python program to compute Cyclomatic Complexity. Statements have the following effects on Cyclomatic Complexity:

                      Construct Effect on CC Reasoning
                      if +1 An if statement is a single decision.
                      elif +1 The elif statement adds another decision.
                      else +0 The else statement does not cause a new decision. The decision is at the if.
                      for +1 There is a decision at the start of the loop.
                      while +1 There is a decision at the while statement.
                      except +1 Each except branch adds a new conditional path of execution.
                      finally +0 The finally block is unconditionally executed.
                      with +1 The with statement roughly corresponds to a try/except block (see PEP 343 for details).
                      assert +1 The assert statement internally roughly equals a conditional statement.
                      Comprehension +1 A list/set/dict comprehension of generator expression is equivalent to a for loop.
                      Boolean Operator +1 Every boolean operator (and, or) adds a decision point.

                      Source: http://radon.readthedocs.org/en/latest/intro.html

                      Cyclomatic complexity is too high in function cowell. (10)
                      Open

                      def cowell(k, r, v, tofs, rtol=1e-11, *, events=None, f=func_twobody):
                          """Propagates orbit using Cowell's formulation.
                      
                          Parameters
                          ----------
                      Severity: Minor
                      Found in src/poliastro/twobody/propagation.py by radon

                      Cyclomatic Complexity

                      Cyclomatic Complexity corresponds to the number of decisions a block of code contains plus 1. This number (also called McCabe number) is equal to the number of linearly independent paths through the code. This number can be used as a guide when testing conditional logic in blocks.

                      Radon analyzes the AST tree of a Python program to compute Cyclomatic Complexity. Statements have the following effects on Cyclomatic Complexity:

                      Construct Effect on CC Reasoning
                      if +1 An if statement is a single decision.
                      elif +1 The elif statement adds another decision.
                      else +0 The else statement does not cause a new decision. The decision is at the if.
                      for +1 There is a decision at the start of the loop.
                      while +1 There is a decision at the while statement.
                      except +1 Each except branch adds a new conditional path of execution.
                      finally +0 The finally block is unconditionally executed.
                      with +1 The with statement roughly corresponds to a try/except block (see PEP 343 for details).
                      assert +1 The assert statement internally roughly equals a conditional statement.
                      Comprehension +1 A list/set/dict comprehension of generator expression is equivalent to a for loop.
                      Boolean Operator +1 Every boolean operator (and, or) adds a decision point.

                      Source: http://radon.readthedocs.org/en/latest/intro.html

                      File elements.py has 367 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.
                      """
                      
                      import numpy as np
                      Severity: Minor
                      Found in src/poliastro/core/elements.py - About 2 hrs to fix
                        Severity
                        Category
                        Status
                        Source
                        Language