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
-----
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
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
- Read upRead up
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
----------
- Read upRead up
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
----------
File test_helpers.py
has 271 lines of code (exceeds 250 allowed). Consider refactoring. Open
# -*- coding: utf-8 -*-
"""Test the apexpy.helper submodule
Notes
-----
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)
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
----------
- Read upRead up
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
----------
- Read upRead up
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)
Function convert
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
def convert(self, lat, lon, source, dest, height=0, datetime=None,
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')
- Read upRead up
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
----------
- Read upRead up
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):
Function test_fortran_longitude_rollover
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def test_fortran_longitude_rollover(self, apex_method, fortran_method,
Avoid deeply nested control flow statements. Open
if cval != aval:
# Not equal, as the attribute values differ
bad_attr = True
else:
Function map_to_height
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def map_to_height(self, glat, glon, height, newheight, conjugate=False,
Function basevectors_qd
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def basevectors_qd(self, lat, lon, height, coords='geo', precision=1e-10):
Function basevectors_apex
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def basevectors_apex(self, lat, lon, height, coords='geo', precision=1e-10):
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,