pbrod/Nvector

View on GitHub
src/nvector/objects.py

Summary

Maintainability
D
2 days
Test Coverage

File objects.py has 1326 lines of code (exceeds 1000 allowed). Consider refactoring.
Open

"""
Object oriented interface to geodesic functions
===============================================

"""
Severity: Major
Found in src/nvector/objects.py - About 1 day to fix

    Consider using '{rtol: rtol, atol: atol}' instead of a call to 'dict'.
    Open

            options = dict(rtol=rtol, atol=atol)
    Severity: Info
    Found in src/nvector/objects.py by pylint

    Emitted when using dict() to create a dictionary instead of a literal '{ ... }'. The literal is faster as it avoids an additional function call.

    Class 'GeoPath' inherits from object, can be safely removed from bases in python3
    Open

    class GeoPath(object):
    Severity: Info
    Found in src/nvector/objects.py by pylint

    Used when a class inherit from object, which under python3 is implicit, hence can be safely removed from bases.

    Too many arguments (8/5)
    Open

        def direct(self, lat_a, lon_a, azimuth, distance, z=0, long_unroll=False, degrees=False):
    Severity: Info
    Found in src/nvector/objects.py by pylint

    Used when a function or method takes too many arguments.

    Too many arguments (6/5)
    Open

        def __init__(self, point, yaw=0, pitch=0, roll=0, degrees=False):
    Severity: Info
    Found in src/nvector/objects.py by pylint

    Used when a function or method takes too many arguments.

    Too many arguments (6/5)
    Open

        def __init__(self, latitude, longitude, z=0, frame=None, degrees=False):
    Severity: Info
    Found in src/nvector/objects.py by pylint

    Used when a function or method takes too many arguments.

    Too many arguments (8/5)
    Open

        def interpolate(self, t_i, t, kind='linear', window_length=0, polyorder=2,
    Severity: Info
    Found in src/nvector/objects.py by pylint

    Used when a function or method takes too many arguments.

    Too many arguments (6/5)
    Open

        def displace(self, distance, azimuth, long_unroll=False, degrees=False, method='ellipsoid'):
    Severity: Info
    Found in src/nvector/objects.py by pylint

    Used when a function or method takes too many arguments.

    Consider using '{rtol: rtol, atol: atol}' instead of a call to 'dict'.
    Open

            options = dict(rtol=rtol, atol=atol)
    Severity: Info
    Found in src/nvector/objects.py by pylint

    Emitted when using dict() to create a dictionary instead of a literal '{ ... }'. The literal is faster as it avoids an additional function call.

    Too many arguments (7/5)
    Open

        def inverse(self, lat_a, lon_a, lat_b, lon_b, z=0, degrees=False):
    Severity: Info
    Found in src/nvector/objects.py by pylint

    Used when a function or method takes too many arguments.

    Class '_Common' inherits from object, can be safely removed from bases in python3
    Open

    class _Common(object):
    Severity: Info
    Found in src/nvector/objects.py by pylint

    Used when a class inherit from object, which under python3 is implicit, hence can be safely removed from bases.

    Consider using '{rtol: rtol, atol: atol}' instead of a call to 'dict'.
    Open

            options = dict(rtol=rtol, atol=atol)
    Severity: Info
    Found in src/nvector/objects.py by pylint

    Emitted when using dict() to create a dictionary instead of a literal '{ ... }'. The literal is faster as it avoids an additional function call.

    Consider using Python 3 style super() without arguments
    Open

            super(ECEFvector, self).__init__(pvector, _default_frame(frame), scalar)
    Severity: Info
    Found in src/nvector/objects.py by pylint

    Emitted when calling the super() builtin with the current class and instance. On Python 3 these arguments are the default and they can be omitted.

    Consider using Python 3 style super() without arguments
    Open

            super(FrameL, self).__init__(point)
    Severity: Info
    Found in src/nvector/objects.py by pylint

    Emitted when calling the super() builtin with the current class and instance. On Python 3 these arguments are the default and they can be omitted.

    Too many local variables (16/15)
    Open

        def direct(self, lat_a, lon_a, azimuth, distance, z=0, long_unroll=False, degrees=False):
    Severity: Info
    Found in src/nvector/objects.py by pylint

    Used when a function or method has too many local variables.

    Too few public methods (1/2)
    Open

    class _LocalFrame(_Common):
    Severity: Info
    Found in src/nvector/objects.py by pylint

    Used when class has too few public methods, so be sure it's really worth it.

    TODO: vectorize this
    Open

            # TODO: vectorize this
    Severity: Minor
    Found in src/nvector/objects.py by pylint

    Used when a warning note as FIXME or XXX is detected.

    Unable to import 'numpy'
    Open

    import numpy as np
    Severity: Critical
    Found in src/nvector/objects.py by pylint

    Used when pylint has been unable to import a module.

    TODO: remove this:
    Open

    # TODO: remove this:
    Severity: Minor
    Found in src/nvector/objects.py by pylint

    Used when a warning note as FIXME or XXX is detected.

    Unused partial imported from functools
    Open

    from functools import partial
    Severity: Minor
    Found in src/nvector/objects.py by pylint

    Used when an imported module or variable is not used.

    Unable to import 'geographiclib.geodesic'
    Open

    from geographiclib.geodesic import Geodesic as _Geodesic
    Severity: Critical
    Found in src/nvector/objects.py by pylint

    Used when pylint has been unable to import a module.

    TODO: remove this:
    Open

    # TODO: remove this:
    Severity: Minor
    Found in src/nvector/objects.py by pylint

    Used when a warning note as FIXME or XXX is detected.

    Unable to import 'numpy.linalg'
    Open

    from numpy.linalg import norm
    Severity: Critical
    Found in src/nvector/objects.py by pylint

    Used when pylint has been unable to import a module.

    TODO found
    Open

            # TODO: vectorize this
    Severity: Minor
    Found in src/nvector/objects.py by fixme

    TODO found
    Open

    # TODO: remove this:
    Severity: Minor
    Found in src/nvector/objects.py by fixme

    TODO found
    Open

    # TODO: remove this:
    Severity: Minor
    Found in src/nvector/objects.py by fixme

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

    __doc__ = (__doc__  # @ReservedAssignment
               + _make_summary(dict((n, _ODICT[n]) for n in __all__))
               + 'License\n-------\n'
               + _license.__doc__)
    Severity: Major
    Found in src/nvector/objects.py and 3 other locations - About 2 hrs to fix
    src/nvector/core.py on lines 1351..1354
    src/nvector/rotation.py on lines 571..574
    src/nvector/util.py on lines 599..602

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

    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 3 locations. Consider refactoring.
    Open

        @use_docstring_from(ECEFvector)
        def ECEFvector(self, *args, **kwds):
            "{super}"
            kwds.pop('frame', None)
            return ECEFvector(*args, frame=self, **kwds)
    Severity: Major
    Found in src/nvector/objects.py and 2 other locations - About 1 hr to fix
    src/nvector/objects.py on lines 1461..1465
    src/nvector/objects.py on lines 1467..1471

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

    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

            if np.ndim(radius) == 0 and distance.size == 1:
                return distance[0]  # scalar cross track distance
    Severity: Major
    Found in src/nvector/objects.py and 1 other location - About 1 hr to fix
    src/nvector/objects.py on lines 1077..1078

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

    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

            if np.ndim(radius) == 0 and result.size == 1:
                return result[0]  # scalar outout
    Severity: Major
    Found in src/nvector/objects.py and 1 other location - About 1 hr to fix
    src/nvector/objects.py on lines 990..991

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

    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 3 locations. Consider refactoring.
    Open

        @use_docstring_from(Nvector)
        def Nvector(self, *args, **kwds):
            "{super}"
            kwds.pop('frame', None)
            return Nvector(*args, frame=self, **kwds)
    Severity: Major
    Found in src/nvector/objects.py and 2 other locations - About 1 hr to fix
    src/nvector/objects.py on lines 1461..1465
    src/nvector/objects.py on lines 1473..1477

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

    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 3 locations. Consider refactoring.
    Open

        @use_docstring_from(GeoPoint)
        def GeoPoint(self, *args, **kwds):
            "{super}"
            kwds.pop('frame', None)
            return GeoPoint(*args, frame=self, **kwds)
    Severity: Major
    Found in src/nvector/objects.py and 2 other locations - About 1 hr to fix
    src/nvector/objects.py on lines 1467..1471
    src/nvector/objects.py on lines 1473..1477

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

    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

        @property
        def positionA(self):
            """positionA is deprecated, use point_a instead!"""  # @ReservedAssignment
            warnings.warn("positionA is deprecated, use point_a instead!",
                          category=DeprecationWarning, stacklevel=2)
    Severity: Minor
    Found in src/nvector/objects.py and 1 other location - About 30 mins to fix
    src/nvector/objects.py on lines 931..936

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

    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

        @property
        def positionB(self):
            """positionB is deprecated, use point_b instead!"""  # @ReservedAssignment
            warnings.warn("positionB is deprecated, use point_b instead!",
                          category=DeprecationWarning, stacklevel=2)
    Severity: Minor
    Found in src/nvector/objects.py and 1 other location - About 30 mins to fix
    src/nvector/objects.py on lines 924..929

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

    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

    Missing whitespace around arithmetic operator
    Open

        return np.mod(angle_rad + np.pi, 2*np.pi) - np.pi
    Severity: Minor
    Found in src/nvector/objects.py by pep8

    Surround operators with a single space on either side.

    - Always surround these binary operators with a single space on
      either side: assignment (=), augmented assignment (+=, -= etc.),
      comparisons (==, <, >, !=, <=, >=, in, not in, is, is not),
      Booleans (and, or, not).
    
    - If operators with different priorities are used, consider adding
      whitespace around the operators with the lowest priorities.
    
    Okay: i = i + 1
    Okay: submitted += 1
    Okay: x = x * 2 - 1
    Okay: hypot2 = x * x + y * y
    Okay: c = (a + b) * (a - b)
    Okay: foo(bar, key='word', *args, **kwargs)
    Okay: alpha[:-i]
    
    E225: i=i+1
    E225: submitted +=1
    E225: x = x /2 - 1
    E225: z = x **y
    E225: z = 1and 1
    E226: c = (a+b) * (a-b)
    E226: hypot2 = x*x + y*y
    E227: c = a|b
    E228: msg = fmt%(errno, errmsg)

    Missing whitespace around arithmetic operator
    Open

            a1, f = self.a-z, self.f
    Severity: Minor
    Found in src/nvector/objects.py by pep8

    Surround operators with a single space on either side.

    - Always surround these binary operators with a single space on
      either side: assignment (=), augmented assignment (+=, -= etc.),
      comparisons (==, <, >, !=, <=, >=, in, not in, is, is not),
      Booleans (and, or, not).
    
    - If operators with different priorities are used, consider adding
      whitespace around the operators with the lowest priorities.
    
    Okay: i = i + 1
    Okay: submitted += 1
    Okay: x = x * 2 - 1
    Okay: hypot2 = x * x + y * y
    Okay: c = (a + b) * (a - b)
    Okay: foo(bar, key='word', *args, **kwargs)
    Okay: alpha[:-i]
    
    E225: i=i+1
    E225: submitted +=1
    E225: x = x /2 - 1
    E225: z = x **y
    E225: z = 1and 1
    E226: c = (a+b) * (a-b)
    E226: hypot2 = x*x + y*y
    E227: c = a|b
    E228: msg = fmt%(errno, errmsg)

    Formatting a regular string which could be a f-string
    Open

            return '{}({})'.format(cname, params)
    Severity: Info
    Found in src/nvector/objects.py by pylint

    Used when we detect a string that is being formatted with format() or % which could potentially be a f-string. The use of f-strings is preferred. Requires Python 3.6 and py-version >= 3.6.

    Formatting a regular string which could be a f-string
    Open

            params = fmt.join(['{}={!r}'.format(name, dict_params[name])
    Severity: Info
    Found in src/nvector/objects.py by pylint

    Used when we detect a string that is being formatted with format() or % which could potentially be a f-string. The use of f-strings is preferred. Requires Python 3.6 and py-version >= 3.6.

    Too many lines in module (1664/1000)
    Open

    """
    Severity: Info
    Found in src/nvector/objects.py by pylint

    Used when a module has too many lines, reducing its readability.

    There are no issues that match your filters.

    Category
    Status